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

Issue with version 24.3.0 using --changedSince flag #8084

Closed
fakiolinho opened this issue Mar 8, 2019 · 13 comments · Fixed by #8090
Closed

Issue with version 24.3.0 using --changedSince flag #8084

fakiolinho opened this issue Mar 8, 2019 · 13 comments · Fixed by #8090

Comments

@fakiolinho
Copy link

🐛 Bug Report

I am using Babel 7 and Jest 24. After upgrading to v24.3.0 i have issues with command:

jest --config ./jest.config.json --changedSince=develop

The error i get is this:

ERROR: options.changedFiles.has is not a function
STACK: TypeError: options.changedFiles.has is not a function
    at shouldInstrument (/node_modules/@jest/transform/build/shouldInstrument.js:142:53)
    at _default (/node_modules/@jest/reporters/build/generateEmptyCoverage.js:56:41)
    at Object.worker (/node_modules/@jest/reporters/build/coverage_worker.js:80:45)
    at execFunction (/node_modules/jest-worker/build/workers/processChild.js:155:17)
    at execHelper (/node_modules/jest-worker/build/workers/processChild.js:139:5)
    at execMethod (/node_modules/jest-worker/build/workers/processChild.js:143:5)
    at process.on.request (/node_modules/jest-worker/build/workers/processChild.js:64:7)
    at process.emit (events.js:189:13)
    at emit (internal/child_process.js:820:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
Failed to collect coverage from /Header/index.jsx

If i don't use the --changedSince flag at all then tests run smoothly.

In order to tackle this now i am using resolutions in package.json:

"resolutions": {
    "jest": "24.1.0",
    "jest-cli": "24.1.0",
    "jest-config": "24.1.0",
    "babel-jest": "24.1.0"
}

To Reproduce

Add in package.json:

"babel-jest": "^24.3.0",
"jest": "^24.3.0",

and then clear everything with rm -rf node_modules yarn.lock and then install the new ones with yarn

Finally run jest with --changedSince flag:

jest --changedSince=develop

Expected behavior

Jest tests should not fail and run flawlessly

Link to repl or repo (highly encouraged)


Run npx envinfo --preset jest

Paste the results here:

System:
    OS: macOS 10.14
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
  Binaries:
    Node: 10.15.1 - /usr/local/opt/node@10/bin/node
    Yarn: 1.3.2 - ~/.yarn/bin/yarn
    npm: 6.4.1 - /usr/local/opt/node@10/bin/npm
  npmPackages:
    jest: ^24.3.0 => 24.3.1 
@thymikee
Copy link
Collaborator

thymikee commented Mar 8, 2019

Can you provide a repo with repro?

@fakiolinho
Copy link
Author

Sorry @thymikee i cannot really share the original repo itself. Do you want me to create a dead simple one with a couple jest tests for 24.3.0 version? Would that be of any help?

@thymikee
Copy link
Collaborator

thymikee commented Mar 8, 2019

Yep, a minimal reproduction with only what's necessary :)

@SimenB
Copy link
Member

SimenB commented Mar 8, 2019

Seems like something somewhere passes changedSince as an array instead of a Set? A reproduction would be awesome 🙂

@SimenB
Copy link
Member

SimenB commented Mar 8, 2019

Ah, wait. I know. Options here are serialized, and the Set is lost: https://github.com/facebook/jest/blob/afe22419327d2470bab9187e10fa153e2056bed9/packages/jest-reporters/src/coverage_reporter.ts#L173

Wanna send a PR? 😀

I think the correct solution is to pass this as an array. You can do Array.from(set)

@leonfs
Copy link

leonfs commented Mar 11, 2019

Is there a date on when is this going to be released? Not being able to watch tests if coverage is enabled is quite a pain.

@KSXGitHub
Copy link

KSXGitHub commented Mar 11, 2019

When will this be released?

@robdonn
Copy link

robdonn commented Mar 11, 2019

@leonfs @KSXGitHub

v24.4.0 has been released

(BTW, fix worked perfectly for me. Thanks @thymikee )

@yoshicarroll
Copy link

v24.4.0 does not fix #8088.
watch is still broken.

@robdonn
Copy link

robdonn commented Mar 11, 2019

Not saying that this will fix the issue for others but it’s what I did and it worked for me:

  • Deleted node_modules folder
  • Deleted yarn.lock file
  • Updated versions of Jest packages to 24.4.0 in package.json
  • Ran yarn install

gargleyark added a commit to gargleyark/skylark-mick-georgy that referenced this issue Mar 12, 2019
@philiiiiiipp
Copy link
Contributor

philiiiiiipp commented Mar 12, 2019

Not sure if this is the correct place to post this, but I am also still seeing the #8088

I did delete node_modules and reinstalled jest + jest-circus to the latest version 24.4.0

npm list jest jest-circus babel-jest
@dh/sfa-api@0.0.99 /Users/philipp/node/dev/dh/sfa-api
├── babel-jest@24.4.0 
├─┬ jest@24.4.0 
│ └─┬ jest-cli@24.4.0
│   └─┬ jest-config@24.4.0
│     └── babel-jest@24.4.0  deduped
└── jest-circus@24.4.0 

I also installed watchman and tried running it with that but it just seem to hang while running it with --no-watchman just fails with:

2019-03-12 09:55 node[16317] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2019-03-12 09:55 node[16317] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2019-03-12 09:55 node[16317] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
Error: Error watching file for changes: EMFILE
    at FSEvent.FSWatcher._handle.onchange (fs.js:1359:9)

I am running OSX 10.14.3 and saw the same issue on another mac as well.

EDIT

I am now also seing the issue on jest@24.1.0, which I am fairly certain that this is where it worked out fine before.

npm list jest jest-circus babel-jest                                    
@dh/sfa-api@0.0.99 /Users/philipp/node/dev/dh/sfa-api
├── babel-jest@24.1.0 
├── jest@24.1.0 
├── jest-circus@24.1.0 
└─┬ jest-cli@24.1.0
  └─┬ jest-config@24.4.0
    └── babel-jest@24.4.0 

@arb
Copy link

arb commented Mar 12, 2019

Would it be possible to reopen #8088 as it appears it is still a problem even after the 24.4.0 upgrade?

@github-actions
Copy link

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.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants