allow running named test files that don't match test spec pattern
This commit is contained in:
parent
8910357437
commit
5139c73029
|
@ -40,6 +40,18 @@ if ( ! JEST_PUPPETEER_CONFIG ) {
|
|||
testEnvVars.JEST_PUPPETEER_CONFIG = fs.existsSync( localJestConfigFile ) ? localJestConfigFile : jestConfigFile;
|
||||
}
|
||||
|
||||
// Check for running a specific script
|
||||
if ( program.args.length == 1 ) {
|
||||
// Check for both absolute and relative paths
|
||||
const testSpecAbs = path.resolve( program.args[0] )
|
||||
const testSpecRel = path.resolve( appPath, program.args[0] );
|
||||
if ( fs.existsSync( testSpecAbs ) ) {
|
||||
process.env.jest_test_spec = testSpecAbs;
|
||||
} else if ( fs.existsSync( testSpecRel ) ) {
|
||||
process.env.jest_test_spec = testSpecRel;
|
||||
}
|
||||
}
|
||||
|
||||
let jestCommand = 'jest';
|
||||
const jestArgs = [
|
||||
'--maxWorkers=1',
|
||||
|
|
|
@ -20,7 +20,8 @@ const localJestSetupFile = path.resolve( appPath, 'tests/e2e/config/jest.setup.j
|
|||
if (fs.existsSync( localJestSetupFile ) ) {
|
||||
setupFilesAfterEnv.push( localJestSetupFile );
|
||||
}
|
||||
module.exports = {
|
||||
|
||||
let combinedConfig = {
|
||||
...jestConfig,
|
||||
moduleNameMapper: {
|
||||
'@woocommerce/e2e-tests/(.*)':
|
||||
|
@ -42,3 +43,11 @@ module.exports = {
|
|||
'node_modules/(?!(woocommerce)/)'
|
||||
],
|
||||
};
|
||||
|
||||
if ( process.env.jest_test_spec ) {
|
||||
combinedConfig.testMatch = [
|
||||
process.env.jest_test_spec
|
||||
];
|
||||
}
|
||||
|
||||
module.exports = combinedConfig;
|
||||
|
|
Loading…
Reference in New Issue