Changeset 64259
- Timestamp:
- 10/09/2026 05:58:28 PM (4 weeks ago)
- Location:
- branches/6.3/tests/e2e
- Files:
-
- 2 added
- 1 edited
-
mu-plugins (added)
-
mu-plugins/disable-login-autofocus.php (added)
-
run-tests.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/6.3/tests/e2e/run-tests.js
r53113 r64259 1 1 const dotenv = require( 'dotenv' ); 2 const dotenv_expand = require( 'dotenv-expand' ); 3 const { execSync } = require( 'child_process' ); 2 const dotenvExpand = require( 'dotenv-expand' ); 3 const { spawn } = require( 'child_process' ); 4 const { copyFileSync, mkdirSync, rmSync } = require( 'fs' ); 5 const path = require( 'path' ); 4 6 5 // WP_BASE_URL interpolates LOCAL_PORT, so needs to be parsed by dotenv_expand(). 6 dotenv_expand.expand( dotenv.config() ); 7 // WP_BASE_URL interpolates LOCAL_PORT, so needs to be parsed by dotenvExpand(). 8 dotenvExpand.expand( dotenv.config() ); 9 10 // Keep the login screen's delayed autofocus from interrupting automated input. 11 const muPluginDirectory = path.join( 12 process.env.LOCAL_DIR || 'src', 13 'wp-content', 14 'mu-plugins' 15 ); 16 const muPluginFile = path.join( 17 muPluginDirectory, 18 `e2e-disable-login-autofocus-${ process.pid }.php` 19 ); 20 21 mkdirSync( muPluginDirectory, { recursive: true } ); 22 copyFileSync( 23 path.join( __dirname, 'mu-plugins', 'disable-login-autofocus.php' ), 24 muPluginFile 25 ); 26 27 // Remove only this run's fixture, including on failure or interruption. 28 process.once( 'exit', () => rmSync( muPluginFile, { force: true } ) ); 7 29 8 30 // Run the tests, passing additional arguments through to the test script. 9 execSync( 10 'wp-scripts test-e2e --config tests/e2e/jest.config.js ' + 11 process.argv.slice( 2 ).join( ' ' ), 12 { stdio: 'inherit' } 31 const tests = spawn( 32 process.execPath, 33 [ 34 require.resolve( '@wordpress/scripts/bin/wp-scripts.js' ), 35 'test-e2e', 36 '--config', 37 'tests/e2e/jest.config.js', 38 ...process.argv.slice( 2 ), 39 ], 40 { stdio: 'inherit', detached: process.platform !== 'win32' } 13 41 ); 42 43 for ( const signal of [ 'SIGHUP', 'SIGINT', 'SIGQUIT', 'SIGTERM' ] ) { 44 process.on( signal, () => { 45 // Stop the test process group before removing its fixture. 46 try { 47 if ( process.platform === 'win32' ) { 48 tests.kill( signal ); 49 } else { 50 process.kill( -tests.pid, signal ); 51 } 52 } catch ( error ) { 53 if ( error.code !== 'ESRCH' ) { 54 throw error; 55 } 56 } 57 } ); 58 } 59 60 tests.once( 'error', ( error ) => { 61 throw error; 62 } ); 63 tests.once( 'exit', ( code, signal ) => { 64 const signalExitCodes = { 65 SIGHUP: 129, 66 SIGINT: 130, 67 SIGQUIT: 131, 68 SIGTERM: 143, 69 }; 70 process.exitCode = code === null ? signalExitCodes[ signal ] || 1 : code; 71 } );
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)