Skip to content

Handle erroneous location (at) information gracefully #2

Description

@aral

Sometimes, it seems that the file location (error.at) information is not correctly populated.

e.g., I’m getting the following when tests fail because an object doesn’t exist in my current app:

{ file: '', line: undefined, character: '[as' }

Detect this and handle it gracefully.

Suggested implementation

When this is detected, look in the stack trace (if it exists) for the file:/// line and use that. e.g.,

  TypeError: utils.calculateBasePath is not a function
  at file:///var/home/aral/Projects/nodekit/tests/utils.js:120:26
  at Test.<anonymous> (/var/home/aral/Projects/nodekit/node_modules/tape-promise/index.compiled.js:86:19)
  at Test.bound [as _cb] (/var/home/aral/Projects/nodekit/node_modules/tape/lib/test.js:99:32)
  at Test.run (/var/home/aral/Projects/nodekit/node_modules/tape/lib/test.js:117:31)
  at Test.bound [as run] (/var/home/aral/Projects/nodekit/node_modules/tape/lib/test.js:99:32)
  at Immediate.next [as _onImmediate] (/var/home/aral/Projects/nodekit/node_modules/tape/lib/results.js:88:19)
  at process.processImmediate (node:internal/timers:471:21)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions