jest icon indicating copy to clipboard operation
jest copied to clipboard

[Bug]: DataCloneError: Symbol(jest.asymmetricMatcher) could not be cloned using `--workerThreads`.

Open VictorGlindasPaf opened this issue 9 months ago • 3 comments

Version

29.70

Steps to reproduce

Create a test with expect.any, or any other jest helpers that uses symbols.

it("works", () => {
  expect({}).toEqual({
    value1: 0,
    value2: expect.any(String),
  });
})

Run the test with worker threads:

jest --workerThreads --maxWorkers=50%

Expected behavior

I should get a regular test failure message, that actually tells me what expect is failing.

Actual behavior

I get an error that tells me next to nothing.

  ● Test suite failed to run

    DataCloneError: Symbol(jest.asymmetricMatcher) could not be cloned.

      at reportSuccess (../../node_modules/jest-worker/build/workers/threadChild.js:99:34)

Seed:        1878439832
Test Suites: 1 failed, 1 total

Additional context

No response

Environment

System:
    OS: macOS 14.0
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  Binaries:
    Node: 20.10.0 - ~/.nvm/versions/node/v20.10.0/bin/node
    Yarn: 3.5.1 - ~/.nvm/versions/node/v20.10.0/bin/yarn
    npm: 10.2.3 - ~/.nvm/versions/node/v20.10.0/bin/npm
  npmPackages:
    jest: ^29.7.0 => 29.7.0

VictorGlindasPaf avatar May 21 '24 13:05 VictorGlindasPaf