Gesture No Tests

launch docker mhart / alpine-node: 8 on macOS with

nodejs (6.10.3-r0) (18/18) yarn 0.24.6 joke 20.0.4

I have a __tests __ / index.test.js file, however, when I run the code

node_modules/.bin/jest --watchAll I get the output below

No tests found
. / Usr / src / app
5 files checked.
testMatch: / __ tests __ / /*.js?(x)**/?(*.)(spec|test).js?(x) - 1 match
testPathIgnorePatterns: / node_modules /, / src, src - 0 matches
Pattern: "" - 0 coincidences

I reinstalled the package numbers once, but to no avail.

+17
source share
6 answers

, testMatch 1 match, __tests__/index.test.js. , testPathIgnorePatterns . No tests found In /usr/src/app , Jest /usr/src/app, testPathIgnorePatterns: /node_modules/,/src,src , Jest /src.

Jest __tests__/index.test.js, /src, testPathIgnorePatterns /src.

+10

tests, jest __tests__ --watch

+3

jest - . , , , *.test.js *.spec.js.

+2

,

myFoldermyFile1.jsmyFile2.js
│   ...
└───__tests__
        myFile1.spec.js
        myFile2.spec.js
        ...

jest.config.js testMatch:

testMatch: ['**/__tests__/*.js?(x)'],

jest.config.js:

const jestConfig = {
  verbose: true,
  testURL: "http://localhost/",
  'transform': {
    '^.+\\.jsx?$': 'babel-jest',
  },
  testMatch: ['**/__tests__/*.js?(x)'],
}

module.exports = jestConfig
+2

. , .

+1

package.json , . .

, *.test.js testMatch

"testMatch": [
      "<rootDir>/src/**/*.(test).{js,jsx,ts,tsx}",
      "<rootDir>/src/**/?(*.)(spec|test).{js,jsx,ts,tsx}"
    ],
+1

Source: https://habr.com/ru/post/1680041/


All Articles