Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chai-fs destroys any existing assertion handler for .with() #44

Open
bluepichu opened this issue Mar 7, 2018 · 0 comments
Open

chai-fs destroys any existing assertion handler for .with() #44

bluepichu opened this issue Mar 7, 2018 · 0 comments

Comments

@bluepichu
Copy link

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant