Skip to content

Commit e069230

Browse files
Merge pull request #355 from swiftwasm/yt/test-crash-report
PackageToJS: Report stack trace on proc_exit
2 parents 10d4813 + 67c9782 commit e069230

File tree

1 file changed

+8
-3
lines changed
  • Plugins/PackageToJS/Templates/bin

1 file changed

+8
-3
lines changed

Plugins/PackageToJS/Templates/bin/test.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,12 @@ const harnesses = {
4242
let options = await nodePlatform.defaultNodeSetup({
4343
args: testFrameworkArgs,
4444
onExit: (code) => {
45-
if (code !== 0) { return }
45+
if (code !== 0) {
46+
const stack = new Error().stack
47+
console.error(`Test failed with exit code ${code}`)
48+
console.error(stack)
49+
return
50+
}
4651
// Extract the coverage file from the wasm module
4752
const filePath = "default.profraw"
4853
const destinationPath = args.values["coverage-file"] ?? filePath
@@ -52,9 +57,9 @@ const harnesses = {
5257
writeFileSync(destinationPath, profraw);
5358
}
5459
},
55-
/* #if USE_SHARED_MEMORY */
60+
/* #if USE_SHARED_MEMORY */
5661
spawnWorker: nodePlatform.createDefaultWorkerFactory(preludeScript)
57-
/* #endif */
62+
/* #endif */
5863
})
5964
if (preludeScript) {
6065
const prelude = await import(preludeScript)

0 commit comments

Comments
 (0)