Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update/e2e tests options #14129

Merged
merged 9 commits into from
Mar 15, 2019
10 changes: 9 additions & 1 deletion packages/scripts/scripts/test-e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const jest = require( 'jest' );
*/
const {
fromConfigRoot,
getCliArg,
getCliArgs,
hasCliArg,
hasProjectFile,
Expand All @@ -42,4 +43,11 @@ const runInBand = ! hasRunInBand ?
[ '--runInBand' ] :
[];

jest.run( [ ...config, ...runInBand, ...getCliArgs() ] );
const cleanUpPrefixes = [ '--puppeteer-' ];

if ( hasCliArg( '--puppeteer-interactive' ) ) {
process.env.PUPPETEER_HEADLESS = 'false';
process.env.PUPPETEER_SLOWMO = getCliArg( '--puppeteer-slowmo' ) || 80;
}

jest.run( [ ...config, ...runInBand, ...getCliArgs( cleanUpPrefixes ) ] );
2 changes: 2 additions & 0 deletions packages/scripts/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const {
getCliArgs,
hasCliArg,
spawnScript,
cleanUpArgs,
} = require( './cli' );
const {
getWebpackArgs,
Expand Down Expand Up @@ -35,4 +36,5 @@ module.exports = {
hasPackageProp,
hasProjectFile,
spawnScript,
cleanUpArgs,
};
10 changes: 9 additions & 1 deletion packages/scripts/utils/process.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
const getCliArgs = () => process.argv.slice( 2 );
const getCliArgs = ( excludePrefixes ) => {
const args = process.argv.slice( 2 );
if ( excludePrefixes ) {
return args.filter( ( arg ) => {
return ! excludePrefixes.some( ( prefix ) => arg.startsWith( prefix ) );
} );
}
return args;
};

module.exports = {
exit: process.exit,
Expand Down