Skip to content

incorrect usage example in README #4

@catdad

Description

@catdad

The current usage example in github and npm, for the latest version v1.0.2, is:

const chai = require('chai')
const chaiJestDiff = require('chai-jest-diff')

chai.use(chaiJestDiff())

This code does not work and it throws:

  ● Test suite failed to run

    TypeError: _get__(...) is not a function

      3 | const chaiJestDiff = require('chai-jest-diff');
      4 |
    > 5 | chai.use(chaiJestDiff());
        |          ^
      6 | const { expect } = chai;

When using es module import in my code, this works:

import chai from 'chai';
import chaiJestDiff from 'chai-jest-diff';

const { expect } = chai;

chai.use(chaiJestDiff());

However, when using require like in the example in the readme, I need to do this:

const chai = require('chai');
const chaiJestDiff = require('chai-jest-diff');

chai.use(chaiJestDiff.default());
const { expect } = chai;

If nothing else, can the README please be updated so that others know how to use this module?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions