Tape: Error messages for notEqual and notDeepEqual never display the expected value.

Created on 21 Dec 2018  Â·  5Comments  Â·  Source: substack/tape

Any failing tests with t.notEqual or t.notDeepEqual always show the expected value as undefined because they return a result with a notExpected property (which is totally ignored) instead of the expected property which _assert actually looks at.

All 5 comments

Can you provide specific repro code?

Oh, sorry. I wasn't sure it was worth including a one-liner. Actually, since you guys clearly don't care about the quality of your error output at all, I wasn't sure if anyone would even respond. Here's a full reproduction (and a pull request which brings it inline with notDeepLooseEqual).

const test = require('tape')

// Note that both of these failures say "expected: undefined"
test('notEqual error', (t) => {t.plan(1); t.notEqual(3, 3)})
test('notDeepEqual error', (t) => {t.plan(1); t.notDeepEqual(3, 3)})

// This one, on the other hand, says:
//    operator: notDeepLooseEqual
//    expected: 3
//    actual:   3
test('notDeepLooseEqual', (t) => {t.plan(1); t.notDeepLooseEqual(3, 3)})

Wow, there's really no need to be hostile - we care about the quality of our error output very much.

If you have a six-year-old test harness code base where nobody has ever manually inspected the output of notEqual and notDeepEqual with an expected value other than undefined, then in practice you absolutely don't care about the quality of your error output at all, no matter what you might like to tell yourself. Talk is cheap.

Again, no need to be hostile. If you never wrote your code incorrectly such that you saw that error output, how would you know it’s quality wasn’t up to snuff? As for this codebase, humans make mistakes - and that has zero bearing on “what they care about”.

Hostile talk is very expensive; please conduct yourself appropriately and professionally.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

callumlocke picture callumlocke  Â·  4Comments

vasiliicuhar picture vasiliicuhar  Â·  7Comments

mkermani144 picture mkermani144  Â·  6Comments

ralphtheninja picture ralphtheninja  Â·  6Comments

javajosh picture javajosh  Â·  5Comments