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

Ignore stories folder when testing #725

Closed
dclawson opened this issue Mar 15, 2017 · 2 comments
Closed

Ignore stories folder when testing #725

dclawson opened this issue Mar 15, 2017 · 2 comments

Comments

@dclawson
Copy link

How do you ignore the src/stories directory when running a --coverage test?

I am using a create-react-app base and have tried the following in my package.json

"jest": {
  "collectCoverageFrom": [
    "src/**/*.{js,jsx}",
    "!<rootDir>/node_modules/",
    "!<rootDir>/src/stories/"
  ]
}
@tmeasday
Copy link
Member

It looks like you can't pass options to jest via that mechanism in CRA (facebook/create-react-app#922).

You can pass an argument to jest on the commandline though:

npm test -- --coverage --collectCoverageFrom='["src/**/*.{js,jsx}","!src/**/stories/*"]'

Do you think we should add some documentation about this?

@dclawson
Copy link
Author

dclawson commented Apr 3, 2017

Thanks @tmeasday.

Yes, I think it would be helpful for --coverage tests.

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

No branches or pull requests

2 participants