Here's a minimal illustration in Mocha:
var expect = require("expect.js");
describe("", function() {
specify("", function() {
var y = expect({ a : 1, b : 2 });
y.to.have.property("a", 1); // This is OK.
y.to.have.property("b", 2); // Mocha outputs "Error: expected 1
// to have a property 'b'".
});
});
I'm reusing expect's return value. Why is expect.js expecting 1 to have a property b?
The issue seems to be with .to.have.property, as using other assertions works fine:
var x = expect(1);
x.to.be.equal(1); // This is OK.
x.to.not.be.equal(0); // This is OK too.