Skip to content

Commit

Permalink
fix tests on node 12 and 14
Browse files Browse the repository at this point in the history
  • Loading branch information
cspotcode committed May 1, 2022
1 parent da3e63f commit 3a68f09
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -527,12 +527,19 @@ it('async stack frames: Promise.any', async function() {
});

it('wasm stack frames', async function() {
const wasmFrame = semver.gte(process.versions.node, '16.0.0')
? String.raw`wasm:\/\/wasm\/c2de0ab2:wasm-function\[1\]:0x3b`
: semver.gte(process.versions.node, '14.0.0')
? String.raw`call_js_function \(<anonymous>:wasm-function\[1\]:0x3b\)`
// Node 12
: String.raw`wasm-function\[1\]:0x3b`;

await compareStackTrace(createMultiLineSourceMap(), [
'return require("./test-fixtures/wasm/wasm.js").call_js_function(() => { throw new Error("test"); });'
], [
'Error: test',
re`^ at ${stackFramePathStartsWith()}(?:.*[/\\])?line1.js:1001:101$`,
re`^ at wasm:\/\/wasm\/c2de0ab2:wasm-function\[1\]:0x3b$`,
re`^ at ${wasmFrame}$`,
re`^ at Object\.exports\.call_js_function \(.*[/\\]wasm\.js:13:24\)$`,
]);
});
Expand Down

0 comments on commit 3a68f09

Please sign in to comment.