Changeset 65309
- Timestamp:
- 11/06/2026 02:10:40 PM (24 hours ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
package-lock.json (modified) (4 diffs)
-
package.json (modified) (2 diffs)
-
tests/gutenberg/.wp-env.sample.json (modified) (1 diff)
-
tests/gutenberg/run.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/package-lock.json
r64740 r65309 58 58 "@wordpress/scripts": "33.0.0", 59 59 "autoprefixer": "10.5.3", 60 "chalk": "5.6.2",61 60 "cssnano": "7.1.9", 62 61 "dotenv": "17.4.2", … … 93 92 "typescript": "6.0.3", 94 93 "update-browserslist-db": "1.3.1", 95 "uuid": "14.0.1",96 94 "wait-on": "9.0.10", 97 95 "webpack": "5.108.4" … … 10400 10398 } 10401 10399 }, 10402 "node_modules/chalk": {10403 "version": "5.6.2",10404 "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz",10405 "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==",10406 "dev": true,10407 "license": "MIT",10408 "engines": {10409 "node": "^12.17.0 || ^14.13 || >=16.0.0"10410 },10411 "funding": {10412 "url": "https://github.com/chalk/chalk?sponsor=1"10413 }10414 },10415 10400 "node_modules/change-case": { 10416 10401 "version": "4.1.2", … … 28631 28616 } 28632 28617 }, 28633 "node_modules/uuid": {28634 "version": "14.0.1",28635 "resolved": "https://registry.npmjs.org/uuid/-/uuid-14.0.1.tgz",28636 "integrity": "sha512-6ZxzVpzDXDa3bJWaHilVayA+BH/1zmxCJoVgvmqJnid/gPoKHxUrS/aC/T6LGQtNHT+XHG9fXPJB4d+IrU30Ew==",28637 "dev": true,28638 "funding": [28639 "https://github.com/sponsors/broofa",28640 "https://github.com/sponsors/ctavan"28641 ],28642 "license": "MIT",28643 "bin": {28644 "uuid": "dist-node/bin/uuid"28645 }28646 },28647 28618 "node_modules/v8-to-istanbul": { 28648 28619 "version": "9.1.0", -
trunk/package.json
r65225 r65309 56 56 "@wordpress/scripts": "33.0.0", 57 57 "autoprefixer": "10.5.3", 58 "chalk": "5.6.2",59 58 "cssnano": "7.1.9", 60 59 "dotenv": "17.4.2", … … 91 90 "typescript": "6.0.3", 92 91 "update-browserslist-db": "1.3.1", 93 "uuid": "14.0.1",94 92 "wait-on": "9.0.10", 95 93 "webpack": "5.108.4" -
trunk/tests/gutenberg/.wp-env.sample.json
r48845 r65309 1 {2 "core": "{WP_PATH}",3 "mappings": {4 "wp-content/mu-plugins": "{MU_PlUGINS_PATH}",5 "wp-content/plugins/test-plugins": "{TEST_PlUGINS_PATH}"6 },7 "config": {8 "SCRIPT_DEBUG": false,9 "WP_PHP_BINARY": "php",10 "WP_TESTS_EMAIL": "admin@example.org",11 "WP_TESTS_TITLE": "Test Blog"12 }13 } -
trunk/tests/gutenberg/run.js
r51052 r65309 1 #!/usr/bin/env node2 const path = require( 'path' );3 const { v4: uuid } = require( 'uuid' );4 const os = require( 'os' );5 const fs = require( 'fs' );6 const chalk = require( 'chalk' );7 const childProcess = require( 'child_process' );8 9 // Config10 const GUTENBERG_VERSION = 'wp/trunk';11 12 // Utils13 /**14 * Utility to run a child script15 *16 * @param {string} script Script to run.17 * @param {string=} cwd Working directory.18 */19 function runShellScript( script, cwd ) {20 childProcess.execSync( script, {21 cwd,22 env: {23 NO_CHECKS: 'true',24 PATH: process.env.PATH,25 HOME: process.env.HOME,26 },27 stdio: [ 'inherit', 'ignore', 'inherit' ],28 } );29 }30 31 /**32 * Small utility used to read an uncached version of a JSON file33 *34 * @param {string} fileName35 */36 function readJSONFile( fileName ) {37 const data = fs.readFileSync( fileName, 'utf8' );38 return JSON.parse( data );39 }40 41 /**42 * Generates a random temporary path in the OS's tmp dir.43 *44 * @return {string} Temporary Path.45 */46 function getRandomTemporaryPath() {47 return path.join( os.tmpdir(), uuid() );48 }49 50 // Useful constants51 const title = chalk.bold;52 const success = chalk.bold.green;53 const rootFolder = path.resolve( __dirname, '../../' );54 const testLauncherPath = getRandomTemporaryPath();55 const testEnvironmentPath = getRandomTemporaryPath();56 const sampleEnvConfig = path.resolve( __dirname, '.wp-env.sample.json' );57 58 // Welcome59 console.log( title( '>> 🏁 Welcome, this command is going to prepare a running WordPress environment and run the Gutenberg e2e tests against it.' ) );60 console.log( title( '>> It uses the current WordPress folder from which it\'s being run and a separate Gutenberg clone performed by the command.' ) );61 console.log( title( '>> Configuration: ' ) );62 console.log( 'Gutenberg Version: ' + success( GUTENBERG_VERSION ) );63 console.log( 'Test Launcher Path (Gutenberg): ' + success( testLauncherPath ) );64 console.log( 'Test Environment Path (wp-env): ' + success( testEnvironmentPath ) );65 66 // Steps67 // 1- Preparing the WordPress environment68 console.log( '>> Preparing the WordPress clone' );69 runShellScript( 'npm install && FORCE_REDUCED_MOTION=true npm run build', rootFolder );70 71 // 2- Preparing the Gutenberg clone72 // The tests and the launcher comes from the Gutenberg repository e2e tests73 console.log( title( '>> Preparing the e2e tests launcher' ) );74 runShellScript( 'git clone https://github.com/WordPress/gutenberg.git ' + testLauncherPath + ' --depth=1 --no-single-branch' );75 runShellScript( 'git checkout ' + GUTENBERG_VERSION, testLauncherPath );76 runShellScript( 'npm install && npm run build', testLauncherPath );77 78 // 3- Running the WordPress environment using wp-env79 // The environment should include the WordPress install and the e2e tests plugins.s80 console.log( title( '>> Preparing the environment' ) );81 runShellScript( 'mkdir -p ' + testEnvironmentPath );82 const envConfig = readJSONFile( sampleEnvConfig );83 envConfig.core = path.resolve( rootFolder, 'build' );84 envConfig.mappings[ 'wp-content/mu-plugins' ] = path.resolve( testLauncherPath, 'packages/e2e-tests/mu-plugins' );85 envConfig.mappings[ 'wp-content/plugins/test-plugins' ] = path.resolve( testLauncherPath, 'packages/e2e-tests/plugins' );86 fs.writeFileSync(87 path.resolve( testEnvironmentPath, '.wp-env.json' ),88 JSON.stringify( envConfig, null, '\t' ) + '\n'89 );90 91 // 4- Starting the environment92 console.log( title( '>> Starting the environment' ) );93 runShellScript( path.resolve( testLauncherPath, 'node_modules/.bin/wp-env' ) + ' start ', testEnvironmentPath );94 95 // 5- Running the tests96 console.log( title( '>> Running the e2e tests' ) );97 runShellScript( 'npm run test-e2e packages/e2e-tests/specs/editor', testLauncherPath );
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)