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

Files are erroneously ignored if process.cwd() contains symlinks #7

Closed
motiz88 opened this issue Jul 1, 2016 · 4 comments
Closed

Comments

@motiz88
Copy link
Contributor

motiz88 commented Jul 1, 2016

  1. babel-plugin-istanbul preprocesses paths with realpath() before filtering them with test-exclude.
  2. test-exclude excludes paths that are outside of process.cwd().

When process.cwd() includes symlinks, the use of realpath() means that all files will appear to be outside of the working directory.

Possible solutions:

A) Resolve process.cwd() with realpath() too

(PR #8 does this)

    exclude = testExclude({
      cwd: getRealpath(process.cwd()),
//...

Or alternatively:

B) Don't use realpath() on any files at all

There may, of course, be a good reason to keep using realpath() that I'm not aware of.

motiz88 added a commit to motiz88/babel-plugin-istanbul that referenced this issue Jul 1, 2016
motiz88 added a commit to motiz88/babel-plugin-istanbul that referenced this issue Jul 2, 2016
@bcoe bcoe closed this as completed in e8d3785 Jul 3, 2016
@motiz88
Copy link
Contributor Author

motiz88 commented Aug 1, 2016

@bcoe I am seeing a regression to the old behavior due to the use of non-realpath-normalized NYC_CWD since fabb602. This issue should probably be reopened.

@motiz88
Copy link
Contributor Author

motiz88 commented Aug 14, 2016

@bcoe? Anyone?

@bcoe
Copy link
Member

bcoe commented Aug 14, 2016

@motiz88 mind submitting a failing unit-test, I'm not quite sure how to reproduce this failing behavior.

@bcoe bcoe reopened this Aug 14, 2016
@motiz88
Copy link
Contributor Author

motiz88 commented Aug 15, 2016

I'll keep thinking about a way to put this in a unit test. Here are the repro steps:

  1. Start with a project that is set up to use babel-plugin-istanbul and is generating coverage.
  2. Create a symlink to the project root, from elsewhere in the file system (Linux ln or Windows mklink)
  3. In a terminal, cd to the project via the symlink.
  4. Try to generate coverage. All source files will be ignored.

motiz88 added a commit to motiz88/babel-plugin-istanbul that referenced this issue Aug 15, 2016
motiz88 added a commit to motiz88/babel-plugin-istanbul that referenced this issue Aug 26, 2016
motiz88 added a commit to motiz88/babel-plugin-istanbul that referenced this issue Sep 5, 2016
motiz88 added a commit to motiz88/babel-plugin-istanbul that referenced this issue Sep 5, 2016
@bcoe bcoe closed this as completed in #37 Sep 8, 2016
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