chai-fs
chai-fs copied to clipboard
`chai-fs` destroys any existing assertion handler for `.with()`
In my case, this is causing issues with chai-spies
. For example, this passes fine:
let spies = require("chai-spies");
let fs = require("chai-fs");
let chai = require("chai");
chai.use(fs).use(spies);
let { spy, expect } = chai;
it("should still let me use chai-spies' .with() assertions", async () => {
let fn = spy((arg) => arg + 1);
let x = fn(2);
expect(x).to.equal(3);
expect(fn).to.have.been.called.once;
expect(fn).to.have.been.called.with(2);
});
But this fails:
let spies = require("chai-spies");
let fs = require("chai-fs");
let chai = require("chai");
chai.use(spies).use(fs); // <--- the only change is the order on this line
let { spy, expect } = chai;
it("should still let me use chai-spies' .with() assertions", async () => {
let fn = spy((arg) => arg + 1);
let x = fn(2);
expect(x).to.equal(3);
expect(fn).to.have.been.called.once;
expect(fn).to.have.been.called.with(2);
});
Output:
1) should still let me use chai-spies' .with() assertions:
TypeError: expect(...).to.have.been.called.with is not a function
at Context.it (spec.js:18:37)