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

html reporter not working #28

Closed
Stupidism opened this issue Apr 6, 2017 · 12 comments
Closed

html reporter not working #28

Stupidism opened this issue Apr 6, 2017 · 12 comments

Comments

@Stupidism
Copy link

fs.js:951
  return binding.readdir(pathModule._makeLong(path), options.encoding);
                 ^

Error: ENOENT: no such file or directory, scandir 'xxxx/node_modules/nyc/node_modules/istanbul-reports/lib/html/assets'
    at Error (native)
    at Object.fs.readdirSync (fs.js:951:18)

@bcoe
Copy link
Member

bcoe commented Apr 6, 2017

@Stupidism could you share a project (or a branch of a project) that is exhibiting this issue?

I haven't been able to reproduce on my own projects, which makes me think there must ben an edge-case that's triggering this behavior.

@Stupidism
Copy link
Author

Stupidism commented Apr 6, 2017

After reinstall nyc, it's gone in my project. It must be an installation error.

@Stupidism
Copy link
Author

Stupidism commented Apr 6, 2017

It happens again, here is my detailed tests:
I have a demo repo, but it can't reproduce this problem.
The bug only happens in my private repo.
After yarn clean it can be reproduced now !

Problem

There's no assets directory under path node_modules/istanbul-reports/lib/html/, after nyc is installed by yarn
I even tried yarn add --dev istanbul-reports directly in two repos. Results are different.

Steps to reproduce

git clone git@github.com:Stupidism/react-starter-kit.git -b feat/test-coverage
cd react-starter-kit
yarn install 

# First time, it should be working
yarn run coverage 

yarn remove nyc
yarn clean
yarn add --dev nyc

# This time, it breaks
yarn run coverage 

Temp solution

run rm -r node_modules/nyc; npm i nyc after yarn install

commands(Not important anymore)

  • A: npm run test:cover
  • B-G(global): nyc report --reporter=html
  • B-L(local): ./node_modules/.bin/nyc report --reporter=html
  • C(npm scripts): A && B-G
install tool npm yarn
run A and then B-G working working
run A and then B-L working working
run A && B-G working working
run A && B-L working error
run C (same as above) working error

@Stupidism Stupidism reopened this Apr 6, 2017
@Stupidism
Copy link
Author

Not sure this is a problem with yarn or istanbul
Possible reasons:

  1. yarn has a bug
  2. istanbul used some not-fullly-supported-by-yarn hook of npm.

@Stupidism
Copy link
Author

@bcoe updates

@bcoe
Copy link
Member

bcoe commented Apr 16, 2017

@Stupidism it sounds like this was an issue with yarn, that may have been resolved; mind testing things out with the latest version?

@bcoe
Copy link
Member

bcoe commented Apr 16, 2017

@Stupidism I dug into this problem a bit further for you, the problem is the order of the rewire and istanbul plugin:

https://github.com/speedskater/babel-plugin-rewire#istanbul

If you swap the order of istanbul, and rewire in @JaKXz's example configuration, things should start working for you.

@Stupidism
Copy link
Author

Not fixed yet! @bcoe

@bcoe
Copy link
Member

bcoe commented Apr 17, 2017

@Stupidism I've tested @JaKXz's branch of your repo; if you switch the order of rewire and istanbul things should start working for you.

@Stupidism
Copy link
Author

Have you tried these three cmds?


yarn remove nyc
yarn clean
yarn add --dev nyc

@bcoe
Copy link
Member

bcoe commented Apr 17, 2017

@Stupidism no, but it sounded like there was a known issue with yarn deleting a required folder that was fixed in newer versions; @JaKXz can you speak to this?

@Stupidism
Copy link
Author

Yeah, I guess it's a bug caused by yarn. I will watch that thread in yarn repo

arnabsen pushed a commit to arnabsen/istanbuljs that referenced this issue Feb 20, 2024
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