Comments (3)
Primitive types, except
symbol
.
Great... đ Not sure how we can deal with this properly đ¤
from jest.
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 AxiosError
, I get the same vague DataCloneError
.
Another side note; I don't seem to get this error with .toMatchObject
, since the error that throws doesn't contain the symbols that .toEqual
does.
from jest.
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)]
}
}
}
from jest.
Related Issues (20)
- [Bug]: jest.mock('package-name') does nothing HOT 1
- [Bug]: Mocking Partials (in with ES6 modules) doesn't work as per documentation HOT 5
- [Feature]: Expose all matchers as asymmetric matchers
- [Bug]: Add top level `endTime` when using --json reporter
- [Bug]: setupFiles exported function not called
- [Bug]: Console errors from jsdom when using newer css constructs like @container or @layer
- [Bug]: passWithNoTests flag ignored for empty test files
- [Bug]: Not able to access window in vm.runInContext HOT 5
- [Bug]: v30-alpha.5 TestPathPatterns pattern-match regression HOT 1
- ReferenceError: require is not defined HOT 1
- [Bug]: toThrow does not check error cause
- [Docs]: From v27 to v28 page is no longer accessible HOT 4
- [Feature]: Skip specific test before test HOT 2
- [Bug]: Jest rewrites snapshots without changes if obsolete entries exist, even if the `--updateSnapshot` flag is not passed.
- [Docs]: Documentation suggests the vite-jest library for vite compatibility, but vite-jest is obsolete and appears unmaintained. HOT 4
- [Bug]: Cannot mock new Date in async tests.
- [Bug]: Path in bin/jest.js file crash when there's a single "Single quote" in the path HOT 2
- [Feature]: Add config option "worker(Max)Retries" instead of hardcoded maxRetries: 3 in jest-runner đ
- can someone help me with Cannot use import statement outside a module please (âŦâŦīšâŦâŦ) HOT 2
- [Bug]: transform esm module in jest-runtime
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
đ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. đđđ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google â¤ī¸ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jest.