Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zora stack traces brittle to node version change #15

Open
missinglink opened this issue May 25, 2023 · 1 comment
Open

zora stack traces brittle to node version change #15

missinglink opened this issue May 25, 2023 · 1 comment

Comments

@missinglink
Copy link

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant