Jest: TypeError: options.sourcesRelatedToTestsInChangedFiles.has is not a function

Created on 28 Apr 2020  路  6Comments  路  Source: facebook/jest

馃悰 Bug Report

After upgrading to 25.5.0, started seeing an error in Watch mode.

To Reproduce

Run jest as jest --watch, then update some test files. Sample error output:

    TypeError: options.sourcesRelatedToTestsInChangedFiles.has is not a function

      1 | import awsMock from 'aws-sdk-mock';
    > 2 | import {
        | ^
      3 |   asyncWrapper,
      4 |   getEnv,
      5 |   getS3Data,

      at shouldInstrument (node_modules/@jest/transform/build/shouldInstrument.js:191:54)
      at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:614:39)
      at Object.<anonymous> (test/lib/common.test.js:2:1)

envinfo

  System:
    OS: macOS 10.15.4
    CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
  Binaries:
    Node: 12.13.0 - ~/.nvm/versions/node/v12.13.0/bin/node
    Yarn: 1.22.4 - ~/.yarn/bin/yarn
    npm: 6.14.4 - ~/.nvm/versions/node/v12.13.0/bin/npm
  npmPackages:
    jest: ^25.5.0 => 25.5.0 

Regression Needs Triage

Most helpful comment

Fixed in 25.5.1

All 6 comments

Probably from #9769, /cc @chenesan

Yeah, seems like it. If I set collectCoverage: false (I was using lcov), then the errors go away.

I'm guessing we're missing serialization and deserialization

https://github.com/facebook/jest/blob/d425a49bd575e7167bc786f3c4f2833589091fa1/packages/jest-runner/src/index.ts#L156-L161
https://github.com/facebook/jest/blob/d425a49bd575e7167bc786f3c4f2833589091fa1/packages/jest-runner/src/testWorker.ts#L89-L92

Ideally we'd somehow tell TS about it so it would have warned us, but for now we should just hotfix this so I can get a patch out. It's 23:30 here though, so I won't get to it until tomorrow.

I Will look into this tonight, though I'm in UTC+8 and it's 10:00 now here.

Fixed in 25.5.1

Thanks for the fix!

Was this page helpful?
0 / 5 - 0 ratings