Skip to content

Commit ed8c807

Browse files
committed
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 WordPress/gutenberg#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. git-svn-id: https://develop.svn.wordpress.org/trunk@65309 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 3fe7aba commit ed8c807

4 files changed

Lines changed: 0 additions & 141 deletions

File tree

‎package-lock.json‎

Lines changed: 0 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
"@wordpress/prettier-config": "4.51.0",
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",
6160
"dotenv-expand": "13.0.0",
@@ -90,7 +89,6 @@
9089
"source-map-loader": "5.0.0",
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"
9694
},
Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +0,0 @@
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-
}

‎tests/gutenberg/run.js‎

Lines changed: 0 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,97 +0,0 @@
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 );

0 commit comments

Comments
 (0)