Jest preset for integration-testing
@tramvai/cli
andpuppeteer
should be installed separately
npm i --save-dev @tramvai/test-integration-jest
Using this jest preset you can run integration tests in watch mode. In this case, application itself will be launched only once and will work in background.
-
Add preset
@tramvai/test-integration-jest
tojest.integration.config.js
:module.exports = { preset: '@tramvai/test-integration-jest', };
-
Add new script for running tests in watch mode to
package.json
:{ "scripts": { "test:integration": "jest -w=3 --config ./jest.integration.config.js", "test:integration:watch": "jest --runInBand --watch --config ./jest.integration.config.js" } }
-
Run some test with
yarn test:integration:watch <path_to_test>
. In this case you are able to go to local urlhttp://localhost:3000
and see application at work.
Minimal set of dependencies for running jest
:
npm i --save-dev jest @types/jest jest-circus