Jest: Issue with version 24.3.0 using --changedSince flag

Created on 8 Mar 2019  Β·  12Comments  Β·  Source: facebook/jest

πŸ› 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 
Needs Repro Needs Triage

Most helpful comment

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

All 12 comments

Can you provide a repo with repro?

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?

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

Seems like something somewhere passes changedSince as an array instead of a Set? A reproduction would be awesome πŸ™‚

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)

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.

When will this be released?

@leonfs @KSXGitHub

v24.4.0 has been released

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

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

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

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/[email protected] /Users/philipp/node/dev/dh/sfa-api
β”œβ”€β”€ [email protected] 
β”œβ”€β”¬ [email protected] 
β”‚ └─┬ [email protected]
β”‚   └─┬ [email protected]
β”‚     └── [email protected]  deduped
└── [email protected] 

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 [email protected], which I am fairly certain that this is where it worked out fine before.

npm list jest jest-circus babel-jest                                    
@dh/[email protected] /Users/philipp/node/dev/dh/sfa-api
β”œβ”€β”€ [email protected] 
β”œβ”€β”€ [email protected] 
β”œβ”€β”€ [email protected] 
└─┬ [email protected]
  └─┬ [email protected]
    └── [email protected] 

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

Was this page helpful?
0 / 5 - 0 ratings