-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Preferentially Execute Local
wp-env
(#50980)
Instead of always running the chosen version of `wp-env` we are going to try and find a local version in the current directory. This prevents the global `wp-env` from being used when a different local version is expected.
- Loading branch information
1 parent
b3ea2b6
commit 6a16313
Showing
4 changed files
with
29 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
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
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 |
---|---|---|
@@ -1,4 +1,20 @@ | ||
#!/usr/bin/env node | ||
'use strict'; | ||
const command = process.argv.slice( 2 ); | ||
require( '../lib/cli' )().parse( command.length ? command : [ '--help' ] ); | ||
|
||
// Remove 'node' and the name of the script from the arguments. | ||
let command = process.argv.slice( 2 ); | ||
// Default to help text when they aren't running any commands. | ||
if ( ! command.length ) { | ||
command = [ '--help' ]; | ||
} | ||
|
||
// Rather than just executing the current CLI we will attempt to find a local version | ||
// and execute that one instead. This prevents users from accidentally using the | ||
// global CLI when a potentially different local version is expected. | ||
const localPath = require.resolve( '@wordpress/env/lib/cli.js', { | ||
paths: [ process.cwd(), __dirname ], | ||
} ); | ||
const cli = require( localPath )(); | ||
|
||
// Now we can execute the CLI with the given command. | ||
cli.parse( command ); |
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
6a16313
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flaky tests detected in 6a16313.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.
🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5094989157
📝 Reported issues:
/test/e2e/specs/editor/blocks/navigation.spec.js
specs/editor/various/autosave.test.js