From bd90227a208bf4d851b869c789779e980cb5800f Mon Sep 17 00:00:00 2001 From: Gorgi Kosev Date: Wed, 22 Aug 2018 21:32:47 +0100 Subject: [PATCH] jest-worker test: add FORCE_COLOR env var --- packages/jest-worker/src/__tests__/Worker.test.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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.