Skip to content

Commit

Permalink
feat: add process.exit support in bundles
Browse files Browse the repository at this point in the history
  • Loading branch information
ChALkeR committed Nov 10, 2024
1 parent bda121a commit de89fb1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bundler/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ export const build = async (...files) => {
'process.type': 'undefined',
'process.version': stringify('v22.5.1'), // shouldn't depend on currently used Node.js version
'process.versions.node': stringify('22.5.1'), // see line above
'process.cwd': 'EXODUS_TEST_PROCESS.cwd',
EXODUS_TEST_PROCESS_CWD: stringify(process.cwd()),
EXODUS_TEST_FILES: stringify(files.map((f) => [dirname(f), basename(f)])),
EXODUS_TEST_SNAPSHOTS: stringify(EXODUS_TEST_SNAPSHOTS),
Expand Down Expand Up @@ -327,6 +326,11 @@ export const build = async (...files) => {
config.define['process.argv'] = stringify(['exodus-test', resolve(files[0])])
}

if (!['node', 'bun'].includes(options.platform)) {
config.define['process.cwd'] = 'EXODUS_TEST_PROCESS.cwd'
config.define['process.exit'] = 'EXODUS_TEST_PROCESS.exit'
}

let res = await buildWrap(config)
assert.equal(res instanceof Error, res.errors.length > 0)

Expand Down

0 comments on commit de89fb1

Please sign in to comment.