I want to run and complete tests using Jest with npm test
Actual behavior
Jest fails tests
Steps to reproduce
Run npm test
npm test
> blockchain-iot-core@0.1.0 test /home/spoon/WebstormProjects/blockchain-IoT-core
> node scripts/test.js --env=jsdom
Error: Unknown config option "testMatch" with value "<rootDir>/src/**/__tests__/**/*.js?(x),<rootDir>/src/**/?(*.)(spec|test).js?(x)". This is either a typing error or a user mistake and fixing it will remove this message.
PASS src/App.test.js
FAIL scripts/test.js
● Test suite failed to run
SyntaxError: Identifier 'jest' has already been declared
at Runtime._execModule (node_modules/jest-runtime/build/index.js:442:13)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:118:7)
Test Suites: 1 failed, 1 passed, 2 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 1.36s
Ran all test suites.
npm ERR! Test failed. See above for more details.
Looking at SyntaxError: Identifier 'jest' has already been declared we can tell that Jest tries to run scripts/test.js, treating it as test. This is because "testMatch" with value "<rootDir>/src/**/__tests__/**/*.js?(x),<rootDir>/src/**/?(*.)(spec|test).js?(x)" filter doesn't work in current Jest version (19.0.0+)
Expected behavior (user story)
I want to run and complete tests using Jest with
npm test
Actual behavior
Jest fails tests
Steps to reproduce
Run
npm test
Looking at
SyntaxError: Identifier 'jest' has already been declared
we can tell that Jest tries to run scripts/test.js, treating it as test. This is because"testMatch" with value "<rootDir>/src/**/__tests__/**/*.js?(x),<rootDir>/src/**/?(*.)(spec|test).js?(x)"
filter doesn't work in current Jest version (19.0.0+)Related: https://github.com/facebook/create-react-app/issues/1319 https://facebook.github.io/jest/docs/en/configuration.html#testmatch-array-string