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

Tape CLI hides important context on parsing errors #429

Closed
mourner opened this issue Mar 1, 2018 · 2 comments
Closed

Tape CLI hides important context on parsing errors #429

mourner opened this issue Mar 1, 2018 · 2 comments

Comments

@mourner
Copy link

mourner commented Mar 1, 2018

When running tests with tape test.js instead of node test.js, Tape hides important context (stack trace, file name/position etc.) when there's a syntax error in the code. Consider the following — ideally, the output in case of tape would be the same as when running node:

~/projects/flatbush esm* → npx tape test.js
Unexpected token export

~/projects/flatbush esm* → npx node test.js
/Users/mourner/projects/flatbush/index.js:2
export default function flatbush(numItems, nodeSize, ArrayType) {
^^^^^^

SyntaxError: Unexpected token export
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:607:28)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/mourner/projects/flatbush/test.js:2:16)
@ljharb
Copy link
Collaborator

ljharb commented Mar 1, 2018

This seems reasonable (altho the stack trace lines that are internal to node probably could/should be stripped - only the last line in the trace is valuable)

@ljharb
Copy link
Collaborator

ljharb commented Dec 27, 2019

Investigating this further, this is npx, not tape, that's doing this - please file an issue there: https://github.com/npm/npx

@ljharb ljharb closed this as completed Dec 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants