Git Product home page Git Product logo

chai-jest-mocks's People

Contributors

caffeinatedcm avatar dependabot[bot] avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

chai-jest-mocks's Issues

Fails with `automock: true`

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$

Support for Jest 27

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.