close
The Wayback Machine - https://web.archive.org/web/20201104115451/https://github.com/boogie666/atom-mocha/issues/10
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

Line numbers off when using compiled files #10

Open
poelstra opened this issue Jun 17, 2016 · 1 comment
Open

Line numbers off when using compiled files #10

poelstra opened this issue Jun 17, 2016 · 1 comment

Comments

@poelstra
Copy link

@poelstra poelstra commented Jun 17, 2016

First of all: thanks for this great package! Really like having a clean overview of all tests in the panel, and having clickable stack-traces is very handy!

I did run into two issues there, though: first, I ran into #5, which I hacked in the source by prepending my home dir before the file path for now. That's probably not the right solution though, and it may actually be a bug/feature in the error-stack-frame package.

Then, it appeared that the line numbers in the file were off by 30 rows. After some poking around, I think it is caused by my .js file being a compiled file (using Typescript). I'm using source-map-support for translating the .js line numbers back to .ts line numbers (through import "source-map-support/register"; at the top of the .ts/.js file), but it seems that some code is prepended to the .js file before it's run through mocha. This causes the line numbers to be higher than expected, which then causes source-map-support to translate to the wrong line.

I then found the compiler setting, and noticed that by setting it to "ES5", the problem no longer occurs.

Maybe there's a different way of prepending the babel stuff, or using ES5 as the default setting?

@boogie666
Copy link
Owner

@boogie666 boogie666 commented Mar 18, 2017

Sorry for the very very very quite late response to this issue :) i've been busy with other stuff to take care of this package.

Basically atom-mocha spins up a separate node process that runs the tests and uses a custom mocha reporter to communicate stuff back to the ui.

it does not prepend anything in to code, but if the compiler setting is set to anything other then ES5 it does a require("bable/register") or require("coffeescript/register") based on what settings is used, in the separate process.

I'm not exactly sure how or if i can set it to use other compilers that are not installed directly in the package.

If you have any ideas they are more then welcome.

Until then if switching to ES5 compiler setting, go forth and use that :P.

Cheers,
Boogie

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.