Make WordPress Core

Changeset 65309


Ignore:
Timestamp:
11/06/2026 02:10:40 PM (24 hours ago)
Author:
desrosj
Message:

Build/Test Tools: Remove script to run Gutenberg E2E tests in Core.

In r48382 a script was added to run the Gutenberg end-to-end tests in wordpress-develop. Besides a few small changes related to normal Gutenberg syncs, these files have not been touched since being introduced and the script no longer works:

  • The specified wp/trunk branch checked out from gutenberg no longer exists (it was renamed to wp/latest).
  • The test-e2e npm script no longer exists (it was renamed to test:e2e in ​https://github.com/WordPress/gutenberg/pull/42368).
  • packages/e2e-tests/specs
  • The FORCE_REDUCED_MOTION build flag it passed was removed in r56699.
  • It crashes on startup because the chalk dependency is now ESM-only.
  • It was never formally added to any Github Actions workflows.

Removing this script also allows the chalk and uuid dependencies to be removed. "And another one gone, and another one gone."

See #65845, #50469, #59407.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/package-lock.json

    r64740 r65309  
    5858                                "@wordpress/scripts": "33.0.0",
    5959                                "autoprefixer": "10.5.3",
    60                                 "chalk": "5.6.2",
    6160                                "cssnano": "7.1.9",
    6261                                "dotenv": "17.4.2",
    … …  
    9392                                "typescript": "6.0.3",
    9493                                "update-browserslist-db": "1.3.1",
    95                                 "uuid": "14.0.1",
    9694                                "wait-on": "9.0.10",
    9795                                "webpack": "5.108.4"
    … …  
    1040010398                        }
    1040110399                },
    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                 },
    1041510400                "node_modules/change-case": {
    1041610401                        "version": "4.1.2",
    … …  
    2863128616                        }
    2863228617                },
    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                 },
    2864728618                "node_modules/v8-to-istanbul": {
    2864828619                        "version": "9.1.0",
  • trunk/package.json

    r65225 r65309  
    5656                "@wordpress/scripts": "33.0.0",
    5757                "autoprefixer": "10.5.3",
    58                 "chalk": "5.6.2",
    5958                "cssnano": "7.1.9",
    6059                "dotenv": "17.4.2",
    … …  
    9190                "typescript": "6.0.3",
    9291                "update-browserslist-db": "1.3.1",
    93                 "uuid": "14.0.1",
    9492                "wait-on": "9.0.10",
    9593                "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 node
    2 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 // Config
    10 const GUTENBERG_VERSION = 'wp/trunk';
    11 
    12 // Utils
    13 /**
    14  * Utility to run a child script
    15  *
    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 file
    33  *
    34  * @param {string} fileName
    35  */
    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 constants
    51 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 // Welcome
    59 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 // Steps
    67 // 1- Preparing the WordPress environment
    68 console.log( '>> Preparing the WordPress clone' );
    69 runShellScript( 'npm install && FORCE_REDUCED_MOTION=true npm run build', rootFolder );
    70 
    71 // 2- Preparing the Gutenberg clone
    72 // The tests and the launcher comes from the Gutenberg repository e2e tests
    73 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-env
    79 // The environment should include the WordPress install and the e2e tests plugins.s
    80 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 environment
    92 console.log( title( '>> Starting the environment' ) );
    93 runShellScript( path.resolve( testLauncherPath, 'node_modules/.bin/wp-env' ) + ' start ', testEnvironmentPath );
    94 
    95 // 5- Running the tests
    96 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.