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

Line numbers in stack traces are wrong in Node v21 #1

Open
BlockLune opened this issue Jan 31, 2024 · 0 comments
Open

Line numbers in stack traces are wrong in Node v21 #1

BlockLune opened this issue Jan 31, 2024 · 0 comments

Comments

@BlockLune
Copy link
Owner

BlockLune commented Jan 31, 2024

Introduction

There is an incorrect use of negative index in the commit 16732f7 that causes some tests to fail. The line number problem occurred in the error message that the tests output.

Part of the error message:

  1) Lines Transformation Tests
       should work when blockquote has no config:
     TypeError: Cannot read properties of undefined (reading 'match')
      at blockquoteLines2NoteLines (lib/blockquote.ts:2:1585)
      at Context.<anonymous> (test/blockquote.test.ts:2:361)
      at process.processImmediate (node:internal/timers:478:21)

  2) Lines Transformation Tests
       should work when blockquote has not full config:
     TypeError: Cannot read properties of undefined (reading 'match')
      at blockquoteLines2NoteLines (lib/blockquote.ts:2:1585)
      at Context.<anonymous> (test/blockquote.test.ts:2:785)
      at process.processImmediate (node:internal/timers:478:21)

  3) Lines Transformation Tests
       should work when blockquote has full config:
     TypeError: Cannot read properties of undefined (reading 'match')
      at blockquoteLines2NoteLines (lib/blockquote.ts:2:1585)
      at Context.<anonymous> (test/blockquote.test.ts:2:1226)
      at process.processImmediate (node:internal/timers:478:21)

Expected Behavior

The line numbers in the stack traces should match the actual line numbers in the file.

Actual Behavior

The line numbers are wrong.

Environment

  • MacBook Air M1, 2020 (macOS Sonoma 14.3)
  • Node v21.6.1 (npm v10.4.0)
  • tsx v4.7.0
  • mocha v10.2.0

Attempted Methods

I found this and I tried to use another version of node using nvm. The expected behavior was met on node v20.11.0 (npm v10.2.4) and node v18.19.0 (npm v10.2.3). In both cases the same part of error message became:

  1) Lines Transformation Tests
       should work when blockquote has no config:
     TypeError: Cannot read properties of undefined (reading 'match')
      at blockquoteLines2NoteLines (lib/blockquote.ts:32:31)
      at Context.<anonymous> (test/blockquote.test.ts:12:20)
      at process.processImmediate (node:internal/timers:476:21)

  2) Lines Transformation Tests
       should work when blockquote has not full config:
     TypeError: Cannot read properties of undefined (reading 'match')
      at blockquoteLines2NoteLines (lib/blockquote.ts:32:31)
      at Context.<anonymous> (test/blockquote.test.ts:27:20)
      at process.processImmediate (node:internal/timers:476:21)

  3) Lines Transformation Tests
       should work when blockquote has full config:
     TypeError: Cannot read properties of undefined (reading 'match')
      at blockquoteLines2NoteLines (lib/blockquote.ts:32:31)
      at Context.<anonymous> (test/blockquote.test.ts:42:20)
      at process.processImmediate (node:internal/timers:476:21)
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