Skip to content

Commit

Permalink
test: improve process.config code (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackHole1 authored Oct 18, 2022
1 parent 7efe5c3 commit 3dd868b
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions test/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ describe('utils', () => {
Object.defineProperty(process, 'arch', {
value: savedArch,
});
process.config.variables = savedVariables;
Object.defineProperty(process.config, 'variables', {
value: savedVariables,
});
});

it('should return process.arch on x64', () => {
Expand All @@ -101,8 +103,9 @@ describe('utils', () => {
Object.defineProperty(process, 'arch', {
value: 'arm',
});
// eslint-disable-next-line @typescript-eslint/no-explicit-any
process.config.variables = {} as any;
Object.defineProperty(process.config, 'variables', {
value: {},
});
expect(getHostArch()).toEqual('armv7l');
});

Expand All @@ -111,8 +114,12 @@ describe('utils', () => {
Object.defineProperty(process, 'arch', {
value: 'arm',
});
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/camelcase
process.config.variables = { arm_version: '6' } as any;
Object.defineProperty(process.config, 'variables', {
value: {
// eslint-disable-next-line @typescript-eslint/camelcase
arm_version: '6',
},
});
expect(getHostArch()).toEqual(uname());
});
}
Expand All @@ -121,8 +128,12 @@ describe('utils', () => {
Object.defineProperty(process, 'arch', {
value: 'arm',
});
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/camelcase
process.config.variables = { arm_version: '7' } as any;
Object.defineProperty(process.config, 'variables', {
value: {
// eslint-disable-next-line @typescript-eslint/camelcase
arm_version: '7',
},
});
expect(getHostArch()).toEqual('armv7l');
});
});
Expand Down

0 comments on commit 3dd868b

Please sign in to comment.