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

path inconsistency running tests in coverage mode #83

Open
hexsprite opened this issue Dec 17, 2019 · 3 comments
Open

path inconsistency running tests in coverage mode #83

hexsprite opened this issue Dec 17, 2019 · 3 comments

Comments

@hexsprite
Copy link

hexsprite commented Dec 17, 2019

Expected behavior: That tests run consistently whether in coverage mode or not. Specifically that stack traces would contain the same paths. These paths are used by testing tools like snap-shot-it to locate associated snapshot files. The stack trace should contain a path to the original test file like: imports/jasmine/server/integration/autosplit.app-spec.js (confirmed with meteortesting:mocha)

Actual behavior: The filename in the stack trace running tests in coverage mode instead looks like /private/var/folders/q5/2qtj1b5n67b_q7czgc5mj8fh0000gn/T/meteor-test-run2kd6s4.yh47s/.meteor/local/build/programs/server/app/app.js

This causes the snapshot to not be able to locate it's required files in the original project directory.

The snap-shot-it package uses stacktrace-js to get the stack trace like so:

fullFilename = `${process.env.PWD}/${stackTrace.getSync()[1].fileName}`;
@serut
Copy link
Owner

serut commented Dec 17, 2019

I don't think I can fix this. Maybe the variable process.env.PWD is not the right one to use with meteor-coverage?

@hexsprite
Copy link
Author

What causes the inconsistency between coverage mode and non-coverage mode when running tests?

specifically why does it go from correctly referencing the original test file to the combined app.js?

@serut
Copy link
Owner

serut commented Dec 17, 2019

I think that's always the case when you run babel-plugin-istanbul or any other coverage library. I use the source map after to retrieve the correct path

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

No branches or pull requests

2 participants