caffeinatedcm / chai-jest-mocks Goto Github PK
View Code? Open in Web Editor NEWChai plugin that adds assertions for jest mock functions
License: MIT License
Chai plugin that adds assertions for jest mock functions
License: MIT License
When my Jest config turns on automocking:
โ Test suite failed to run
TypeError: Cannot convert undefined or null to object
at Function.keys (<anonymous>)
7 |
8 | chai.use(require('chai-dom'));
> 9 | chai.use(require('chai-jest-mocks'));
| ^
10 | chai.use(require('chai-jest-snapshot'));
11 | chai.use(require('chai-jest-diff').default());
12 |
at node_modules/color-convert/index.js:68:27
at Array.forEach (<anonymous>)
at Object.<anonymous> (node_modules/color-convert/index.js:61:8)
at Object.<anonymous> (node_modules/chai-jest-mocks/lib/matchers/beenCalled.js:3:5)
at Object.<anonymous> (node_modules/chai-jest-mocks/lib/matchers/index.js:3:15)
at Object.<anonymous> (node_modules/chai-jest-mocks/lib/index.js:1:45)
at Object.require (test/lib/setup-jest-after-env.js:9:10)
at Array.forEach (<anonymous>)
Latest version of this lib, on latest OSX:
Lees-MacBook-Pro:app lee$ jest -v
24.8.0
Lees-MacBook-Pro:app lee$ node -v
v10.16.0
Lees-MacBook-Pro:app lee$ npm -v
6.9.2
Lees-MacBook-Pro:app lee$
Tests using the library currently fail when using Jest 27.
Example output with chai.expect(mockFn).to.have.beenCalled();
jestMock.isMockFunction is not a function
TypeError: jestMock.isMockFunction is not a function
at ensureMock (https://738by.csb.app/node_modules/chai-jest-mocks/lib/utils/ensureMock.js:15:17)
at Proxy.eval (https://738by.csb.app/node_modules/chai-jest-mocks/lib/matchers/beenCalled.js:13:7)
...
Sandbox here: https://codesandbox.io/s/nostalgic-hermann-738by?file=/jest.test.js
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.