diff --git a/packages/jest-worker/src/__tests__/Worker.test.js b/packages/jest-worker/src/__tests__/Worker.test.js index cad8347df5b9..f7ae6d2534f1 100644 --- a/packages/jest-worker/src/__tests__/Worker.test.js +++ b/packages/jest-worker/src/__tests__/Worker.test.js @@ -10,6 +10,7 @@ /* eslint-disable no-new */ import EventEmitter from 'events'; +import supportsColor from 'supports-color'; import { CHILD_MESSAGE_CALL, @@ -64,7 +65,9 @@ it('passes fork options down to child_process.fork, adding the defaults', () => expect(childProcess.fork.mock.calls[0][0]).toBe(child); expect(childProcess.fork.mock.calls[0][1]).toEqual({ cwd: '/tmp', // Overridden default option. - env: process.env, // Default option. + env: Object.assign({}, process.env, { + FORCE_COLOR: (supportsColor.stdout && '1') || undefined, + }), // Default option. execArgv: ['-p'], // Filtered option. execPath: 'hello', // Added option. silent: true, // Default option.