lundi 4 juin 2018

Jest changed test directory resulting beforeAll is not defined

I used to put all my tests together inside of __test__ directory. But I decided to put each test files into each component's directory with different name convention.

Old Structure:

src/
 __test__/
  example.test.js
  example2.test.js

New Structure:

src/
 components/
  example/
   example-controller.js
   example-model.js
   example-route.js
   example-test.js

As naming and location of a directory changed, I updated all import statement and namings for according files. I was using default feature of Jest but since I changed test file name to example-test from example.test I also updated package.json

"jest": {
          "testRegex": "./src/components/*/.*.-test.js$"
 },

Problem is when I run the project, npm run it throws

beforeAll((0, _asyncToGenerator3.default)( /#PURE/_regenerator2.default.mark(function _callee() {

ReferenceError: beforeAll is not defined

any idea why it is happening?

Aucun commentaire:

Enregistrer un commentaire