@@ -6,7 +6,7 @@ const {spawn} = require('child_process');
66const { join} = require ( 'path' ) ;
77
88const ROOT_PATH = join ( __dirname , '..' , '..' ) ;
9-
9+ const reactVersion = process . argv [ 2 ] ;
1010const inlinePackagePath = join ( ROOT_PATH , 'packages' , 'react-devtools-inline' ) ;
1111const shellPackagePath = join ( ROOT_PATH , 'packages' , 'react-devtools-shell' ) ;
1212
@@ -74,7 +74,24 @@ 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 (
81+ 'yarn' ,
82+ [
83+ 'cross-env' ,
84+ `REACT_VERSION=${ reactVersion } ` ,
85+ 'cross-env' ,
86+ 'NODE_ENV=development' ,
87+ 'cross-env' ,
88+ 'TARGET=local' ,
89+ 'webpack-dev-server' ,
90+ ] ,
91+ { cwd : shellPackagePath }
92+ ) ;
93+ }
94+
7895 serverProcess . stdout . on ( 'data' , data => {
7996 if ( `${ data } ` . includes ( 'Compiled successfully.' ) ) {
8097 logBright ( 'Testing shell server running' ) ;
@@ -107,7 +124,23 @@ function runTestShell() {
107124async function runEndToEndTests ( ) {
108125 logBright ( 'Running e2e tests' ) ;
109126
110- testProcess = spawn ( 'yarn' , [ 'test:e2e' ] , { cwd : inlinePackagePath } ) ;
127+ if ( ! reactVersion ) {
128+ testProcess = spawn (
129+ 'yarn' ,
130+ [ 'playwright test --config=playwright.config.js' ] ,
131+ { cwd : inlinePackagePath }
132+ ) ;
133+ } else {
134+ testProcess = spawn (
135+ 'yarn' ,
136+ [
137+ 'cross-env' ,
138+ `REACT_VERSION=${ reactVersion } ` ,
139+ 'playwright test --config=playwright.config.js' ,
140+ ] ,
141+ { cwd : inlinePackagePath }
142+ ) ;
143+ }
111144 testProcess . stdout . on ( 'data' , data => {
112145 // Log without formatting because Playwright applies its own formatting.
113146 const formatted = format ( data ) ;
0 commit comments