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

Rename a folder causes nyc report the folder twice and incorrectly #1265

Closed
XLCYun opened this issue Jan 6, 2020 · 5 comments
Closed

Rename a folder causes nyc report the folder twice and incorrectly #1265

XLCYun opened this issue Jan 6, 2020 · 5 comments

Comments

@XLCYun
Copy link

XLCYun commented Jan 6, 2020

Link to bug demonstration repository

Here is the project I am working on: ReactifyObject

Expected Behavior

After I change the name of a folder setupValue to SetupValue, nyc's output should only report the coverage in folder SetupValue now, but it reports setupValue and SetupValue two folder, and the result is also not correct.

Observed Behavior

Here is the file structure:
image

Here is the .html file result:
image

Changed back to setupValue, problem still remained but the coverage result is different:
image

So I try to run nyc in console by:

nyc --reporter=lcov --reporter=text --cache=false "npm run test"

Problem remained, and I had debugged my test file, the coverage of this folder should be 100%.

Troubleshooting steps

I had tried clear .nyc_output, coverage folder, ./node_modules/.cache/nyc and use --cache=false in command, restarted VSCode, problem remained.

Environment Information

  System:
    OS: Windows 10 10.0.17763
    CPU: (4) x64 Intel(R) Core(TM) i5-4590 CPU @ 3.30GHz
    Memory: 1.04 GB / 7.94 GB
  Binaries:
    Node: 10.16.0 - D:\Program Files\nodejs\node.EXE
    npm: 6.9.0 - D:\Program Files\nodejs\npm.CMD
  npmPackages:
    nyc: ^15.0.0 => 15.0.0
@XLCYun
Copy link
Author

XLCYun commented Jan 6, 2020

image
This is the text output.

@coreyfarrell
Copy link
Member

I'm unsure what could cause this, does it happen when you run nyc from CLI / outside VSCode? Deleting node_modules/.cache and .nyc_output should clear information from any previous runs, especially as I don't see any transpile / build step for your repo. Does anything suspicious appear in git status --ignored?

@XLCYun
Copy link
Author

XLCYun commented Jan 7, 2020

I'm unsure what could cause this, does it happen when you run nyc from CLI / outside VSCode? Deleting node_modules/.cache and .nyc_output should clear information from any previous runs, especially as I don't see any transpile / build step for your repo. Does anything suspicious appear in git status --ignored?

Yes, it seems so weird. It still happens when I run nyc from CLI or outside VSCode, like git Bash or PowerShell:
image
And I clone this repo in other folder(driver), it still happens.
Nothing suspicious appear in git status --ignored:
image
I don't use webpack, babel or anything like that in this repo, so it doesn't need and has not a npm build config.
I am stuck here. What can I do to locate this issue?

@coreyfarrell
Copy link
Member

I think this is a coding error in your project. In some of your require statements you use SetupValue and others you use setupValue. I'm guessing this only works because your testing on Windows, if you setup travis-ci to get Linux / OSX testing I suspect your code would fail to run because require('./setupValue/setupValue') at https://github.com/XLCYun/ReactifyObject/blob/master/ReactifyObjectTree/ReactifyObjectTreeNode/ReactifyObjectTreeNode.js#L4 would not find ./SetupValue/setupValue.js outside of Windows.

@XLCYun
Copy link
Author

XLCYun commented Jan 7, 2020

I think this is a coding error in your project. In some of your require statements you use SetupValue and others you use setupValue. I'm guessing this only works because your testing on Windows, if you setup travis-ci to get Linux / OSX testing I suspect your code would fail to run because require('./setupValue/setupValue') at https://github.com/XLCYun/ReactifyObject/blob/master/ReactifyObjectTree/ReactifyObjectTreeNode/ReactifyObjectTreeNode.js#L4 would not find ./SetupValue/setupValue.js outside of Windows.

You are right! Windows does not care about caption, and I didn't notice vscode failed to update the require path and check for it, after correction, it works just fine now. Grateful you for your time.

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