-
Notifications
You must be signed in to change notification settings - Fork 381
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3c2acd7
commit 013bae1
Showing
3 changed files
with
153 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* Wrapper for the command `wp-scripts test:e2e`. | ||
* | ||
* This allows for a greater flexibility on what specs and tests can be run based on a given environment. | ||
*/ | ||
|
||
const path = require( 'path' ); | ||
const { spawn } = require( 'child_process' ); | ||
const semver = require( 'semver' ); | ||
const { spawnScript } = require( '@wordpress/scripts/utils' ); | ||
|
||
const composeFile = path.resolve( process.cwd(), 'bin', 'local-env', 'docker-compose.yml' ); | ||
|
||
// Retrieve the current WordPress version using the Docker CLI container. | ||
const prc = spawn( 'docker-compose', [ '-f', composeFile, 'exec', '-T', '-u', 'xfs', 'cli', 'wp', 'core', 'version' ] ); | ||
|
||
prc.stdout.setEncoding( 'utf8' ); | ||
|
||
prc.stdout.on( 'data', ( data ) => { | ||
const wpVersion = data.toString().trim(); | ||
|
||
// The first 2 args are not needed - 'node', and the script name. | ||
const suppliedArgs = process.argv.slice( 2 ); | ||
|
||
const testsToIgnore = []; | ||
|
||
if ( semver.gte( '5.3.0', semver.coerce( wpVersion ) ) ) { | ||
// Ignore tests that are not to be run in WP >= 5.3.0. | ||
testsToIgnore.push( 'AMP Settings Screen should not allow AMP Stories to be enabled when Gutenberg is not active' ); | ||
} | ||
|
||
const testNamePatterns = testsToIgnore.map( ( testName ) => { | ||
return `--testNamePattern='^(?!${ testName }).*$'`; | ||
} ); | ||
|
||
const cmdArgs = [ ...suppliedArgs, ...testNamePatterns ]; | ||
|
||
// Run E2E tests. | ||
spawnScript( 'test-e2e', cmdArgs ); | ||
} ); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters