Skip to content

Commit 7787691

Browse files
committed
Use FORCE_COLOR=0 for all tests
This change ensures that tests work regardless of the value of FORCE_COLOR environment variable. There are environments where this variable is set to 1 and the tests fail. For example the tests fail when they are run from Jetbrains IDEs.
1 parent 2278230 commit 7787691

File tree

5 files changed

+234
-46
lines changed

5 files changed

+234
-46
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
### Chore & Maintenance
88

99
- `[website]` Switch domain to https://jestjs.io ([#6549](https://github.com/facebook/jest/pull/6549))
10+
- `[tests]` Free tests from the dependency on value of FORCE_COLOR ([#TBD](https://github.com/facebook/jest/pull/TBD/files))
1011

1112
## 23.2.0
1213

e2e/runJest.js

+4-13
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,8 @@ function runJest(
4949
);
5050
}
5151

52-
const env = options.nodePath
53-
? Object.assign({}, process.env, {
54-
FORCE_COLOR: 0,
55-
NODE_PATH: options.nodePath,
56-
})
57-
: process.env;
58-
52+
const env = Object.assign({}, process.env, {FORCE_COLOR: 0});
53+
if (options.nodePath) env['NODE_PATH'] = options.nodePath;
5954
const result = spawnSync(JEST_PATH, args || [], {
6055
cwd: dir,
6156
env,
@@ -118,12 +113,8 @@ runJest.until = async function(
118113
);
119114
}
120115

121-
const env = options.nodePath
122-
? Object.assign({}, process.env, {
123-
FORCE_COLOR: 0,
124-
NODE_PATH: options.nodePath,
125-
})
126-
: process.env;
116+
const env = Object.assign({}, process.env, {FORCE_COLOR: 0});
117+
if (options.nodePath) env['NODE_PATH'] = options.nodePath;
127118

128119
const jestPromise = execa(JEST_PATH, args || [], {
129120
cwd: dir,

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
"flow-bin": "^0.75.0",
4040
"glob": "^7.1.1",
4141
"graceful-fs": "^4.1.11",
42-
"istanbul-api": "^1.3.1",
43-
"istanbul-lib-coverage": "^1.0.0",
42+
"istanbul-api": "^2.0.0",
43+
"istanbul-lib-coverage": "^2.0.0",
4444
"jasmine-reporters": "^2.2.0",
4545
"jest-junit": "^5.1.0",
4646
"jest-silent-reporter": "^0.0.5",

packages/jest-cli/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
"graceful-fs": "^4.1.11",
1212
"import-local": "^1.0.0",
1313
"is-ci": "^1.0.10",
14-
"istanbul-api": "^1.3.1",
15-
"istanbul-lib-coverage": "^1.2.0",
16-
"istanbul-lib-instrument": "^1.10.1",
17-
"istanbul-lib-source-maps": "^1.2.4",
14+
"istanbul-api": "^2.0.0",
15+
"istanbul-lib-coverage": "^2.0.0",
16+
"istanbul-lib-instrument": "^2.3.0",
17+
"istanbul-lib-source-maps": "^2.0.0",
1818
"jest-changed-files": "^23.2.0",
1919
"jest-config": "^23.2.0",
2020
"jest-environment-jsdom": "^23.2.0",

0 commit comments

Comments
 (0)