node -v: 8.9.1npm -v: 5.5.1npm ls react-scripts (if you haven’t ejected): Custom project
Operating system: Zorinos (ubuntu based)
Make a test with DOM as requirement. for example
import createHistory from 'history/createBrowserHistory';
const history = createHistory();
Should be posibility add custom arguments to this runner.
I have custom already added in my package.json scripts like
"scripts": {
"test": "cross-env NODE_ENV=test jest --env=jsdom --watch",
"test:ci": "cross-env NODE_ENV=test jest --env=jsdom --no-cache --maxWorkers=2 --ci"
}
Getting error in OUTPUT:
FAIL src/components/tests/App.test.js
● Test suite failed to run
Invariant Violation: Browser history needs a DOM
43 | });
44 |
> 45 | const history = createHistory();
46 |
47 | const reducers = {
48 | productReducer,
at invariant (node_modules/invariant/invariant.js:42:15)
at createBrowserHistory (node_modules/history/createBrowserHistory.js:49:27)
at Object.<anonymous> (src/components/App.js:45:52)
at Object.<anonymous> (src/components/tests/App.test.js:9:12)
In VSCode I tried those settings
"jest.pathToJest": "npx jest --env=jsdom""jest.pathToJest": "yarn test""jest.pathToJest": "yarn test --env=jsdom""jest.pathToJest": "npm test -- --env=jsdom""jest.pathToJest": "yarn test:ci""jest.pathToJest": "node_modules/.bin/jest --env=jsdom"If I run in terminal any of thous commands all tests are passing
Based on how much troubleshooting you've done so far it seems like you're pretty motivated to figure this one out. I'd suggest you try to debug the extension to see why it's not using jest.pathToJest. If you set up the repo following the these instructions from the README (skip the part about jest-editor-support), then you can start Debugging using the "Launch Extension" configuration. A breakpoint in pathToJest may help determine what's happening.
Thanks, after restart it's worked. :congratulations:
Glad you got it sorted. There's an open issue to re-initialize things when the settings change that'll help. Sorry for forgetting about #231.
Most helpful comment
Glad you got it sorted. There's an open issue to re-initialize things when the settings change that'll help. Sorry for forgetting about #231.