Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jest has incorrect test search path #43

Closed
ghost opened this issue Mar 21, 2018 · 0 comments
Closed

Jest has incorrect test search path #43

ghost opened this issue Mar 21, 2018 · 0 comments

Comments

@ghost
Copy link

ghost commented Mar 21, 2018

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

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+)

Related:
facebook/create-react-app#1319
https://facebook.github.io/jest/docs/en/configuration.html#testmatch-array-string

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants