MCPcopy Index your code
hub / github.com/Sandpack/nodebox-runtime / globalSetup

Function globalSetup

tests/setup/globalSetup.ts:16–39  ·  view source on GitHub ↗
(_context: Config)

Source from the content-addressed store, hash-verified

14 * @see https://playwright.dev/docs/test-advanced#global-setup-and-teardown
15 */
16export default async function globalSetup(_context: Config): Promise<() => Promise<void>> {
17 const [runtimeIoResult, previewIoResult] = await Promise.allSettled([runRuntimeServer(), runPreviewServer()]);
18
19 if (runtimeIoResult.status === 'rejected' || previewIoResult.status === 'rejected') {
20 if (runtimeIoResult.status === 'fulfilled') {
21 runtimeIoResult.value.kill();
22 } else if (previewIoResult.status === 'fulfilled') {
23 previewIoResult.value.kill();
24 }
25
26 if (runtimeIoResult.status === 'rejected') {
27 throw runtimeIoResult.reason;
28 } else if (previewIoResult.status === 'rejected') {
29 throw previewIoResult.reason;
30 }
31 }
32
33 const cdnProxy = await runSandpackCDNProxy();
34 return async () => {
35 cdnProxy.app.close();
36 runtimeIoResult.value.kill();
37 previewIoResult.value.kill();
38 };
39}
40
41function runRuntimeServer(): DeferredPromise<ChildProcess> {
42 return spawnAndWaitForStdout('pnpm', ['start:runtime'], (stdout) => {

Callers

nothing calls this directly

Calls 4

runSandpackCDNProxyFunction · 0.90
runRuntimeServerFunction · 0.85
runPreviewServerFunction · 0.85
killMethod · 0.80

Tested by

no test coverage detected