Closed sketchbuch closed 6 years ago
Try adding jest.useFakeTimers();
above your it
blocks.
https://github.com/facebook/jest/issues/2979
src/App.test.js
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
jest.useFakeTimers(); // Add
it('renders without crashing', () => {
const div = document.createElement('div');
ReactDOM.render(<App />, div);
});
If it seems to work, change the global settings as such.
sadly no, it didn't fix the problem. It isn't that the test are failing. They don't even start.
Some more about my setup: Node 9.2.0 Ubuntu 17.10
And the console output:
Determining test suites to run...Error: This promise must be present when running with -o.
at /path/to/app/node_modules/jest/node_modules/jest-cli/build/search_source.js:202:17
at Generator.next (<anonymous>)
at step (/path/to/app/node_modules/jest/node_modules/jest-cli/build/search_source.js:19:362)
at /path/to/app/node_modules/jest/node_modules/jest-cli/build/search_source.js:19:592
at new Promise (<anonymous>)
at /path/to/app/node_modules/jest/node_modules/jest-cli/build/search_source.js:19:273
at SearchSource.getTestPaths (/path/to/app/node_modules/jest/node_modules/jest-cli/build/search_source.js:216:10)
at /path/to/app/node_modules/jest/node_modules/jest-cli/build/run_jest.js:44:29
at Generator.next (<anonymous>)
at step (/path/to/app/node_modules/jest/node_modules/jest-cli/build/run_jest.js:23:380)
I also tried using the latest LTS node (8.9.2) with the same result
fixed it. nw-react-scripts@1.0.4
https://github.com/orta/vscode-jest/issues/142
https://github.com/facebook/jest/issues/4419
package.json
{
"dependencies": {
- "nw-react-scripts": "^1.0.3",
+ "nw-react-scripts": "^1.0.4",
}
}
run update.
npm update
thanks.
This may have something to do with it too:
Yes, your fix to the version does it! Thanks very much ;)
I have just installed create-nw-react-app and created a new project. I haven't changed or added anything but have errors with running the test task, the output is:
Determining test suites to run...Error: This promise must be present when running with -o. at /.../my-app/node_modules/jest/node_modules/jest-cli/build/search_source.js:202:17 at Generator.next ()
at step (/.../my-app/node_modules/jest/node_modules/jest-cli/build/search_source.js:19:362)
at /.../my-app/node_modules/jest/node_modules/jest-cli/build/search_source.js:19:592
at new Promise ()
at /.../my-app/node_modules/jest/node_modules/jest-cli/build/search_source.js:19:273
at SearchSource.getTestPaths (/.../my-app/node_modules/jest/node_modules/jest-cli/build/search_source.js:216:10)
at /.../my-app/node_modules/jest/node_modules/jest-cli/build/run_jest.js:44:29
at Generator.next ()
at step (/.../my-app/node_modules/jest/node_modules/jest-cli/build/run_jest.js:23:380)
I'm using linux in case it matters. start task works fine