Skip to content

Commit ec2bfc9

Browse files
author
aehnh
committed
build on global setup
1 parent 211ed3d commit ec2bfc9

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

packages/tests-e2e/src/connect/utils/Playground.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function getPlaygroundDir(): string {
2727
function getPlaygroundArgs(port: number): string[] {
2828
switch (PLAYGROUND_TYPE) {
2929
case 'connect-next':
30-
return ['run', 'build-and-start', '--', '--port', port.toString()];
30+
return ['run', 'start', '--', '--port', port.toString()];
3131
case 'connect-web-js':
3232
throw new Error(`Unimplemented: ${PLAYGROUND_TYPE}`);
3333
default:
@@ -74,7 +74,22 @@ export default async function installPlaygroundDeps() {
7474
installProcess.on('close', (code: number) => {
7575
if (code === 0) {
7676
console.log(`[Global Setup] Dependencies installed successfully in ${playgroundDir}.`);
77-
resolve();
77+
const buildProcess = spawn('npm', ['run', 'build'], {
78+
cwd: playgroundDir,
79+
stdio: 'inherit',
80+
shell: true,
81+
});
82+
buildProcess.on('close', (buildCode: number) => {
83+
if (buildCode === 0) {
84+
console.log(`[Global Setup] Playground built successfully in ${playgroundDir}.`);
85+
resolve();
86+
} else {
87+
reject(new Error(`[Global Setup] npm run build-and-preview failed in ${playgroundDir} with code ${buildCode}`));
88+
}
89+
});
90+
buildProcess.on('error', (err: Error) => {
91+
reject(new Error(`[Global Setup] Failed to start build process: ${err.message}`));
92+
});
7893
} else {
7994
reject(new Error(`[Global Setup] npm install failed in ${playgroundDir} with code ${code}`));
8095
}

0 commit comments

Comments
 (0)