woocommerce/tests/e2e/env/config/jest.config.js

45 lines
1.2 KiB
JavaScript
Raw Normal View History

/**
* External Dependencies
*/
2020-07-28 19:23:32 +00:00
const { jestConfig } = require( '@automattic/puppeteer-utils' );
const path = require( 'path' );
const fs = require( 'fs' );
/**
* Internal Dependencies
*/
const { getAppRoot } = require( '../utils' );
let setupFilesAfterEnv = [
path.resolve( __dirname, '../build/setup/jest.setup.js' ),
'expect-puppeteer',
];
const appPath = getAppRoot();
const localJestSetupFile = path.resolve( appPath, 'tests/e2e/config/jest.setup.js' );
if (fs.existsSync( localJestSetupFile ) ) {
setupFilesAfterEnv.push( localJestSetupFile );
}
2020-07-28 19:23:32 +00:00
module.exports = {
...jestConfig,
moduleNameMapper: {
'@woocommerce/e2e-tests/(.*)':
'<rootDir>/tests/e2e/$1',
},
setupFiles: [ '<rootDir>/config/env.setup.js' ],
// A list of paths to modules that run some code to configure or set up the testing framework
// before each test
setupFilesAfterEnv,
// Sort test path alphabetically. This is needed so that `activate-and-setup` tests run first
testSequencer: '<rootDir>/config/jest-custom-sequencer.js',
2020-05-05 16:56:00 +00:00
// Set the test timeout in milliseconds.
testTimeout: parseInt( global.process.env.jest_test_timeout ),
2020-07-28 19:23:32 +00:00
transformIgnorePatterns: [
...jestConfig.transformIgnorePatterns,
'node_modules/(?!(woocommerce)/)'
],
};