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

Windows: Undefined path resolution behaviour for project (and it parts) located within directory junction links #554

Closed
ghost opened this issue Apr 17, 2017 · 2 comments
Labels

Comments

@ghost
Copy link

ghost commented Apr 17, 2017

Expected Behavior

Use of nyc --all mocha should collect coverage data for src directory only, once for each file (tested or not doesn't matter).

Observed Behavior

Instead, with junction links as part of project path, coverage data collected for:

  • each tested file (as should be);
  • each file in src folder (results in duplicates of already listed tested files with 0% coverage);
  • each file in test folder (which is plain wrong, as test folder not in coverage interest paths by default).

Everything referred to as junctions was made like this cmd: mklink /j junction D:\junction
D:\junction is junction origin (real folder), C:\junction is junction link.
Note, that including/excluding coverage paths for nyc do nothing at all, --all flag becomes useless as consequence.

Temporary solutions

  1. Move project or it parts within junction links to non-junction structure;
  2. Access project folder through junction origins (cannot be achieved for part of project).

Bonus Points! Code (or Repository) that Reproduces Issue

Sample structure and contents in gist suffice to serve the case (nevertheless, reproduced same stuff on several of other projects).

Assuming project structure of:

folder or junction
+-- src
| +-- a.js
| `-- b.js
`-- test
  `-- a.js

If nyc --all mocha used in plain folder, everything works as expected:

PS C:\folder> npm run cover

> buggy@1.0.0 cover C:\folder
> nyc --all mocha

  dummy a test
    √ should be

  1 passing (9ms)

----------|----------|----------|----------|----------|----------------|
File      |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
----------|----------|----------|----------|----------|----------------|
All files |       50 |      100 |       50 |       50 |                |
 a.js     |      100 |      100 |      100 |      100 |                |
 b.js     |        0 |      100 |        0 |        0 |            1,2 |
----------|----------|----------|----------|----------|----------------|

If nyc --all mocha used on directory path within junction link:

PS C:\junction> npm run cover

> buggy@1.0.0 cover C:\junction
> nyc --all mocha

  dummy a test
    √ should be

  1 passing (20ms)

----------|----------|----------|----------|----------|----------------|
File      |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
----------|----------|----------|----------|----------|----------------|
All files |    63.64 |      100 |       60 |    63.64 |                |
 src      |    33.33 |      100 |    33.33 |    33.33 |                |
  a.js    |        0 |      100 |        0 |        0 |            1,2 |
  a.js    |      100 |      100 |      100 |      100 |                |
  b.js    |        0 |      100 |        0 |        0 |            1,2 |
 test     |      100 |      100 |      100 |      100 |                |
  a.js    |      100 |      100 |      100 |      100 |                |
----------|----------|----------|----------|----------|----------------|

If nyc --all mocha used in junction origin (source of junction on D volume):

PS D:\junction> npm run cover

> buggy@1.0.0 cover D:\junction
> nyc --all mocha

  dummy a test
    √ should be

  1 passing (19ms)

----------|----------|----------|----------|----------|----------------|
File      |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
----------|----------|----------|----------|----------|----------------|
All files |       50 |      100 |       50 |       50 |                |
 a.js     |      100 |      100 |      100 |      100 |                |
 b.js     |        0 |      100 |        0 |        0 |            1,2 |
----------|----------|----------|----------|----------|----------------|

The most interesting case -- if nyc --all mocha used in project with src as junction link:

C:\folder>npm run cover

> buggy@1.0.0 cover C:\folder
> nyc --all mocha

  dummy a test
    √ should be

  1 passing (13ms)

--------------|----------|----------|----------|----------|----------------|
File          |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
--------------|----------|----------|----------|----------|----------------|
All files     |    33.33 |      100 |    33.33 |    33.33 |                |
 folder/src   |        0 |      100 |        0 |        0 |                |
  a.js        |        0 |      100 |        0 |        0 |            1,2 |
  b.js        |        0 |      100 |        0 |        0 |            1,2 |
 junction/src |      100 |      100 |      100 |      100 |                |
  a.js        |      100 |      100 |      100 |      100 |                |
--------------|----------|----------|----------|----------|----------------|

Note that cases of project path and src junction links differs greatly.

Forensic Information

Operating System: Windows 10 ver.1607
Environment Information:

Output located at same gist

@ghost ghost changed the title Windows: Undefined path resolution behaviour for projects (and it parts) located within directory junctions Windows: Undefined path resolution behaviour for projects (and it parts) located within directory junction links Apr 17, 2017
@ghost ghost changed the title Windows: Undefined path resolution behaviour for projects (and it parts) located within directory junction links Windows: Undefined path resolution behaviour for project (and it parts) located within directory junction links Apr 17, 2017
@bcoe bcoe added the bug label May 14, 2017
@bcoe
Copy link
Member

bcoe commented May 14, 2017

@ChantOfAnAnt thank you for the bug report; I think the underlying issue will be in this library here:

https://github.com/istanbuljs/istanbuljs/tree/master/packages/test-exclude

would you mind reopening an issue there? would also greatly appreciate any help you can provide digging into things -- we should be able to add a few new failing test cases to test-exclude.

@bcoe bcoe closed this as completed May 14, 2017
@ghost
Copy link
Author

ghost commented May 14, 2017

@bcoe thanks for investigating! As advised, will reopen this as issue on test-exclude in spare time.

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

No branches or pull requests

1 participant