E2E: add app-level node config dir to path.

This commit is contained in:
Jeff Stieler 2020-04-15 11:07:32 -06:00
parent e8efb82b9e
commit 622e47f29f
1 changed files with 13 additions and 5 deletions

View File

@ -11,16 +11,25 @@ program
.option( '--dev', 'Development mode' )
.parse( process.argv );
const appPath = getAppPath();
const nodeConfigDirs = [
path.resolve( __dirname, '../config' ),
];
if ( appPath ) {
nodeConfigDirs.unshift(
path.resolve( appPath, 'tests/e2e-tests/config' )
);
}
const testEnvVars = {
NODE_ENV: 'test:e2e',
JEST_PUPPETEER_CONFIG: path.resolve(
__dirname,
'../config/jest-puppeteer.config.js'
),
NODE_CONFIG_DIR: path.resolve(
__dirname,
'../config'
),
NODE_CONFIG_DIR: nodeConfigDirs.join( ':' ),
};
let jestCommand = 'jest';
@ -42,7 +51,6 @@ if ( program.dev ) {
const envVars = Object.assign( {}, process.env, testEnvVars );
const appPath = getAppPath();
let configPath = path.resolve( __dirname, '../config/jest.config.js' );
// Look for a Jest config in the dependent app's path.