In my jest.config.js I have a globalSetup:

module.exports = {
  bail: 1,
  testMatch: ['**/test/frontend/integration/**/*.test.js'],
  globalSetup: './setup.js',
  globalTeardown: './teardown.js',
  testEnvironment: './sails_puppet_environment.js',
};

I am executing the command jest --config test/frontend/jest.config.js --watch.

This starts by running globalSetup. Then after the next change, it runs globalSetup again. Is it possible to make globalSetup run only once? And then globalTeardown when I'm done watching (with like keyboard input)?

I want globalSetup

0 Answers