samedi 30 décembre 2017

Jest with special tests run on occasion

How do I write Jest tests that only runs when specifically invoked on the command line?

I want to have integration-like tests that interact with online services from Google and Amazon in a React project.


If I create a differently named test file src/google.itest.js:

  • Good: It is not normally run by jest
  • Good: It resides where all other tests are
  • Bad: jest cannot be made to run it:

jest --testPathPattern="\.itest"
Jest still does not run the tests, probably because it is blocked by the testMatch configuration option: testMatch:

**/__tests__/**/*.js?(x),**/?(*.)(spec|test).js?(x)

How do I write Jest tests that only runs when specifically invoked on the command line?

Aucun commentaire:

Enregistrer un commentaire