diff --git a/lib/assert.js b/lib/assert.js index 5d5477071..849b4a1eb 100644 --- a/lib/assert.js +++ b/lib/assert.js @@ -8,8 +8,10 @@ import {SnapshotError, VersionMismatchError} from './snapshot-manager.js'; function formatDescriptorDiff(actualDescriptor, expectedDescriptor, options) { options = {...options, ...concordanceOptions}; + const {diffGutters} = options.theme; + const {insertLine, deleteLine} = options.theme.string.diff; return { - label: 'Difference:', + label: `Difference (${diffGutters.actual}${deleteLine.open}actual${deleteLine.close}, ${diffGutters.expected}${insertLine.open}expected${insertLine.close}):`, formatted: concordance.diffDescriptors(actualDescriptor, expectedDescriptor, options), }; } diff --git a/lib/code-excerpt.js b/lib/code-excerpt.js index ca9ab0586..a46d012eb 100644 --- a/lib/code-excerpt.js +++ b/lib/code-excerpt.js @@ -43,7 +43,7 @@ export default function exceptCode(source, options = {}) { const coloredLineNumber = isErrorSource ? lineNumber : chalk.grey(lineNumber); const result = ` ${coloredLineNumber} ${item.value.padEnd(extendedWidth)}`; - return isErrorSource ? chalk.bgRed(result) : result; + return isErrorSource ? chalk.bgRed.bold(result) : result; }) .join('\n'); } diff --git a/lib/concordance-options.js b/lib/concordance-options.js index 48a367054..3e5fbf4be 100644 --- a/lib/concordance-options.js +++ b/lib/concordance-options.js @@ -85,7 +85,7 @@ const colorTheme = { undefined: ansiStyles.yellow, }; -const plainTheme = JSON.parse(JSON.stringify(colorTheme), value => typeof value === 'string' ? stripAnsi(value) : value); +const plainTheme = JSON.parse(JSON.stringify(colorTheme), (_name, value) => typeof value === 'string' ? stripAnsi(value) : value); const theme = chalk.level > 0 ? colorTheme : plainTheme; diff --git a/lib/reporters/default.js b/lib/reporters/default.js index 8a612deef..c1250151b 100644 --- a/lib/reporters/default.js +++ b/lib/reporters/default.js @@ -244,9 +244,9 @@ export default class Reporter { case 'selected-test': { if (event.skip) { - this.lineWriter.writeLine(colors.skip(`- ${this.prefixTitle(event.testFile, event.title)}`)); + this.lineWriter.writeLine(colors.skip(`- [skip] ${this.prefixTitle(event.testFile, event.title)}`)); } else if (event.todo) { - this.lineWriter.writeLine(colors.todo(`- ${this.prefixTitle(event.testFile, event.title)}`)); + this.lineWriter.writeLine(colors.todo(`- [todo] ${this.prefixTitle(event.testFile, event.title)}`)); } break; @@ -504,15 +504,30 @@ export default class Reporter { } writeTestSummary(event) { + // Prefix icon indicates matched expectations vs. not. + // Prefix color indicates passed-as-expected vs. not (fail or unexpected pass). + // This yields four possibilities, which in the standard configuration render as: + // * normal test, pass: + // * normal test, fail: ✘ [fail] + // * fail-expected test, fail: ✔ [expected fail] + // * fail-expected test, pass: ✘ [unexpected pass] + let prefix; + let suffix; if (event.type === 'hook-failed' || event.type === 'test-failed') { - this.write(`${colors.error(figures.cross)} ${this.prefixTitle(event.testFile, event.title)} ${colors.error(event.err.message)}`); + const type = event.knownFailing ? '[unexpected pass]' : '[fail]'; + prefix = colors.error(`${figures.cross} ${type}:`); + suffix = chalk.italic(colors.error(event.err.message)); } else if (event.knownFailing) { - this.write(`${colors.error(figures.tick)} ${colors.error(this.prefixTitle(event.testFile, event.title))}`); + prefix = colors.error(figures.tick + ' [expected fail]'); } else { - const duration = event.duration > this.durationThreshold ? colors.duration(' (' + prettyMs(event.duration) + ')') : ''; - this.write(`${colors.pass(figures.tick)} ${this.prefixTitle(event.testFile, event.title)}${duration}`); + prefix = colors.pass(figures.tick); + if (event.duration > this.durationThreshold) { + suffix = colors.duration(`(${prettyMs(event.duration)})`); + } } + const label = this.prefixTitle(event.testFile, event.title); + this.write(`${prefix} ${label}${suffix ? ' ' + suffix : ''}`); this.writeLogs(event); } diff --git a/lib/reporters/tap.js b/lib/reporters/tap.js index 51a55cdb6..852243eec 100644 --- a/lib/reporters/tap.js +++ b/lib/reporters/tap.js @@ -29,7 +29,7 @@ function dumpError(error) { } if (error.values.length > 0) { - object.values = Object.fromEntries(error.values.map(({label, formatted}) => [label, stripAnsi(formatted)])); + object.values = Object.fromEntries(error.values.map(({label, formatted}) => [stripAnsi(label), stripAnsi(formatted)])); } } diff --git a/test-tap/assert.js b/test-tap/assert.js index d4c0b369c..48ab73d2b 100644 --- a/test-tap/assert.js +++ b/test-tap/assert.js @@ -56,7 +56,7 @@ function assertFailure(t, subset) { if (subset.values) { t.equal(lastFailure.values.length, subset.values.length); for (const [i, s] of lastFailure.values.entries()) { - t.equal(s.label, subset.values[i].label); + t.equal(stripAnsi(s.label), subset.values[i].label); t.match(stripAnsi(s.formatted), subset.values[i].formatted); } } else { @@ -279,7 +279,7 @@ test('.is()', t => { message: '', raw: {actual: 'foo', expected: 'bar'}, values: [ - {label: 'Difference:', formatted: /- 'foo'\n\+ 'bar'/}, + {label: 'Difference (- actual, + expected):', formatted: /- 'foo'\n\+ 'bar'/}, ], }); @@ -289,7 +289,7 @@ test('.is()', t => { expected: 42, message: '', values: [ - {label: 'Difference:', formatted: /- 'foo'\n\+ 42/}, + {label: 'Difference (- actual, + expected):', formatted: /- 'foo'\n\+ 42/}, ], }); @@ -297,7 +297,7 @@ test('.is()', t => { assertion: 'is', message: 'my message', values: [ - {label: 'Difference:', formatted: /- 'foo'\n\+ 42/}, + {label: 'Difference (- actual, + expected):', formatted: /- 'foo'\n\+ 42/}, ], }); @@ -305,7 +305,7 @@ test('.is()', t => { assertion: 'is', message: 'my message', values: [ - {label: 'Difference:', formatted: /- 0\n\+ -0/}, + {label: 'Difference (- actual, + expected):', formatted: /- 0\n\+ -0/}, ], }); @@ -313,7 +313,7 @@ test('.is()', t => { assertion: 'is', message: 'my message', values: [ - {label: 'Difference:', formatted: /- -0\n\+ 0/}, + {label: 'Difference (- actual, + expected):', formatted: /- -0\n\+ 0/}, ], }); @@ -535,20 +535,20 @@ test('.deepEqual()', t => { assertion: 'deepEqual', message: '', raw: {actual: 'foo', expected: 'bar'}, - values: [{label: 'Difference:', formatted: /- 'foo'\n\+ 'bar'/}], + values: [{label: 'Difference (- actual, + expected):', formatted: /- 'foo'\n\+ 'bar'/}], }); failsWith(t, () => assertions.deepEqual('foo', 42), { assertion: 'deepEqual', message: '', raw: {actual: 'foo', expected: 42}, - values: [{label: 'Difference:', formatted: /- 'foo'\n\+ 42/}], + values: [{label: 'Difference (- actual, + expected):', formatted: /- 'foo'\n\+ 42/}], }); failsWith(t, () => assertions.deepEqual('foo', 42, 'my message'), { assertion: 'deepEqual', message: 'my message', - values: [{label: 'Difference:', formatted: /- 'foo'\n\+ 42/}], + values: [{label: 'Difference (- actual, + expected):', formatted: /- 'foo'\n\+ 42/}], }); failsWith(t, () => assertions.deepEqual({}, {}, null), { @@ -758,7 +758,7 @@ test('.like()', t => { failsWith(t, () => assertions.like({a: 'foo', b: 'irrelevant'}, {a: 'bar'}), { assertion: 'like', message: '', - values: [{label: 'Difference:', formatted: /{\n-\s*a: 'foo',\n\+\s*a: 'bar',\n\s*}/}], + values: [{label: 'Difference (- actual, + expected):', formatted: /{\n-\s*a: 'foo',\n\+\s*a: 'bar',\n\s*}/}], }); t.end(); @@ -1429,7 +1429,7 @@ test('.snapshot()', async t => { failsWith(t, () => assertions.snapshot({foo: 'not bar'}), { assertion: 'snapshot', message: 'Did not match snapshot', - values: [{label: 'Difference:', formatted: ' {\n- foo: \'not bar\',\n+ foo: \'bar\',\n }'}], + values: [{label: 'Difference (- actual, + expected):', formatted: ' {\n- foo: \'not bar\',\n+ foo: \'bar\',\n }'}], }); } @@ -1442,7 +1442,7 @@ test('.snapshot()', async t => { failsWith(t, () => assertions.snapshot({foo: 'not bar'}, 'my message'), { assertion: 'snapshot', message: 'my message', - values: [{label: 'Difference:', formatted: ' {\n- foo: \'not bar\',\n+ foo: \'bar\',\n }'}], + values: [{label: 'Difference (- actual, + expected):', formatted: ' {\n- foo: \'not bar\',\n+ foo: \'bar\',\n }'}], }); } diff --git a/test-tap/code-excerpt.js b/test-tap/code-excerpt.js index 57e12fa67..1e06bbd5c 100644 --- a/test-tap/code-excerpt.js +++ b/test-tap/code-excerpt.js @@ -22,7 +22,7 @@ test('read code excerpt', t => { const excerpt = codeExcerpt({file, line: 2, isWithinProject: true, isDependency: false}); const expected = [ ` ${chalk.grey('1:')} function a() {`, - chalk.bgRed(' 2: alert(); '), + chalk.bgRed.bold(' 2: alert(); '), ` ${chalk.grey('3:')} } `, ].join('\n'); @@ -40,7 +40,7 @@ test('truncate lines', t => { const excerpt = codeExcerpt({file, line: 2, isWithinProject: true, isDependency: false}, {maxWidth: 14}); const expected = [ ` ${chalk.grey('1:')} functio…`, - chalk.bgRed(' 2: alert…'), + chalk.bgRed.bold(' 2: alert…'), ` ${chalk.grey('3:')} } `, ].join('\n'); @@ -66,7 +66,7 @@ test('format line numbers', t => { const excerpt = codeExcerpt({file, line: 10, isWithinProject: true, isDependency: false}); const expected = [ ` ${chalk.grey(' 9:')} function a() {`, - chalk.bgRed(' 10: alert(); '), + chalk.bgRed.bold(' 10: alert(); '), ` ${chalk.grey('11:')} } `, ].join('\n'); diff --git a/test-tap/reporters/default.edgecases.v14.log b/test-tap/reporters/default.edgecases.v14.log index e935849f2..489c5d133 100644 --- a/test-tap/reporters/default.edgecases.v14.log +++ b/test-tap/reporters/default.edgecases.v14.log @@ -20,7 +20,7 @@ import-and-use-test-member.cjs:3 2: -  3: test('pass', t => t.pass()); +  3: test('pass', t => t.pass()); 4: TypeError: test is not a function @@ -39,7 +39,7 @@ throws.cjs:1 -  1: throw new Error('throws'); +  1: throw new Error('throws'); 2: Error: throws diff --git a/test-tap/reporters/default.edgecases.v16.log b/test-tap/reporters/default.edgecases.v16.log index e935849f2..489c5d133 100644 --- a/test-tap/reporters/default.edgecases.v16.log +++ b/test-tap/reporters/default.edgecases.v16.log @@ -20,7 +20,7 @@ import-and-use-test-member.cjs:3 2: -  3: test('pass', t => t.pass()); +  3: test('pass', t => t.pass()); 4: TypeError: test is not a function @@ -39,7 +39,7 @@ throws.cjs:1 -  1: throw new Error('throws'); +  1: throw new Error('throws'); 2: Error: throws diff --git a/test-tap/reporters/default.edgecases.v18.log b/test-tap/reporters/default.edgecases.v18.log index e9c93adda..b3c1b8057 100644 --- a/test-tap/reporters/default.edgecases.v18.log +++ b/test-tap/reporters/default.edgecases.v18.log @@ -24,7 +24,7 @@ import-and-use-test-member.cjs:3 2: -  3: test('pass', t => t.pass()); +  3: test('pass', t => t.pass()); 4: TypeError: test is not a function @@ -43,7 +43,7 @@ throws.cjs:1 -  1: throw new Error('throws'); +  1: throw new Error('throws'); 2: Error: throws diff --git a/test-tap/reporters/default.failfast.v14.log b/test-tap/reporters/default.failfast.v14.log index 51a209534..1822d26dd 100644 --- a/test-tap/reporters/default.failfast.v14.log +++ b/test-tap/reporters/default.failfast.v14.log @@ -1,6 +1,6 @@ ---tty-stream-chunk-separator - ✘ a › fails Test failed via `t.fail()` + ✘ [fail]: a › fails Test failed via `t.fail()` ---tty-stream-chunk-separator ─ @@ -9,7 +9,7 @@ a.cjs:3 2: -  3: test('fails', t => t.fail()); +  3: test('fails', t => t.fail()); 4: Test failed via `t.fail()` diff --git a/test-tap/reporters/default.failfast.v16.log b/test-tap/reporters/default.failfast.v16.log index 51a209534..1822d26dd 100644 --- a/test-tap/reporters/default.failfast.v16.log +++ b/test-tap/reporters/default.failfast.v16.log @@ -1,6 +1,6 @@ ---tty-stream-chunk-separator - ✘ a › fails Test failed via `t.fail()` + ✘ [fail]: a › fails Test failed via `t.fail()` ---tty-stream-chunk-separator ─ @@ -9,7 +9,7 @@ a.cjs:3 2: -  3: test('fails', t => t.fail()); +  3: test('fails', t => t.fail()); 4: Test failed via `t.fail()` diff --git a/test-tap/reporters/default.failfast.v18.log b/test-tap/reporters/default.failfast.v18.log index 51a209534..1822d26dd 100644 --- a/test-tap/reporters/default.failfast.v18.log +++ b/test-tap/reporters/default.failfast.v18.log @@ -1,6 +1,6 @@ ---tty-stream-chunk-separator - ✘ a › fails Test failed via `t.fail()` + ✘ [fail]: a › fails Test failed via `t.fail()` ---tty-stream-chunk-separator ─ @@ -9,7 +9,7 @@ a.cjs:3 2: -  3: test('fails', t => t.fail()); +  3: test('fails', t => t.fail()); 4: Test failed via `t.fail()` diff --git a/test-tap/reporters/default.failfast2.v14.log b/test-tap/reporters/default.failfast2.v14.log index 9fd21bbee..29437d029 100644 --- a/test-tap/reporters/default.failfast2.v14.log +++ b/test-tap/reporters/default.failfast2.v14.log @@ -1,6 +1,6 @@ ---tty-stream-chunk-separator - ✘ a › fails Test failed via `t.fail()` + ✘ [fail]: a › fails Test failed via `t.fail()` ---tty-stream-chunk-separator ─ @@ -9,7 +9,7 @@ a.cjs:3 2: -  3: test('fails', t => t.fail());  +  3: test('fails', t => t.fail());  4: test('passes', t => t.pass()); Test failed via `t.fail()` diff --git a/test-tap/reporters/default.failfast2.v16.log b/test-tap/reporters/default.failfast2.v16.log index 9fd21bbee..29437d029 100644 --- a/test-tap/reporters/default.failfast2.v16.log +++ b/test-tap/reporters/default.failfast2.v16.log @@ -1,6 +1,6 @@ ---tty-stream-chunk-separator - ✘ a › fails Test failed via `t.fail()` + ✘ [fail]: a › fails Test failed via `t.fail()` ---tty-stream-chunk-separator ─ @@ -9,7 +9,7 @@ a.cjs:3 2: -  3: test('fails', t => t.fail());  +  3: test('fails', t => t.fail());  4: test('passes', t => t.pass()); Test failed via `t.fail()` diff --git a/test-tap/reporters/default.failfast2.v18.log b/test-tap/reporters/default.failfast2.v18.log index 9fd21bbee..29437d029 100644 --- a/test-tap/reporters/default.failfast2.v18.log +++ b/test-tap/reporters/default.failfast2.v18.log @@ -1,6 +1,6 @@ ---tty-stream-chunk-separator - ✘ a › fails Test failed via `t.fail()` + ✘ [fail]: a › fails Test failed via `t.fail()` ---tty-stream-chunk-separator ─ @@ -9,7 +9,7 @@ a.cjs:3 2: -  3: test('fails', t => t.fail());  +  3: test('fails', t => t.fail());  4: test('passes', t => t.pass()); Test failed via `t.fail()` diff --git a/test-tap/reporters/default.regular.v14.log b/test-tap/reporters/default.regular.v14.log index de3e4e73d..9b9a969d3 100644 --- a/test-tap/reporters/default.regular.v14.log +++ b/test-tap/reporters/default.regular.v14.log @@ -5,7 +5,7 @@ bad-test-chain.cjs:3 2: -  3: test.serial.test('passes', t => t.pass()); +  3: test.serial.test('passes', t => t.pass()); 4: TypeError: test.serial.test is not a function @@ -15,9 +15,9 @@ ---tty-stream-chunk-separator ✘ bad-test-chain.cjs exited with a non-zero exit code: 1 ---tty-stream-chunk-separator - ✘ nested-objects › format with max depth 4 + ✘ [fail]: nested-objects › format with max depth 4 ---tty-stream-chunk-separator - ✘ nested-objects › format like with max depth 4 + ✘ [fail]: nested-objects › format like with max depth 4 ---tty-stream-chunk-separator output-in-hook › before hook ℹ before @@ -30,7 +30,7 @@ ---tty-stream-chunk-separator ✔ output-in-hook › passing test ---tty-stream-chunk-separator - ✘ output-in-hook › failing test Test failed via `t.fail()` + ✘ [fail]: output-in-hook › failing test Test failed via `t.fail()` ---tty-stream-chunk-separator output-in-hook › afterEach hook for passing test ℹ afterEach @@ -44,35 +44,35 @@ output-in-hook › cleanup ℹ afterAlways ---tty-stream-chunk-separator - - test › skip + - [skip] test › skip ---tty-stream-chunk-separator - - test › todo + - [todo] test › todo ---tty-stream-chunk-separator ✔ test › passes ---tty-stream-chunk-separator - ✘ test › fails Test failed via `t.fail()` + ✘ [fail]: test › fails Test failed via `t.fail()` ---tty-stream-chunk-separator - ✔ test › known failure + ✔ [expected fail] test › known failure ---tty-stream-chunk-separator - ✘ test › no longer failing Test was expected to fail, but succeeded, you should stop marking the test as failing + ✘ [unexpected pass]: test › no longer failing Test was expected to fail, but succeeded, you should stop marking the test as failing ---tty-stream-chunk-separator - ✘ test › logs Test failed via `t.fail()` + ✘ [fail]: test › logs Test failed via `t.fail()` ℹ hello ℹ world ---tty-stream-chunk-separator - ✘ test › formatted + ✘ [fail]: test › formatted ---tty-stream-chunk-separator - ✘ test › implementation throws non-error Error thrown in test + ✘ [fail]: test › implementation throws non-error Error thrown in test ---tty-stream-chunk-separator - ✘ traces-in-t-throws › throws + ✘ [fail]: traces-in-t-throws › throws ---tty-stream-chunk-separator - ✘ traces-in-t-throws › notThrows + ✘ [fail]: traces-in-t-throws › notThrows ---tty-stream-chunk-separator - ✘ traces-in-t-throws › notThrowsAsync + ✘ [fail]: traces-in-t-throws › notThrowsAsync ---tty-stream-chunk-separator - ✘ traces-in-t-throws › throwsAsync + ✘ [fail]: traces-in-t-throws › throwsAsync ---tty-stream-chunk-separator - ✘ traces-in-t-throws › throwsAsync different error + ✘ [fail]: traces-in-t-throws › throwsAsync different error ---tty-stream-chunk-separator ✔ uncaught-exception › passes ---tty-stream-chunk-separator @@ -82,7 +82,7 @@ uncaught-exception.cjs:5 4: setImmediate(() => { -  5: throw new Error('Can’t catch me'); +  5: throw new Error('Can’t catch me'); 6: }); Error: Can’t catch me @@ -102,7 +102,7 @@ unhandled-rejection.cjs:4 3: const passes = t => { -  4: Promise.reject(new Error('Can’t catch me')); +  4: Promise.reject(new Error('Can’t catch me')); 5: t.pass(); Error: Can’t catch me @@ -122,10 +122,10 @@ nested-objects.cjs:29 28: }; -  29: t.deepEqual(exp, act); +  29: t.deepEqual(exp, act); 30: }); - Difference: + Difference (- actual, + expected): { a: { @@ -151,10 +151,10 @@ nested-objects.cjs:55 54: }; -  55: t.like(actual, pattern); +  55: t.like(actual, pattern); 56: }); - Difference: + Difference (- actual, + expected): { a: { @@ -174,7 +174,7 @@ output-in-hook.cjs:34 33: test('failing test', t => { -  34: t.fail();  +  34: t.fail();  35: }); Test failed via `t.fail()` @@ -188,7 +188,7 @@ test.cjs:9 8: -  9: test('fails', t => t.fail()); +  9: test('fails', t => t.fail()); 10: Test failed via `t.fail()` @@ -207,7 +207,7 @@ test.cjs:18 17: t.log('world'); -  18: t.fail();  +  18: t.fail();  19: }); Test failed via `t.fail()` @@ -221,10 +221,10 @@ test.cjs:22 21: test('formatted', t => { -  22: t.deepEqual('foo', 'bar'); +  22: t.deepEqual('foo', 'bar'); 23: }); - Difference: + Difference (- actual, + expected): - 'foo' + 'bar' @@ -246,7 +246,7 @@ traces-in-t-throws.cjs:12 11: test('throws', t => { -  12: t.throws(() => throwError(), {instanceOf: TypeError}); +  12: t.throws(() => throwError(), {instanceOf: TypeError}); 13: }); Function threw unexpected exception: @@ -270,7 +270,7 @@ traces-in-t-throws.cjs:16 15: test('notThrows', t => { -  16: t.notThrows(() => throwError()); +  16: t.notThrows(() => throwError()); 17: }); Function threw: @@ -290,7 +290,7 @@ traces-in-t-throws.cjs:20 19: test('notThrowsAsync', t => { -  20: t.notThrowsAsync(() => throwError()); +  20: t.notThrowsAsync(() => throwError()); 21: }); Function threw: @@ -310,7 +310,7 @@ traces-in-t-throws.cjs:24 23: test('throwsAsync', t => { -  24: t.throwsAsync(() => throwError(), {instanceOf: TypeError}); +  24: t.throwsAsync(() => throwError(), {instanceOf: TypeError}); 25: }); Function threw synchronously. Use `t.throws()` instead: @@ -330,7 +330,7 @@ traces-in-t-throws.cjs:27 26: -  27: test('throwsAsync different error', t => t.throwsAsync(returnRejectedPromise, {instanceOf: TypeError})); +  27: test('throwsAsync different error', t => t.throwsAsync(returnRejectedPromise, {instanceOf: TypeError})); 28: Returned promise rejected with unexpected exception: diff --git a/test-tap/reporters/default.regular.v16.log b/test-tap/reporters/default.regular.v16.log index de3e4e73d..9b9a969d3 100644 --- a/test-tap/reporters/default.regular.v16.log +++ b/test-tap/reporters/default.regular.v16.log @@ -5,7 +5,7 @@ bad-test-chain.cjs:3 2: -  3: test.serial.test('passes', t => t.pass()); +  3: test.serial.test('passes', t => t.pass()); 4: TypeError: test.serial.test is not a function @@ -15,9 +15,9 @@ ---tty-stream-chunk-separator ✘ bad-test-chain.cjs exited with a non-zero exit code: 1 ---tty-stream-chunk-separator - ✘ nested-objects › format with max depth 4 + ✘ [fail]: nested-objects › format with max depth 4 ---tty-stream-chunk-separator - ✘ nested-objects › format like with max depth 4 + ✘ [fail]: nested-objects › format like with max depth 4 ---tty-stream-chunk-separator output-in-hook › before hook ℹ before @@ -30,7 +30,7 @@ ---tty-stream-chunk-separator ✔ output-in-hook › passing test ---tty-stream-chunk-separator - ✘ output-in-hook › failing test Test failed via `t.fail()` + ✘ [fail]: output-in-hook › failing test Test failed via `t.fail()` ---tty-stream-chunk-separator output-in-hook › afterEach hook for passing test ℹ afterEach @@ -44,35 +44,35 @@ output-in-hook › cleanup ℹ afterAlways ---tty-stream-chunk-separator - - test › skip + - [skip] test › skip ---tty-stream-chunk-separator - - test › todo + - [todo] test › todo ---tty-stream-chunk-separator ✔ test › passes ---tty-stream-chunk-separator - ✘ test › fails Test failed via `t.fail()` + ✘ [fail]: test › fails Test failed via `t.fail()` ---tty-stream-chunk-separator - ✔ test › known failure + ✔ [expected fail] test › known failure ---tty-stream-chunk-separator - ✘ test › no longer failing Test was expected to fail, but succeeded, you should stop marking the test as failing + ✘ [unexpected pass]: test › no longer failing Test was expected to fail, but succeeded, you should stop marking the test as failing ---tty-stream-chunk-separator - ✘ test › logs Test failed via `t.fail()` + ✘ [fail]: test › logs Test failed via `t.fail()` ℹ hello ℹ world ---tty-stream-chunk-separator - ✘ test › formatted + ✘ [fail]: test › formatted ---tty-stream-chunk-separator - ✘ test › implementation throws non-error Error thrown in test + ✘ [fail]: test › implementation throws non-error Error thrown in test ---tty-stream-chunk-separator - ✘ traces-in-t-throws › throws + ✘ [fail]: traces-in-t-throws › throws ---tty-stream-chunk-separator - ✘ traces-in-t-throws › notThrows + ✘ [fail]: traces-in-t-throws › notThrows ---tty-stream-chunk-separator - ✘ traces-in-t-throws › notThrowsAsync + ✘ [fail]: traces-in-t-throws › notThrowsAsync ---tty-stream-chunk-separator - ✘ traces-in-t-throws › throwsAsync + ✘ [fail]: traces-in-t-throws › throwsAsync ---tty-stream-chunk-separator - ✘ traces-in-t-throws › throwsAsync different error + ✘ [fail]: traces-in-t-throws › throwsAsync different error ---tty-stream-chunk-separator ✔ uncaught-exception › passes ---tty-stream-chunk-separator @@ -82,7 +82,7 @@ uncaught-exception.cjs:5 4: setImmediate(() => { -  5: throw new Error('Can’t catch me'); +  5: throw new Error('Can’t catch me'); 6: }); Error: Can’t catch me @@ -102,7 +102,7 @@ unhandled-rejection.cjs:4 3: const passes = t => { -  4: Promise.reject(new Error('Can’t catch me')); +  4: Promise.reject(new Error('Can’t catch me')); 5: t.pass(); Error: Can’t catch me @@ -122,10 +122,10 @@ nested-objects.cjs:29 28: }; -  29: t.deepEqual(exp, act); +  29: t.deepEqual(exp, act); 30: }); - Difference: + Difference (- actual, + expected): { a: { @@ -151,10 +151,10 @@ nested-objects.cjs:55 54: }; -  55: t.like(actual, pattern); +  55: t.like(actual, pattern); 56: }); - Difference: + Difference (- actual, + expected): { a: { @@ -174,7 +174,7 @@ output-in-hook.cjs:34 33: test('failing test', t => { -  34: t.fail();  +  34: t.fail();  35: }); Test failed via `t.fail()` @@ -188,7 +188,7 @@ test.cjs:9 8: -  9: test('fails', t => t.fail()); +  9: test('fails', t => t.fail()); 10: Test failed via `t.fail()` @@ -207,7 +207,7 @@ test.cjs:18 17: t.log('world'); -  18: t.fail();  +  18: t.fail();  19: }); Test failed via `t.fail()` @@ -221,10 +221,10 @@ test.cjs:22 21: test('formatted', t => { -  22: t.deepEqual('foo', 'bar'); +  22: t.deepEqual('foo', 'bar'); 23: }); - Difference: + Difference (- actual, + expected): - 'foo' + 'bar' @@ -246,7 +246,7 @@ traces-in-t-throws.cjs:12 11: test('throws', t => { -  12: t.throws(() => throwError(), {instanceOf: TypeError}); +  12: t.throws(() => throwError(), {instanceOf: TypeError}); 13: }); Function threw unexpected exception: @@ -270,7 +270,7 @@ traces-in-t-throws.cjs:16 15: test('notThrows', t => { -  16: t.notThrows(() => throwError()); +  16: t.notThrows(() => throwError()); 17: }); Function threw: @@ -290,7 +290,7 @@ traces-in-t-throws.cjs:20 19: test('notThrowsAsync', t => { -  20: t.notThrowsAsync(() => throwError()); +  20: t.notThrowsAsync(() => throwError()); 21: }); Function threw: @@ -310,7 +310,7 @@ traces-in-t-throws.cjs:24 23: test('throwsAsync', t => { -  24: t.throwsAsync(() => throwError(), {instanceOf: TypeError}); +  24: t.throwsAsync(() => throwError(), {instanceOf: TypeError}); 25: }); Function threw synchronously. Use `t.throws()` instead: @@ -330,7 +330,7 @@ traces-in-t-throws.cjs:27 26: -  27: test('throwsAsync different error', t => t.throwsAsync(returnRejectedPromise, {instanceOf: TypeError})); +  27: test('throwsAsync different error', t => t.throwsAsync(returnRejectedPromise, {instanceOf: TypeError})); 28: Returned promise rejected with unexpected exception: diff --git a/test-tap/reporters/default.regular.v18.log b/test-tap/reporters/default.regular.v18.log index de3e4e73d..9b9a969d3 100644 --- a/test-tap/reporters/default.regular.v18.log +++ b/test-tap/reporters/default.regular.v18.log @@ -5,7 +5,7 @@ bad-test-chain.cjs:3 2: -  3: test.serial.test('passes', t => t.pass()); +  3: test.serial.test('passes', t => t.pass()); 4: TypeError: test.serial.test is not a function @@ -15,9 +15,9 @@ ---tty-stream-chunk-separator ✘ bad-test-chain.cjs exited with a non-zero exit code: 1 ---tty-stream-chunk-separator - ✘ nested-objects › format with max depth 4 + ✘ [fail]: nested-objects › format with max depth 4 ---tty-stream-chunk-separator - ✘ nested-objects › format like with max depth 4 + ✘ [fail]: nested-objects › format like with max depth 4 ---tty-stream-chunk-separator output-in-hook › before hook ℹ before @@ -30,7 +30,7 @@ ---tty-stream-chunk-separator ✔ output-in-hook › passing test ---tty-stream-chunk-separator - ✘ output-in-hook › failing test Test failed via `t.fail()` + ✘ [fail]: output-in-hook › failing test Test failed via `t.fail()` ---tty-stream-chunk-separator output-in-hook › afterEach hook for passing test ℹ afterEach @@ -44,35 +44,35 @@ output-in-hook › cleanup ℹ afterAlways ---tty-stream-chunk-separator - - test › skip + - [skip] test › skip ---tty-stream-chunk-separator - - test › todo + - [todo] test › todo ---tty-stream-chunk-separator ✔ test › passes ---tty-stream-chunk-separator - ✘ test › fails Test failed via `t.fail()` + ✘ [fail]: test › fails Test failed via `t.fail()` ---tty-stream-chunk-separator - ✔ test › known failure + ✔ [expected fail] test › known failure ---tty-stream-chunk-separator - ✘ test › no longer failing Test was expected to fail, but succeeded, you should stop marking the test as failing + ✘ [unexpected pass]: test › no longer failing Test was expected to fail, but succeeded, you should stop marking the test as failing ---tty-stream-chunk-separator - ✘ test › logs Test failed via `t.fail()` + ✘ [fail]: test › logs Test failed via `t.fail()` ℹ hello ℹ world ---tty-stream-chunk-separator - ✘ test › formatted + ✘ [fail]: test › formatted ---tty-stream-chunk-separator - ✘ test › implementation throws non-error Error thrown in test + ✘ [fail]: test › implementation throws non-error Error thrown in test ---tty-stream-chunk-separator - ✘ traces-in-t-throws › throws + ✘ [fail]: traces-in-t-throws › throws ---tty-stream-chunk-separator - ✘ traces-in-t-throws › notThrows + ✘ [fail]: traces-in-t-throws › notThrows ---tty-stream-chunk-separator - ✘ traces-in-t-throws › notThrowsAsync + ✘ [fail]: traces-in-t-throws › notThrowsAsync ---tty-stream-chunk-separator - ✘ traces-in-t-throws › throwsAsync + ✘ [fail]: traces-in-t-throws › throwsAsync ---tty-stream-chunk-separator - ✘ traces-in-t-throws › throwsAsync different error + ✘ [fail]: traces-in-t-throws › throwsAsync different error ---tty-stream-chunk-separator ✔ uncaught-exception › passes ---tty-stream-chunk-separator @@ -82,7 +82,7 @@ uncaught-exception.cjs:5 4: setImmediate(() => { -  5: throw new Error('Can’t catch me'); +  5: throw new Error('Can’t catch me'); 6: }); Error: Can’t catch me @@ -102,7 +102,7 @@ unhandled-rejection.cjs:4 3: const passes = t => { -  4: Promise.reject(new Error('Can’t catch me')); +  4: Promise.reject(new Error('Can’t catch me')); 5: t.pass(); Error: Can’t catch me @@ -122,10 +122,10 @@ nested-objects.cjs:29 28: }; -  29: t.deepEqual(exp, act); +  29: t.deepEqual(exp, act); 30: }); - Difference: + Difference (- actual, + expected): { a: { @@ -151,10 +151,10 @@ nested-objects.cjs:55 54: }; -  55: t.like(actual, pattern); +  55: t.like(actual, pattern); 56: }); - Difference: + Difference (- actual, + expected): { a: { @@ -174,7 +174,7 @@ output-in-hook.cjs:34 33: test('failing test', t => { -  34: t.fail();  +  34: t.fail();  35: }); Test failed via `t.fail()` @@ -188,7 +188,7 @@ test.cjs:9 8: -  9: test('fails', t => t.fail()); +  9: test('fails', t => t.fail()); 10: Test failed via `t.fail()` @@ -207,7 +207,7 @@ test.cjs:18 17: t.log('world'); -  18: t.fail();  +  18: t.fail();  19: }); Test failed via `t.fail()` @@ -221,10 +221,10 @@ test.cjs:22 21: test('formatted', t => { -  22: t.deepEqual('foo', 'bar'); +  22: t.deepEqual('foo', 'bar'); 23: }); - Difference: + Difference (- actual, + expected): - 'foo' + 'bar' @@ -246,7 +246,7 @@ traces-in-t-throws.cjs:12 11: test('throws', t => { -  12: t.throws(() => throwError(), {instanceOf: TypeError}); +  12: t.throws(() => throwError(), {instanceOf: TypeError}); 13: }); Function threw unexpected exception: @@ -270,7 +270,7 @@ traces-in-t-throws.cjs:16 15: test('notThrows', t => { -  16: t.notThrows(() => throwError()); +  16: t.notThrows(() => throwError()); 17: }); Function threw: @@ -290,7 +290,7 @@ traces-in-t-throws.cjs:20 19: test('notThrowsAsync', t => { -  20: t.notThrowsAsync(() => throwError()); +  20: t.notThrowsAsync(() => throwError()); 21: }); Function threw: @@ -310,7 +310,7 @@ traces-in-t-throws.cjs:24 23: test('throwsAsync', t => { -  24: t.throwsAsync(() => throwError(), {instanceOf: TypeError}); +  24: t.throwsAsync(() => throwError(), {instanceOf: TypeError}); 25: }); Function threw synchronously. Use `t.throws()` instead: @@ -330,7 +330,7 @@ traces-in-t-throws.cjs:27 26: -  27: test('throwsAsync different error', t => t.throwsAsync(returnRejectedPromise, {instanceOf: TypeError})); +  27: test('throwsAsync different error', t => t.throwsAsync(returnRejectedPromise, {instanceOf: TypeError})); 28: Returned promise rejected with unexpected exception: diff --git a/test-tap/reporters/tap.regular.v14.log b/test-tap/reporters/tap.regular.v14.log index c0379a149..3fd8b13c2 100644 --- a/test-tap/reporters/tap.regular.v14.log +++ b/test-tap/reporters/tap.regular.v14.log @@ -14,7 +14,7 @@ not ok 3 - nested-objects › format with max depth 4 name: AssertionError assertion: deepEqual values: - 'Difference:': |2- + 'Difference (- actual, + expected):': |2- { a: { b: { @@ -37,7 +37,7 @@ not ok 4 - nested-objects › format like with max depth 4 name: AssertionError assertion: like values: - 'Difference:': |2- + 'Difference (- actual, + expected):': |2- { a: { b: { @@ -129,7 +129,7 @@ not ok 14 - test › formatted name: AssertionError assertion: deepEqual values: - 'Difference:': |- + 'Difference (- actual, + expected):': |- - 'foo' + 'bar' at: 'test-tap/fixture/report/regular/test.cjs:22:4' diff --git a/test-tap/reporters/tap.regular.v16.log b/test-tap/reporters/tap.regular.v16.log index c0379a149..3fd8b13c2 100644 --- a/test-tap/reporters/tap.regular.v16.log +++ b/test-tap/reporters/tap.regular.v16.log @@ -14,7 +14,7 @@ not ok 3 - nested-objects › format with max depth 4 name: AssertionError assertion: deepEqual values: - 'Difference:': |2- + 'Difference (- actual, + expected):': |2- { a: { b: { @@ -37,7 +37,7 @@ not ok 4 - nested-objects › format like with max depth 4 name: AssertionError assertion: like values: - 'Difference:': |2- + 'Difference (- actual, + expected):': |2- { a: { b: { @@ -129,7 +129,7 @@ not ok 14 - test › formatted name: AssertionError assertion: deepEqual values: - 'Difference:': |- + 'Difference (- actual, + expected):': |- - 'foo' + 'bar' at: 'test-tap/fixture/report/regular/test.cjs:22:4' diff --git a/test-tap/reporters/tap.regular.v18.log b/test-tap/reporters/tap.regular.v18.log index c0379a149..3fd8b13c2 100644 --- a/test-tap/reporters/tap.regular.v18.log +++ b/test-tap/reporters/tap.regular.v18.log @@ -14,7 +14,7 @@ not ok 3 - nested-objects › format with max depth 4 name: AssertionError assertion: deepEqual values: - 'Difference:': |2- + 'Difference (- actual, + expected):': |2- { a: { b: { @@ -37,7 +37,7 @@ not ok 4 - nested-objects › format like with max depth 4 name: AssertionError assertion: like values: - 'Difference:': |2- + 'Difference (- actual, + expected):': |2- { a: { b: { @@ -129,7 +129,7 @@ not ok 14 - test › formatted name: AssertionError assertion: deepEqual values: - 'Difference:': |- + 'Difference (- actual, + expected):': |- - 'foo' + 'bar' at: 'test-tap/fixture/report/regular/test.cjs:22:4' diff --git a/test-tap/test.js b/test-tap/test.js index c1c89b457..e5014dbfe 100644 --- a/test-tap/test.js +++ b/test-tap/test.js @@ -213,7 +213,7 @@ test('fails with the first assertError', t => ava(a => { t.equal(result.passed, false); t.equal(result.error.name, 'AssertionError'); t.equal(result.error.values.length, 1); - t.equal(result.error.values[0].label, 'Difference:'); + t.equal(result.error.values[0].label, 'Difference (- actual, + expected):'); t.match(result.error.values[0].formatted, /- 1\n\+ 2/); }));