javascript - How to make Mocha display correct line numbers in source files if a test fails? -
i'm using mocha nodejs tests, , when test fails due error thrown source code (for example "typeerror: cannot read property 'prop' of null
"), line numbers in displayed stacktrace wrong (they don't match original source file, far bigger).
1) myapp should something: typeerror: cannot read property 'prop' of null @ myapp.<anonymous> (/path/to/my-project/lib/my-project.js:515:93) @ myapp.build (/path/to/my-project/lib/my-project.js:774:16) @ context.<anonymous> (/path/to/my-project/test/test.js:62:67) @ test.runnable.run (/path/to/my-project/node_modules/mocha/lib/runnable.js:216:15) @ runner.runtest (/path/to/my-project/node_modules/mocha/lib/runner.js:373:10) @ /path/to/my-project/node_modules/mocha/lib/runner.js:451:12 @ next (/path/to/my-project/node_modules/mocha/lib/runner.js:298:14) @ /path/to/my-project/node_modules/mocha/lib/runner.js:308:7 @ next (/path/to/my-project/node_modules/mocha/lib/runner.js:246:23) @ object._onimmediate (/path/to/my-project/node_modules/mocha/lib/runner.js:275:5) @ processimmediate [as _immediatecallback] (timers.js:330:15)
(here my-project.js
has 279 lines !)
is there way tell mocha display them correctly?
this happens when code instrumented coverage tool (e.g. blanket
, istanbul
, etc). double-check make sure aren't loading in normal tests mistake.
Comments
Post a Comment