File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -716,12 +716,15 @@ if (options.pure) {
716716 const wrapperContent = `
717717export default {
718718 async test(ctrl, env, ctx) {
719- await import('./' + ${ JSON . stringify ( jsRelativePath ) } );
720- if (typeof globalThis.EXODUS_TEST_RUN !== 'function') throw new Error('node:test not loaded');
721- const exitCode = await globalThis.EXODUS_TEST_RUN();
722- if (exitCode !== 0) throw new Error(\`Tests failed with exit code \${exitCode}\`);
719+ await import('./' + ${ JSON . stringify ( jsRelativePath ) } )
720+ let exitCode = EXODUS_TEST_PROCESS.exitCode // can fail early
721+ if (exitCode === 0) {
722+ if (typeof globalThis.EXODUS_TEST_RUN !== 'function') throw new Error('node:test not loaded')
723+ exitCode = await globalThis.EXODUS_TEST_RUN()
724+ }
725+ if (exitCode !== 0) throw new Error(\`Tests failed with exit code \${exitCode}\`)
723726 }
724- }; `
727+ }`
725728 await writeFile ( bundled . fileWrapper , wrapperContent )
726729 const configContent = `
727730using Workerd = import "/workerd/workerd.capnp";
You can’t perform that action at this time.
0 commit comments