Jest ignoring package.json specifications

Asked

Viewed 38 times

1

I am implementing tests in my web application in React with jest. As it was started with the "create-React-app" it was easy to set up the environment. But for some reason jest seems to ignore package.json specifications...

{
  "jest": {
    "collectCoverageFrom":[
      "src/**/*.{js,sx}",
      "!src/index.js",
      "!src/BooksAPI.js"
    ],
    "snapshotSerializers": ["enzyme-to-json/serializer"]
  }
...
}

Although I added to the collectCoverageFrom to ignore the index and booksapi files they persist when I run tests with the --Coverage flag active. Also, although I specifically state that I want to use the serializer of the 'Enzyme-to-json' package, the snapshot remains the default for jest. inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

Does anyone know what I could possibly be doing wrong? I’ve checked the typing carefully and I think it’s correct. Follow the project link if necessary: https://github.com/Matheusbafutto/reactnd-project-myreads-starter

  • You may also have collectCoverage: true. You already tested that configuration?

  • I tried it but it didn’t solve it...

1 answer

0


It seems that it was a problem in React-scripts itself. The error occurred when using version 0.9.x of React-scripts. When updating to version 1.0.13 the problem is gone.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.