-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
[Bug]: DataCloneError: Symbol(jest.asymmetricMatcher) could not be cloned using --workerThreads
.
#15078
Comments
Great... 😅 Not sure how we can deal with this properly 🤔 |
--workerThreads
.
To expand on this, it doesn't only seem to be an issue with jest symbols, but with anything that throws and can't be structurally cloned. For example if I run a test that calls axios and the test throws an Another side note; I don't seem to get this error with |
I just hit this too, but my output is: ● Test suite failed to run
DataCloneError: function () {
return fn.apply(this, arguments);
} could not be cloned.
at reportSuccess (node_modules/jest-worker/build/workers/threadChild.js:98:34) If I change my test to be like: test('blah', () => {
try {
// all test contents here
} catch (e) {
console.log(e);
}
}); I can actually get the real failure. Not a workaround by any means :( console.log
JestAssertionError: expect(received).toHaveBeenCalledOnce(expected)
Expected mock function to have been called exactly once, but it was called:
0 times
at Object.toHaveBeenCalledOnce (~/project/src/components/__tests__/Thing.test.tsx:86:25) {
matcherResult: {
pass: false,
message: 'expect(received).toHaveBeenCalledOnce(expected)\n' +
'\n' +
'Expected mock function to have been called exactly once, but it was called:\n' +
' 0 times',
actual: [Function: mockConstructor] {
_isMockFunction: true,
getMockImplementation: [Function (anonymous)],
mock: [Getter/Setter],
mockClear: [Function (anonymous)],
mockReset: [Function (anonymous)],
mockRestore: [Function (anonymous)],
mockReturnValueOnce: [Function (anonymous)],
mockResolvedValueOnce: [Function (anonymous)],
mockRejectedValueOnce: [Function (anonymous)],
mockReturnValue: [Function (anonymous)],
mockResolvedValue: [Function (anonymous)],
mockRejectedValue: [Function (anonymous)],
mockImplementationOnce: [Function (anonymous)],
withImplementation: [Function: bound withImplementation],
mockImplementation: [Function (anonymous)],
mockReturnThis: [Function (anonymous)],
mockName: [Function (anonymous)],
getMockName: [Function (anonymous)]
}
}
} |
Version
29.70
Steps to reproduce
Create a test with
expect.any
, or any other jest helpers that uses symbols.Run the test with worker threads:
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.
Additional context
No response
Environment
The text was updated successfully, but these errors were encountered: