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

Instrument task includes relative paths to source files in instrumented files instead of absolute paths #41

Open
epoberezkin opened this issue Sep 23, 2015 · 6 comments

Comments

@epoberezkin
Copy link

That makes it difficult to merge coverage reports from different sources.

I am using instrument task on source files that are later combined into a bundle with browserify.
At the moment I have to replace relative paths in instrumented files to absolute paths.

That is the similar issue to the one fixed here:

karma-runner/karma-coverage#163

@jamestalmage
Copy link

From the spec

path - The path to the file. This is an absolute path, and should be the same as the key in the report object.

@epoberezkin
Copy link
Author

Exactly. So this package doesn't follow the spec...

@jamestalmage
Copy link

Yes... I was voicing agreement.

@epoberezkin
Copy link
Author

:)

@epoberezkin
Copy link
Author

The workaround is to use the option cwd:

instrument: {
  files: '...',
  options: {
    cwd: __dirname
  }
}

But probably should be the default behaviour

@sgerace
Copy link

sgerace commented Oct 27, 2016

@epoberezkin Thanks, that helped a lot!

In case this helps anyone else: in my case I am using load-grunt-config so all of my grunt configuration files are located in a /grunt folder within my project (not in the root of my project). Therefore, cwd: __dirname didn't work for me, I ended up using cwd: fspath.join(__dirname, '..'), but same basic idea.

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

3 participants