-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Jest coverage targets the wrong file #3968
Comments
Additional informations:
|
Hi @stipsan ! I was about to test it but got an error when trying to target the master branch from this repository: devDependencies: {
"jest-cli": "facebook/jest#master"
} error /.../node_modules/jest-cli: Command failed.
Exit code: 1
Command: sh
Arguments: -c yarn run build --silent
Directory: /.../node_modules/jest-cli
Output:
module.js:487
throw err;
^
Error: Cannot find module 'string-length'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/.../node_modules/jest-cli/scripts/build.js:32:22)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command. Am I missing something with the way I should target a git repository as a dependency ? |
I think you have to clone and build the repo locally. When referencing the git repo you don't get the dev deps necessary for building |
Like @SimenB says the easiest way to test it is to:
|
Just tried following the steps to link a local version of jest ( Using |
No need to link, just clone, run |
Doesn't change a thing though, both methods still display the wrong coverage. |
Very strange. It might still be loading the old packages for |
After upgrading to |
I'm having a similar issue with Jest generating random or nonsensical coverage data in #4960 |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
Considering this file tree:
And my coverage when I run the
npm run jest -- --coverage app/services/items/reducer/tests/list.test.js
command:(I removed some unrelated part of the coverage and file tree).
Jest coverage targets the
services/categories/reducer/list
file when running the tests onservices/items/reducer/list
. I import the right file and it is actually testing the right file, meaning that voluntarily changing something inservices/items/reducer/list
makes the tests fail.If the current behavior is a bug, please provide the steps to reproduce and either a repl.it demo through https://repl.it/languages/jest or a minimal repository on GitHub that we can
yarn install
andyarn test
.This comes from a private repository and I don't think I can give you a runnable example 😞
What is the expected behavior?
The coverage should target the right file.
Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
OS: MacOS Sierra 10.12.5 (16F73)
Node: v7.10.0
Yarn: v0.24.6
Jest: v20.0.4
Jest configuration:
The text was updated successfully, but these errors were encountered: