Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Node.js >=12.12.0 has support for source maps when run with the flag
--enable-source-maps
but the additional stack trace information is not being shown by Jasmine's stack traces. This pull request stops stack trace information from being discarded. Among other things, this causes the source map information to show up.Motivation and Context
Currently Jasmine discards source map information from stack traces when the
file
property is not set on those stack frames.This would proably fix #491.
It might be relevant that the "competing" framework Mocha has specific support for
--enable-source-maps
: https://mochajs.org/#-enable-source-mapsPersonally, I would prefer a completely unmodified stack trace from Node/V8, because I think that most users are educated enough to be able to read those. The extra information is just too valuable.
How Has This Been Tested?
I have manually tested this with a test suite that throws an error. Before running Jasmine I had to set the following environment variable:
The stack trace looks much more complete now and it finally includes the source map information. I am not sure if it's feasible to add an automated test, because the feature requires at least Node.js v12.12.0, so the test would fail on Node.js 10. Additionally, we would have to
--enable-source-maps
for the test process.Output before:
Output after:
Note that this includes the correct TypeScript filename as well as correct line/column numbers. Many editors (such as VS Code) can turn this into a clickable link that directly opens the source file.
Types of changes
Checklist: