@@ -30,6 +30,7 @@ let Worker: typeof import('../ChildProcessWorker').default;
30
30
let childProcess : typeof import ( 'child_process' ) ;
31
31
let forkInterface : ReturnType < typeof childProcess . fork > ;
32
32
let originalExecArgv : typeof process . execArgv ;
33
+ let originalForceColor : string | undefined ;
33
34
34
35
const totalmem = jest . spyOn ( require ( 'os' ) as typeof import ( 'os' ) , 'totalmem' ) ;
35
36
@@ -42,6 +43,9 @@ class MockedForkInterface extends EventEmitter {
42
43
}
43
44
44
45
beforeEach ( ( ) => {
46
+ originalForceColor = process . env . FORCE_COLOR ;
47
+ delete process . env . FORCE_COLOR ;
48
+
45
49
originalExecArgv = process . execArgv ;
46
50
47
51
childProcess = require ( 'child_process' ) as typeof import ( 'child_process' ) ;
@@ -63,6 +67,7 @@ beforeEach(() => {
63
67
afterEach ( ( ) => {
64
68
jest . resetModules ( ) ;
65
69
process . execArgv = originalExecArgv ;
70
+ process . env . FORCE_COLOR = originalForceColor ;
66
71
} ) ;
67
72
68
73
it ( 'passes fork options down to child_process.fork, adding the defaults' , ( ) => {
@@ -84,7 +89,7 @@ it('passes fork options down to child_process.fork, adding the defaults', () =>
84
89
expect ( jest . mocked ( childProcess . fork ) . mock . calls [ 0 ] [ 0 ] ) . toBe ( child ) ;
85
90
expect ( jest . mocked ( childProcess . fork ) . mock . calls [ 0 ] [ 2 ] ) . toEqual ( {
86
91
cwd : '/tmp' , // Overridden default option.
87
- env : { ... process . env , FORCE_COLOR : supportsColor . stdout ? '1' : undefined } , // Default option.
92
+ env : process . env , // Default option.
88
93
execArgv : [ '-p' ] , // Filtered option.
89
94
execPath : 'hello' , // Added option.
90
95
serialization : 'advanced' , // Default option.
0 commit comments