Repository navigation
Fix coffee script stack traces in tests - #567
Merged
arthurschreiber merged 2 commits intoApr 11, 2017
Merged
Conversation
Both `coffee-script` as well as `source-map-support` (loaded through `babel-register`) patch `Error.prepareStackTrace` to modify stack traces to point to correct error locations for transpiled code. Unfortunately, these two patches don't play well together. But `coffee-script/register` automatically generates inline source maps, which `source-map-support` has support for via the `hookRequire` option. So in the end, we can make those two play together by configuring `source-map-support` correctly.
arthurschreiber
deleted the
arthur/fix-coffee-script-stack-traces-in-tests
branch
April 11, 2017 07:10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
While looking through the travis errors of #566 at https://travis-ci.org/tediousjs/tedious/jobs/220815074, I noticed that the stack traces for Coffee Script code are all messed up.
After some fiddling around, I figured out that this is because both
coffee-script/registeras well asbabel-register(viasource-map-support) install a customError.prepareStackTracefunction, and the former gets overwritten by the latter.Fortunately,
coffee-script/registergenerates inline source maps in the transpilation result, andsource-map-supporthas optional support for these source maps, but it's not enabled inbabel-register. But enabling it is easy, so we can make sure stack traces look good for code transpiled throughcoffee-scriptas well asbabel. 👍