Skip to content

Commit 0b54555

Browse files
authored
[DevTools] Modify DevTools e2e test script for regression tests (#24642)
Modified the `run_devtools_e2e_tests` script so that you can pass in a React version. If you pass in a version, it will build the DevTools shell and run the e2e tests with that version.
1 parent f534cc6 commit 0b54555

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

scripts/circleci/run_devtools_e2e_tests.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const {spawn} = require('child_process');
66
const {join} = require('path');
77

88
const ROOT_PATH = join(__dirname, '..', '..');
9-
9+
const reactVersion = process.argv[2];
1010
const inlinePackagePath = join(ROOT_PATH, 'packages', 'react-devtools-inline');
1111
const shellPackagePath = join(ROOT_PATH, 'packages', 'react-devtools-shell');
1212

@@ -74,7 +74,15 @@ function runTestShell() {
7474

7575
logBright('Starting testing shell server');
7676

77-
serverProcess = spawn('yarn', ['start'], {cwd: shellPackagePath});
77+
if (!reactVersion) {
78+
serverProcess = spawn('yarn', ['start'], {cwd: shellPackagePath});
79+
} else {
80+
serverProcess = spawn('yarn', ['start'], {
81+
cwd: shellPackagePath,
82+
env: {...process.env, REACT_VERSION: reactVersion},
83+
});
84+
}
85+
7886
serverProcess.stdout.on('data', data => {
7987
if (`${data}`.includes('Compiled successfully.')) {
8088
logBright('Testing shell server running');
@@ -106,8 +114,15 @@ function runTestShell() {
106114

107115
async function runEndToEndTests() {
108116
logBright('Running e2e tests');
117+
if (!reactVersion) {
118+
testProcess = spawn('yarn', ['test:e2e'], {cwd: inlinePackagePath});
119+
} else {
120+
testProcess = spawn('yarn', ['test:e2e'], {
121+
cwd: inlinePackagePath,
122+
env: {...process.env, REACT_VERSION: reactVersion},
123+
});
124+
}
109125

110-
testProcess = spawn('yarn', ['test:e2e'], {cwd: inlinePackagePath});
111126
testProcess.stdout.on('data', data => {
112127
// Log without formatting because Playwright applies its own formatting.
113128
const formatted = format(data);

0 commit comments

Comments
 (0)