-
-
Notifications
You must be signed in to change notification settings - Fork 698
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
Inconsistent between API guide and message from assert.equal #790
Comments
@sbidolach Looks like a bug to me. it("expect equal with comment at start", () => {
expect(42, "meep").to.equal(43); // meep
});
it("expect equal with comment at end", () => {
expect(42).to.equal(43, "meep"); // meep
});
it("assert strictEqual", () => {
assert.strictEqual(42, 43, "meep"); // meep
});
it("assert equal", () => {
assert.equal(42, 43, "meep"); // AssertionError: meep: expected 42 to equal 43
}); |
Hi @sbidolach, thanks for the issue and thanks @meeber for writing some examples! 😄 When running tests like this: it("expect equal with comment at start", () => {
err(function() {
expect(42, "meep").to.equal(43);
}, 'meep')
});
it("expect equal with comment at end", () => {
err(function() {
expect(42).to.equal(43, "meep");
}, 'meep')
});
it("assert strictEqual", () => {
assert.strictEqual(42, 43, "meep");
err(function() {
assert.strictEqual(42, 43, "meep");
}, 'meep')
});
it("assert equal", () => {
err(function() {
assert.equal(42, 43, "meep");
}, 'meep')
}); Every single one fails and that is because the message really isn't just What makes Mocha show just This happens because instead of calling the assert.equal = function (act, exp, msg) {
var test = new Assertion(act, msg, assert.equal);
test.assert(
exp == flag(test, 'object')
, 'expected #{this} to equal #{exp}'
, 'expected #{this} to not equal #{act}'
, exp
, act
);
}; To this: assert.equal = function (act, exp, msg) {
var test = new Assertion(act, msg, assert.equal);
test.assert(
exp == flag(test, 'object')
, 'expected #{this} to equal #{exp}'
, 'expected #{this} to not equal #{act}'
, exp
, act
, true
);
}; Unfortunately there is no way we can test this, since this is a behavior of the test runner and it involves how it handles showing the test results, its not our own bug. |
…uals Enabling showDiff for assert's equal and notEqual methods. Closes #790
Could you verify why API guide says something different than message from exception ?
Guide:
Example:
The text was updated successfully, but these errors were encountered: