tapzero icon indicating copy to clipboard operation
tapzero copied to clipboard

zora stack traces brittle to node version change

Open missinglink opened this issue 2 years ago • 1 comments

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

missinglink avatar May 25 '23 19:05 missinglink

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') &&

missinglink avatar May 25 '23 19:05 missinglink