Problem with a cache and the testEnvironment variable.
See original GitHub issue🐛 Bug Report
When I execute tests I got:
FAIL src/test/javascript/app/actions.spec.js
● Test suite failed to run
ENOENT: no such file or directory, mkdir '/tmp/jest_rs/jest-transform-cache-951c940de58b523ede4c7a74cd57e1d8-afca7609b727bae58e6d966e4f38887d/2e'
at createDirectory (node_modules/jest-runtime/node_modules/jest-util/build/createDirectory.js:68:10)
No matter what I do(clear cache, run with --no-cache) then the result is the same. But when I create this directory by
mkdir -p /tmp/jest_rs/jest-transform-cache-951c940de58b523ede4c7a74cd57e1d8-afca7609b727bae58e6d966e4f38887d/2e
then an exception is different:
FAIL src/test/javascript/app/modeler/actions.spec.js
● Test suite failed to run
The error below may be caused by using the wrong test environment, see https://jestjs.io/docs/en/configuration#testenvironment-string.
Consider using the "jsdom" test environment.
ReferenceError: window is not defined
1 | import React from 'react';
2 |
> 3 | window.React = React;
This is from mt setupTests.js that I have in the setupFilesAfterEnv. testEnvironment is set to jsdom. When I check that by --show-config I have:
"testEnvironment": "/node_modules/jest-environment-jsdom/build/index.js",
envinfo
System:
OS: Linux 4.15 Ubuntu 18.04.1 LTS (Bionic Beaver)
CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Binaries:
Node: 10.10.0 - /usr/bin/node
Yarn: 1.10.1 - ~/projects/bpm-micro/gateway/node_modules/.bin/yarn
npm: 5.1.0 - ~/projects/bpm-micro/gateway/node_modules/.bin/npm
npmPackages:
jest: ^26.0.1 => 26.1.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:7
- Comments:11
Top Results From Across the Web
Laravel 5.8 .env.testing file is not working
The testing environment variables can be configured in the phpunit.xml file, but make sure to clear your configuration cache using the config: ...
Read more >Testing and Environment Variables
Another common way to test environment variables is by overriding them ... we must always cache and reassign state every time we modify...
Read more >Solving common problems
When using a shared cache, these problems even cross machine boundaries. ... Gradle does not track changes in environment variables for tasks.
Read more >Creating and editing an environment cache | Apigee Edge
You can create multiple cache resources in each environment. When you're configuring a caching policy, you specify whether the policy should use the...
Read more >Configuring Vitest
For example, define to define global variables, or resolve.alias to ... This might be helpful, if a dependency has the wrong ESM file....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Same problem but on Windows 10. I have node version 10.10.0
EDIT: Fixed it by using jest v25.1.0
same here on mac, downgrading jest-util to ^25.0.0 works for me