Closed
Description
🐛 Bug Report
When Jest performs its initial test run in VS Code on Windows, a large number of snapshot tests fail because the Received snapshot is missing color tags (ex: <red>
)
To Reproduce
- In Windows 10, follow the steps in the Contributing Guide
- Open Jest in VS Code (v1.29.1)
- Switch to the Output window to view test results as the run progresses.
Actual behavior
A large number of snapshot tests FAIL. From a cursory glance, the cause of the failure is the lack of color tags in the Received snapshots. For example:
FAIL packages/jest-config/src/__tests__/normalize.test.js (10.679s)
● rootDir › throws if the options is missing a rootDir property
expect(value).toMatchSnapshot()
Received value does not match stored snapshot "rootDir throws if the options is missing a rootDir property 1".
- Snapshot
+ Received
- "<red><bold><bold>● <bold>Validation Error</>:</>
- <red></>
- <red> Configuration option <bold>rootDir</> must be specified.</>
- <red></>
- <red> <bold>Configuration Documentation:</></>
- <red> https://jestjs.io/docs/configuration.html</>
- <red></>"
+ "● Validation Error:
+
+ Configuration option rootDir must be specified.
+
+ Configuration Documentation:
+ https://jestjs.io/docs/configuration.html
+ "
at Object.toThrowErrorMatchingSnapshot (packages/jest-config/src/__tests__/normalize.test.js:96:8)
Expected behavior
Snapshot tests are expected to PASS.
Link to repl or repo (highly encouraged)
Run npx envinfo --preset jest
Paste the results here:
System:
OS: Windows 10
CPU: x64 Intel(R) Core(TM) i7-5500U CPU @ 2.40GHz
Binaries:
Yarn: 1.12.3 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
Notes
Note: I think the lack of color tags in the Received snapshots is not surprising given that the command used to run the tests is shown to include the --no-color
switch:
$ node ./packages/jest-cli/bin/jest.js --json --useStderr --outputFile C:\Users\urig\AppData\Local\Temp/jest_runner.json --no-color
The question is - Why does the command include this switch?
Activity