From 3a68f099f3f51f22915e5c54f266626090a7396c Mon Sep 17 00:00:00 2001 From: Andrew Bradley Date: Sun, 1 May 2022 00:43:42 -0400 Subject: [PATCH] fix tests on node 12 and 14 --- test.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test.js b/test.js index 2151df2..2571a53 100644 --- a/test.js +++ b/test.js @@ -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 \(: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\)$`, ]); });