Skip to content

Commit 3dd868b

Browse files
authored
test: improve process.config code (#228)
1 parent 7efe5c3 commit 3dd868b

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

test/utils.spec.ts

+18-7
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ describe('utils', () => {
8080
Object.defineProperty(process, 'arch', {
8181
value: savedArch,
8282
});
83-
process.config.variables = savedVariables;
83+
Object.defineProperty(process.config, 'variables', {
84+
value: savedVariables,
85+
});
8486
});
8587

8688
it('should return process.arch on x64', () => {
@@ -101,8 +103,9 @@ describe('utils', () => {
101103
Object.defineProperty(process, 'arch', {
102104
value: 'arm',
103105
});
104-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
105-
process.config.variables = {} as any;
106+
Object.defineProperty(process.config, 'variables', {
107+
value: {},
108+
});
106109
expect(getHostArch()).toEqual('armv7l');
107110
});
108111

@@ -111,8 +114,12 @@ describe('utils', () => {
111114
Object.defineProperty(process, 'arch', {
112115
value: 'arm',
113116
});
114-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/camelcase
115-
process.config.variables = { arm_version: '6' } as any;
117+
Object.defineProperty(process.config, 'variables', {
118+
value: {
119+
// eslint-disable-next-line @typescript-eslint/camelcase
120+
arm_version: '6',
121+
},
122+
});
116123
expect(getHostArch()).toEqual(uname());
117124
});
118125
}
@@ -121,8 +128,12 @@ describe('utils', () => {
121128
Object.defineProperty(process, 'arch', {
122129
value: 'arm',
123130
});
124-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/camelcase
125-
process.config.variables = { arm_version: '7' } as any;
131+
Object.defineProperty(process.config, 'variables', {
132+
value: {
133+
// eslint-disable-next-line @typescript-eslint/camelcase
134+
arm_version: '7',
135+
},
136+
});
126137
expect(getHostArch()).toEqual('armv7l');
127138
});
128139
});

0 commit comments

Comments
 (0)