tapzero
tapzero copied to clipboard
zora stack traces brittle to node version change
When running node v19.9.0 a bunch of the tests fail due to the Error.stack format changing between node releases.
I started hacking on strip() in test/util.js but it feels wrong, any ideas how best to deal with this?
diff --git a/test/zora/fixtures/bailout_fail_out.txt b/test/zora/fixtures/bailout_fail_out.txt
index a89a03a..48e319a 100644
--- a/test/zora/fixtures/bailout_fail_out.txt
+++ b/test/zora/fixtures/bailout_fail_out.txt
@@ -11,4 +11,6 @@ Error: Oh no!
at TestRunner.run ($TAPE/index.js:$LINE:$COL)
at Timeout._onTimeout ($TAPE/index.js:$LINE:$COL)
at listOnTimeout (node:internal/timers:$LINE:$COL)
- at processTimers (node:internal/timers:$LINE:$COL)
+ at process.processTimers (node:internal/timers:$LINE:$COL)
+
+Node.js v19.9.0
This 'fixes' it:
diff --git a/test/util.js b/test/util.js
index 500aad5..fc53365 100644
--- a/test/util.js
+++ b/test/util.js
@@ -61,8 +61,14 @@ function strip (line) {
const withoutNestedLineNumbers = withoutLineNumbers.replace(
/, <anonymous>:\$LINE:\$COL\)$/, ')'
)
+ const withoutProcessPrefix = withoutNestedLineNumbers.replace(
+ /process./, ''
+ )
+ const withoutNodeVersion = withoutProcessPrefix.replace(
+ /\n\nNode.js v[0-9.]+/i, ''
+ )
- const lines = withoutNestedLineNumbers.split('\n')
+ const lines = withoutNodeVersion.split('\n')
const newLines = lines.filter((line) => {
return !line.includes('internal/process/task_queues.js') &&
!line.includes('internal/process/next_tick.js') &&