Add development watch mode to puppeteer jest tests

This commit is contained in:
Rene
2021-01-08 21:50:14 +01:00
parent 67c412bc55
commit 6810865045
17 changed files with 613 additions and 52 deletions
+22 -10
View File
@@ -4,6 +4,8 @@ const puppeteerRollupConfig = require('./config/jest-puppeteer.rollup.config.js'
const testEnvironmentPath = path.resolve(__dirname, './config/jest-puppeteer.env.js');
const testServerLoaderPath = path.resolve(__dirname, './config/jest-test-server.loader.js');
const jsdomSetupFile = path.resolve(__dirname, './config/jest-jsdom.setup.js');
const puppeteerSetupFile = path.resolve(__dirname, './config/jest-puppeteer.setup.js');
// For a detailed explanation regarding each configuration property, visit:
// https://jestjs.io/docs/en/configuration.html
@@ -20,26 +22,36 @@ const base = {
},
};
const pptrBase = {
...base,
preset: 'jest-puppeteer',
setupFilesAfterEnv: ['expect-puppeteer', puppeteerSetupFile],
testMatch: ['**/tests/puppeteer/**/*.test.[jt]s?(x)'],
testEnvironment: testEnvironmentPath,
coveragePathIgnorePatterns: ['/node_modules/', `/${puppeteerRollupConfig.build}/`],
transform: {
'^.+\\.[jt]sx?$': 'babel-jest',
[`^.+${puppeteerRollupConfig.build}.+${puppeteerRollupConfig.html.output}?$`]: testServerLoaderPath,
},
};
module.exports = {
...base,
projects: [
{
...base,
displayName: 'jsdom',
setupFilesAfterEnv: [jsdomSetupFile],
testMatch: ['**/tests/jsdom/**/*.test.[jt]s?(x)'],
},
{
...base,
preset: 'jest-puppeteer',
...pptrBase,
displayName: 'puppeteer',
setupFilesAfterEnv: ['expect-puppeteer'],
testMatch: ['**/tests/puppeteer/**/*.test.[jt]s?(x)'],
testEnvironment: testEnvironmentPath,
coveragePathIgnorePatterns: ['/node_modules/', `/${puppeteerRollupConfig.build}/`],
transform: {
'^.+\\.[jt]sx?$': 'babel-jest',
[`^.+${puppeteerRollupConfig.build}.+${puppeteerRollupConfig.html.output}?$`]: testServerLoaderPath,
},
},
{
...pptrBase,
displayName: 'puppeteer-dev',
collectCoverage: false,
},
],
};