From 6e1dbb94a64c3151c41778d4b8a902ee7290d54e Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Sat, 6 Aug 2022 14:25:31 -0400 Subject: [PATCH 01/13] Explain diff gutter symbols Fixes #1558 --- lib/assert.js | 4 +++- lib/concordance-options.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) 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/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; From 1c9263047b30913f33dd7d1a806e9d6ec6e67ea0 Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Sat, 6 Aug 2022 14:58:20 -0400 Subject: [PATCH 02/13] Add test result labels Color covers figure and label, and indicates passed-as-expected vs. not (expected/unexpected fail or unexpected pass). Fixes #2919 --- lib/reporters/default.js | 13 ++++++++----- test/snapshot-tests/snapshots/formatting.js.md | 6 +++--- .../snapshot-tests/snapshots/formatting.js.snap | Bin 565 -> 574 bytes 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/reporters/default.js b/lib/reporters/default.js index 8a612deef..88a503d9a 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,13 +504,16 @@ export default class Reporter { } writeTestSummary(event) { + // Icon indicates matched expectations vs. not. + // Color indicates passed-as-expected vs. not (expected/unexpected fail or unexpected pass). 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 description = event.knownFailing ? 'UNEXPECTED PASS' : 'FAIL'; + this.write(`${colors.error(`${figures.cross} ${description}:`)} ${this.prefixTitle(event.testFile, event.title)} ${colors.error(event.err.message)}`); } else if (event.knownFailing) { - this.write(`${colors.error(figures.tick)} ${colors.error(this.prefixTitle(event.testFile, event.title))}`); + this.write(`${colors.error(figures.tick + ' EXPECTED FAIL:')} ${this.prefixTitle(event.testFile, event.title)}`); } 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}`); + this.write(`${colors.pass(figures.tick + ' PASS:')} ${this.prefixTitle(event.testFile, event.title)}${duration}`); } this.writeLogs(event); diff --git a/test/snapshot-tests/snapshots/formatting.js.md b/test/snapshot-tests/snapshots/formatting.js.md index 076bf4f82..ef58e6c35 100644 --- a/test/snapshot-tests/snapshots/formatting.js.md +++ b/test/snapshot-tests/snapshots/formatting.js.md @@ -31,9 +31,9 @@ Generated by [AVA](https://avajs.dev). > stdout `␊ - √ a rather wordy test title that is wrapped to meet line length requirements in an unconventional way that may interfere with report formatting␊ - √ test title␊ - √ multiline try assertion title␊ + √ PASS: a rather wordy test title that is wrapped to meet line length requirements in an unconventional way that may interfere with report formatting␊ + √ PASS: test title␊ + √ PASS: multiline try assertion title␊ i multiline try assertion title ─ try assertions can have titles too␊ ─␊ ␊ diff --git a/test/snapshot-tests/snapshots/formatting.js.snap b/test/snapshot-tests/snapshots/formatting.js.snap index 35cca5ff8ccaabb995764b93ccf2ca5c6a9dde87..a24e736969dd3eae723c105adae923a0ea9b5ad9 100644 GIT binary patch literal 574 zcmV-E0>S-3RzV0X=b}Kdt-&u3VV))^#i@K2Gduc0Dui&3ogotEDo@d-wSQNs_{o zXL+eeDyb2i7KO_Uff7qpz+tIUSR$;9%>@yrkQi$*Ayt9YKpBF?!dQ|`srz)1rh>$~ zessHcx93m)PVfG$AH4xAn)ac_cZHbH(RA(ND0T9pQk{^Q%j#5+JB>2mY;Ilqcxjg#@Ml00000000BUQax`IK@hb;2(cYyx~J`v(Av&obysXHOcgO^M0%iUV&H2h7bLcBtQ zP6k!88V>gl_K!w6QR$!U?#iWPV1~;v;|7C{aHS{*3Ej-is6y;Pk|YZ*^QluM@%Ly9 zFZSS&Zx4pAQENM#H1~Jb>FiPSaWq|6Wk$mZ49Af{2;dX(6Ieq9Hcd`;9Qx4L9Cv!6 z6>S#dFd{Vf4fjoOU#rt-gQv_^w;BF?%kW8`rCfda%EPipIXYNbm({S*fpXb6ymGQE znVc*Xh@5`o3z}oL%HgLIpnF<+}g3!&;VKll6I;;;5 zzSh)rNpw*BrQWwAMLPegd0&xUpvXCbAhjR+5AD9B<$ z^XP4x#^b+9V;#edJl_AeLq#D|XaBM8k9+ Date: Sat, 6 Aug 2022 15:15:32 -0400 Subject: [PATCH 03/13] Bold the source line of errors in code excerpts --- lib/code-excerpt.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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'); } From ef1986755ff18b692b5cc3f80750c403782655f9 Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Sat, 6 Aug 2022 18:18:52 -0400 Subject: [PATCH 04/13] DRY out writeTestSummary --- lib/reporters/default.js | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/lib/reporters/default.js b/lib/reporters/default.js index 88a503d9a..b2af8fbfc 100644 --- a/lib/reporters/default.js +++ b/lib/reporters/default.js @@ -504,18 +504,30 @@ export default class Reporter { } writeTestSummary(event) { - // Icon indicates matched expectations vs. not. - // Color indicates passed-as-expected vs. not (expected/unexpected fail or unexpected pass). + // 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: ✔ 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') { - const description = event.knownFailing ? 'UNEXPECTED PASS' : 'FAIL'; - this.write(`${colors.error(`${figures.cross} ${description}:`)} ${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 = colors.error(event.err.message); } else if (event.knownFailing) { - this.write(`${colors.error(figures.tick + ' EXPECTED FAIL:')} ${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 + ' PASS:')} ${this.prefixTitle(event.testFile, event.title)}${duration}`); + prefix = colors.pass(figures.tick + ' PASS:'); + 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); } From 017a45a905c99cb4e8fe75e84e83b56a96f21262 Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Sat, 6 Aug 2022 22:41:20 -0400 Subject: [PATCH 05/13] Better propagate color configuration --- lib/chalk.js | 8 ++++++++ lib/cli.js | 2 +- lib/concordance-options.js | 12 ++++++++---- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/lib/chalk.js b/lib/chalk.js index eca6d4267..8431fbfce 100644 --- a/lib/chalk.js +++ b/lib/chalk.js @@ -1,3 +1,5 @@ +import {EventEmitter} from 'node:events'; + import {Chalk} from 'chalk'; // eslint-disable-line unicorn/import-style let chalk = new Chalk(); // eslint-disable-line import/no-mutable-exports @@ -5,6 +7,9 @@ let chalk = new Chalk(); // eslint-disable-line import/no-mutable-exports export {chalk}; let configured = false; +const events = new EventEmitter(); +const on = events.on.bind(events); +const emit = events.emit.bind(events); export function set(options) { if (configured) { throw new Error('Chalk has already been configured'); @@ -12,4 +17,7 @@ export function set(options) { configured = true; chalk = new Chalk(options); + emit('set', chalk); } + +export {on}; diff --git a/lib/cli.js b/lib/cli.js index a4c89ac09..5052ac32a 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -223,7 +223,7 @@ export default async function loadCli() { // eslint-disable-line complexity const combined = {...conf}; - for (const flag of Object.keys(FLAGS)) { + for (const flag of ['color', ...Object.keys(FLAGS)]) { if (flag === 'no-worker-threads' && Reflect.has(argv, 'worker-threads')) { combined.workerThreads = argv['worker-threads']; continue; diff --git a/lib/concordance-options.js b/lib/concordance-options.js index 3e5fbf4be..21768f306 100644 --- a/lib/concordance-options.js +++ b/lib/concordance-options.js @@ -4,7 +4,7 @@ import ansiStyles from 'ansi-styles'; import {Chalk} from 'chalk'; // eslint-disable-line unicorn/import-style import stripAnsi from 'strip-ansi'; -import {chalk} from './chalk.js'; +import {chalk, on as onChalkEvent} from './chalk.js'; const forceColor = new Chalk({level: Math.max(chalk.level, 1)}); @@ -87,15 +87,19 @@ const colorTheme = { const plainTheme = JSON.parse(JSON.stringify(colorTheme), (_name, value) => typeof value === 'string' ? stripAnsi(value) : value); -const theme = chalk.level > 0 ? colorTheme : plainTheme; - const concordanceOptions = { // Use Node's object inspection depth, clamped to a minimum of 3 get maxDepth() { return Math.max(3, inspect.defaultOptions.depth); }, - theme, + theme: undefined, }; +function setTheme(chalk) { + concordanceOptions.theme = chalk.level > 0 ? colorTheme : plainTheme; +} + +setTheme(chalk); +onChalkEvent('set', setTheme); export default concordanceOptions; From 49fbe2467146680fd0aaa0372d12b6df085dcec0 Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Sun, 7 Aug 2022 02:46:32 -0400 Subject: [PATCH 06/13] TAP reporter: Strip ANSI control sequences from error labels --- lib/reporters/tap.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)])); } } From f1beca28efb03398e9adaf685b5d880c811f797a Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Sun, 7 Aug 2022 01:13:25 -0400 Subject: [PATCH 07/13] Update tests --- test-tap/assert.js | 27 ++++--- test-tap/code-excerpt.js | 6 +- test-tap/reporters/default.edgecases.v14.log | 4 +- test-tap/reporters/default.edgecases.v16.log | 4 +- test-tap/reporters/default.edgecases.v18.log | 4 +- test-tap/reporters/default.failfast.v14.log | 4 +- test-tap/reporters/default.failfast.v16.log | 4 +- test-tap/reporters/default.failfast.v18.log | 4 +- test-tap/reporters/default.failfast2.v14.log | 4 +- test-tap/reporters/default.failfast2.v16.log | 4 +- test-tap/reporters/default.failfast2.v18.log | 4 +- test-tap/reporters/default.only.v14.log | 4 +- test-tap/reporters/default.only.v16.log | 4 +- test-tap/reporters/default.only.v18.log | 4 +- test-tap/reporters/default.regular.v14.log | 76 +++++++++---------- test-tap/reporters/default.regular.v16.log | 76 +++++++++---------- test-tap/reporters/default.regular.v18.log | 76 +++++++++---------- .../default.timeoutinmultiplefiles.v14.log | 8 +- .../default.timeoutinmultiplefiles.v16.log | 8 +- .../default.timeoutinmultiplefiles.v18.log | 8 +- .../default.timeoutinsinglefile.v14.log | 4 +- .../default.timeoutinsinglefile.v16.log | 4 +- .../default.timeoutinsinglefile.v18.log | 4 +- .../default.timeoutwithmatch.v14.log | 2 +- .../default.timeoutwithmatch.v16.log | 2 +- .../default.timeoutwithmatch.v18.log | 2 +- test-tap/reporters/default.watch.v14.log | 6 +- test-tap/reporters/default.watch.v16.log | 6 +- test-tap/reporters/default.watch.v18.log | 6 +- test-tap/reporters/tap.regular.v14.log | 6 +- test-tap/reporters/tap.regular.v16.log | 6 +- test-tap/reporters/tap.regular.v18.log | 6 +- test-tap/test-try-commit.js | 5 +- test-tap/test.js | 2 +- 34 files changed, 200 insertions(+), 194 deletions(-) diff --git a/test-tap/assert.js b/test-tap/assert.js index d4c0b369c..3cfebf276 100644 --- a/test-tap/assert.js +++ b/test-tap/assert.js @@ -5,10 +5,13 @@ import stripAnsi from 'strip-ansi'; import {test} from 'tap'; import * as assert from '../lib/assert.js'; +import {set as setChalk} from '../lib/chalk.js'; import * as snapshotManager from '../lib/snapshot-manager.js'; import {set as setOptions} from '../lib/worker/options.cjs'; -setOptions({chalkOptions: {level: 0}}); +const options = {chalkOptions: {level: 0}}; +setOptions(options); +setChalk(options.chalkOptions); let lastFailure = null; let lastPassed = false; @@ -279,7 +282,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 +292,7 @@ test('.is()', t => { expected: 42, message: '', values: [ - {label: 'Difference:', formatted: /- 'foo'\n\+ 42/}, + {label: 'Difference (- actual, + expected):', formatted: /- 'foo'\n\+ 42/}, ], }); @@ -297,7 +300,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 +308,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 +316,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 +538,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 +761,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 +1432,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 +1445,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 47a58d804..689ab3d14 100644 --- a/test-tap/reporters/default.edgecases.v14.log +++ b/test-tap/reporters/default.edgecases.v14.log @@ -30,7 +30,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 @@ -49,7 +49,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 47a58d804..689ab3d14 100644 --- a/test-tap/reporters/default.edgecases.v16.log +++ b/test-tap/reporters/default.edgecases.v16.log @@ -30,7 +30,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 @@ -49,7 +49,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 83bd6a2aa..2151e3034 100644 --- a/test-tap/reporters/default.edgecases.v18.log +++ b/test-tap/reporters/default.edgecases.v18.log @@ -30,7 +30,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 @@ -49,7 +49,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 831e81f6c..3dcaddc39 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 831e81f6c..3dcaddc39 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 831e81f6c..3dcaddc39 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 22d9cd398..09e722dfe 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 22d9cd398..09e722dfe 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 22d9cd398..09e722dfe 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.only.v14.log b/test-tap/reporters/default.only.v14.log index f01706e56..0fd225f5a 100644 --- a/test-tap/reporters/default.only.v14.log +++ b/test-tap/reporters/default.only.v14.log @@ -1,8 +1,8 @@ ---tty-stream-chunk-separator - ✔ a › only + ✔ PASS: a › only ---tty-stream-chunk-separator - ✔ b › passes + ✔ PASS: b › passes ---tty-stream-chunk-separator ─ diff --git a/test-tap/reporters/default.only.v16.log b/test-tap/reporters/default.only.v16.log index f01706e56..0fd225f5a 100644 --- a/test-tap/reporters/default.only.v16.log +++ b/test-tap/reporters/default.only.v16.log @@ -1,8 +1,8 @@ ---tty-stream-chunk-separator - ✔ a › only + ✔ PASS: a › only ---tty-stream-chunk-separator - ✔ b › passes + ✔ PASS: b › passes ---tty-stream-chunk-separator ─ diff --git a/test-tap/reporters/default.only.v18.log b/test-tap/reporters/default.only.v18.log index f01706e56..0fd225f5a 100644 --- a/test-tap/reporters/default.only.v18.log +++ b/test-tap/reporters/default.only.v18.log @@ -1,8 +1,8 @@ ---tty-stream-chunk-separator - ✔ a › only + ✔ PASS: a › only ---tty-stream-chunk-separator - ✔ b › passes + ✔ PASS: b › passes ---tty-stream-chunk-separator ─ diff --git a/test-tap/reporters/default.regular.v14.log b/test-tap/reporters/default.regular.v14.log index aafc12bfb..6c6cd0c4e 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 @@ -28,9 +28,9 @@ output-in-hook › beforeEach hook for failing test ℹ beforeEach ---tty-stream-chunk-separator - ✔ output-in-hook › passing test + ✔ PASS: 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,37 +44,37 @@ 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 + ✔ PASS: 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 + ✔ PASS: uncaught-exception › passes ---tty-stream-chunk-separator Uncaught exception in uncaught-exception.cjs @@ -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 @@ -92,9 +92,9 @@ ---tty-stream-chunk-separator ✖ uncaught-exception.cjs exited with a non-zero exit code: 1 ---tty-stream-chunk-separator - ✔ unhandled-rejection › passes + ✔ PASS: unhandled-rejection › passes ---tty-stream-chunk-separator - ✔ unhandled-rejection › unhandled non-error rejection + ✔ PASS: unhandled-rejection › unhandled non-error rejection ---tty-stream-chunk-separator Unhandled rejection in unhandled-rejection.cjs @@ -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 aafc12bfb..6c6cd0c4e 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 @@ -28,9 +28,9 @@ output-in-hook › beforeEach hook for failing test ℹ beforeEach ---tty-stream-chunk-separator - ✔ output-in-hook › passing test + ✔ PASS: 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,37 +44,37 @@ 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 + ✔ PASS: 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 + ✔ PASS: uncaught-exception › passes ---tty-stream-chunk-separator Uncaught exception in uncaught-exception.cjs @@ -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 @@ -92,9 +92,9 @@ ---tty-stream-chunk-separator ✖ uncaught-exception.cjs exited with a non-zero exit code: 1 ---tty-stream-chunk-separator - ✔ unhandled-rejection › passes + ✔ PASS: unhandled-rejection › passes ---tty-stream-chunk-separator - ✔ unhandled-rejection › unhandled non-error rejection + ✔ PASS: unhandled-rejection › unhandled non-error rejection ---tty-stream-chunk-separator Unhandled rejection in unhandled-rejection.cjs @@ -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 aafc12bfb..6c6cd0c4e 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 @@ -28,9 +28,9 @@ output-in-hook › beforeEach hook for failing test ℹ beforeEach ---tty-stream-chunk-separator - ✔ output-in-hook › passing test + ✔ PASS: 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,37 +44,37 @@ 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 + ✔ PASS: 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 + ✔ PASS: uncaught-exception › passes ---tty-stream-chunk-separator Uncaught exception in uncaught-exception.cjs @@ -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 @@ -92,9 +92,9 @@ ---tty-stream-chunk-separator ✖ uncaught-exception.cjs exited with a non-zero exit code: 1 ---tty-stream-chunk-separator - ✔ unhandled-rejection › passes + ✔ PASS: unhandled-rejection › passes ---tty-stream-chunk-separator - ✔ unhandled-rejection › unhandled non-error rejection + ✔ PASS: unhandled-rejection › unhandled non-error rejection ---tty-stream-chunk-separator Unhandled rejection in unhandled-rejection.cjs @@ -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.timeoutinmultiplefiles.v14.log b/test-tap/reporters/default.timeoutinmultiplefiles.v14.log index 16d1ddd6b..6789d9790 100644 --- a/test-tap/reporters/default.timeoutinmultiplefiles.v14.log +++ b/test-tap/reporters/default.timeoutinmultiplefiles.v14.log @@ -1,8 +1,8 @@ ---tty-stream-chunk-separator - ✔ a › a passes + ✔ PASS: a › a passes ---tty-stream-chunk-separator - ✔ a › a passes two + ✔ PASS: a › a passes two ---tty-stream-chunk-separator  ✖ Timed out while running tests @@ -13,9 +13,9 @@ ◌ a › a slow two ---tty-stream-chunk-separator - ✔ b › b passes + ✔ PASS: b › b passes ---tty-stream-chunk-separator - ✔ b › b passes two + ✔ PASS: b › b passes two ---tty-stream-chunk-separator  ✖ Timed out while running tests diff --git a/test-tap/reporters/default.timeoutinmultiplefiles.v16.log b/test-tap/reporters/default.timeoutinmultiplefiles.v16.log index 16d1ddd6b..6789d9790 100644 --- a/test-tap/reporters/default.timeoutinmultiplefiles.v16.log +++ b/test-tap/reporters/default.timeoutinmultiplefiles.v16.log @@ -1,8 +1,8 @@ ---tty-stream-chunk-separator - ✔ a › a passes + ✔ PASS: a › a passes ---tty-stream-chunk-separator - ✔ a › a passes two + ✔ PASS: a › a passes two ---tty-stream-chunk-separator  ✖ Timed out while running tests @@ -13,9 +13,9 @@ ◌ a › a slow two ---tty-stream-chunk-separator - ✔ b › b passes + ✔ PASS: b › b passes ---tty-stream-chunk-separator - ✔ b › b passes two + ✔ PASS: b › b passes two ---tty-stream-chunk-separator  ✖ Timed out while running tests diff --git a/test-tap/reporters/default.timeoutinmultiplefiles.v18.log b/test-tap/reporters/default.timeoutinmultiplefiles.v18.log index 16d1ddd6b..6789d9790 100644 --- a/test-tap/reporters/default.timeoutinmultiplefiles.v18.log +++ b/test-tap/reporters/default.timeoutinmultiplefiles.v18.log @@ -1,8 +1,8 @@ ---tty-stream-chunk-separator - ✔ a › a passes + ✔ PASS: a › a passes ---tty-stream-chunk-separator - ✔ a › a passes two + ✔ PASS: a › a passes two ---tty-stream-chunk-separator  ✖ Timed out while running tests @@ -13,9 +13,9 @@ ◌ a › a slow two ---tty-stream-chunk-separator - ✔ b › b passes + ✔ PASS: b › b passes ---tty-stream-chunk-separator - ✔ b › b passes two + ✔ PASS: b › b passes two ---tty-stream-chunk-separator  ✖ Timed out while running tests diff --git a/test-tap/reporters/default.timeoutinsinglefile.v14.log b/test-tap/reporters/default.timeoutinsinglefile.v14.log index 3c4830fb5..761c709f8 100644 --- a/test-tap/reporters/default.timeoutinsinglefile.v14.log +++ b/test-tap/reporters/default.timeoutinsinglefile.v14.log @@ -1,8 +1,8 @@ ---tty-stream-chunk-separator - ✔ passes + ✔ PASS: passes ---tty-stream-chunk-separator - ✔ passes two + ✔ PASS: passes two ---tty-stream-chunk-separator  ✖ Timed out while running tests diff --git a/test-tap/reporters/default.timeoutinsinglefile.v16.log b/test-tap/reporters/default.timeoutinsinglefile.v16.log index 3c4830fb5..761c709f8 100644 --- a/test-tap/reporters/default.timeoutinsinglefile.v16.log +++ b/test-tap/reporters/default.timeoutinsinglefile.v16.log @@ -1,8 +1,8 @@ ---tty-stream-chunk-separator - ✔ passes + ✔ PASS: passes ---tty-stream-chunk-separator - ✔ passes two + ✔ PASS: passes two ---tty-stream-chunk-separator  ✖ Timed out while running tests diff --git a/test-tap/reporters/default.timeoutinsinglefile.v18.log b/test-tap/reporters/default.timeoutinsinglefile.v18.log index 3c4830fb5..761c709f8 100644 --- a/test-tap/reporters/default.timeoutinsinglefile.v18.log +++ b/test-tap/reporters/default.timeoutinsinglefile.v18.log @@ -1,8 +1,8 @@ ---tty-stream-chunk-separator - ✔ passes + ✔ PASS: passes ---tty-stream-chunk-separator - ✔ passes two + ✔ PASS: passes two ---tty-stream-chunk-separator  ✖ Timed out while running tests diff --git a/test-tap/reporters/default.timeoutwithmatch.v14.log b/test-tap/reporters/default.timeoutwithmatch.v14.log index 2ed31ca03..072adb502 100644 --- a/test-tap/reporters/default.timeoutwithmatch.v14.log +++ b/test-tap/reporters/default.timeoutwithmatch.v14.log @@ -1,6 +1,6 @@ ---tty-stream-chunk-separator - ✔ passes needle + ✔ PASS: passes needle ---tty-stream-chunk-separator  ✖ Timed out while running tests diff --git a/test-tap/reporters/default.timeoutwithmatch.v16.log b/test-tap/reporters/default.timeoutwithmatch.v16.log index 2ed31ca03..072adb502 100644 --- a/test-tap/reporters/default.timeoutwithmatch.v16.log +++ b/test-tap/reporters/default.timeoutwithmatch.v16.log @@ -1,6 +1,6 @@ ---tty-stream-chunk-separator - ✔ passes needle + ✔ PASS: passes needle ---tty-stream-chunk-separator  ✖ Timed out while running tests diff --git a/test-tap/reporters/default.timeoutwithmatch.v18.log b/test-tap/reporters/default.timeoutwithmatch.v18.log index 2ed31ca03..072adb502 100644 --- a/test-tap/reporters/default.timeoutwithmatch.v18.log +++ b/test-tap/reporters/default.timeoutwithmatch.v18.log @@ -1,6 +1,6 @@ ---tty-stream-chunk-separator - ✔ passes needle + ✔ PASS: passes needle ---tty-stream-chunk-separator  ✖ Timed out while running tests diff --git a/test-tap/reporters/default.watch.v14.log b/test-tap/reporters/default.watch.v14.log index ae2dea44b..35ed5e9c2 100644 --- a/test-tap/reporters/default.watch.v14.log +++ b/test-tap/reporters/default.watch.v14.log @@ -1,6 +1,6 @@ ---tty-stream-chunk-separator - ✔ test › passes + ✔ PASS: test › passes ---tty-stream-chunk-separator ─ @@ -11,7 +11,7 @@ ---tty-stream-chunk-separator ---tty-stream-chunk-separator - ✔ test › passes + ✔ PASS: test › passes ---tty-stream-chunk-separator ─ @@ -23,7 +23,7 @@ ---tty-stream-chunk-separator ---tty-stream-chunk-separator - ✔ test › passes + ✔ PASS: test › passes ---tty-stream-chunk-separator ─ diff --git a/test-tap/reporters/default.watch.v16.log b/test-tap/reporters/default.watch.v16.log index ae2dea44b..35ed5e9c2 100644 --- a/test-tap/reporters/default.watch.v16.log +++ b/test-tap/reporters/default.watch.v16.log @@ -1,6 +1,6 @@ ---tty-stream-chunk-separator - ✔ test › passes + ✔ PASS: test › passes ---tty-stream-chunk-separator ─ @@ -11,7 +11,7 @@ ---tty-stream-chunk-separator ---tty-stream-chunk-separator - ✔ test › passes + ✔ PASS: test › passes ---tty-stream-chunk-separator ─ @@ -23,7 +23,7 @@ ---tty-stream-chunk-separator ---tty-stream-chunk-separator - ✔ test › passes + ✔ PASS: test › passes ---tty-stream-chunk-separator ─ diff --git a/test-tap/reporters/default.watch.v18.log b/test-tap/reporters/default.watch.v18.log index ae2dea44b..35ed5e9c2 100644 --- a/test-tap/reporters/default.watch.v18.log +++ b/test-tap/reporters/default.watch.v18.log @@ -1,6 +1,6 @@ ---tty-stream-chunk-separator - ✔ test › passes + ✔ PASS: test › passes ---tty-stream-chunk-separator ─ @@ -11,7 +11,7 @@ ---tty-stream-chunk-separator ---tty-stream-chunk-separator - ✔ test › passes + ✔ PASS: test › passes ---tty-stream-chunk-separator ─ @@ -23,7 +23,7 @@ ---tty-stream-chunk-separator ---tty-stream-chunk-separator - ✔ test › passes + ✔ PASS: test › passes ---tty-stream-chunk-separator ─ 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-try-commit.js b/test-tap/test-try-commit.js index ba99047c2..043d93400 100644 --- a/test-tap/test-try-commit.js +++ b/test-tap/test-try-commit.js @@ -1,12 +1,15 @@ import delay from 'delay'; import {test} from 'tap'; +import {set as setChalk} from '../lib/chalk.js'; import ContextRef from '../lib/context-ref.js'; import {set as setOptions} from '../lib/worker/options.cjs'; import {newAva} from './helper/ava-test.js'; -setOptions({chalkOptions: {level: 0}}); +const options = {chalkOptions: {level: 0}}; +setOptions(options); +setChalk(options.chalkOptions); test('try-commit works', async t => { const ava = newAva(); 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/); })); From 1b64bff382e00f85676aea888ab762b2ecc2d815 Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Sun, 7 Aug 2022 16:03:18 -0400 Subject: [PATCH 08/13] Set chalk options automatically from options.cjs `set` This _seems_ to work, but the resulting interaction between CommonJS and ESM feels a bit Zalgo-y. It may be better for modules to keep setting global options and chalk options in parallel while the former remains CommonJS, but I wanted to see what simplification would look like. --- lib/worker/base.js | 2 -- lib/worker/options.cjs | 13 +++++++++++++ test-tap/assert.js | 5 +---- test-tap/test-try-commit.js | 5 +---- test/snapshot-regenerate-report/test.js | 4 +--- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/lib/worker/base.js b/lib/worker/base.js index e62e30eb4..1a132ba40 100644 --- a/lib/worker/base.js +++ b/lib/worker/base.js @@ -5,7 +5,6 @@ import {workerData} from 'node:worker_threads'; import setUpCurrentlyUnhandled from 'currently-unhandled'; -import {set as setChalk} from '../chalk.js'; import nowAndTimers from '../now-and-timers.cjs'; import providerManager from '../provider-manager.js'; import Runner from '../runner.js'; @@ -22,7 +21,6 @@ const currentlyUnhandled = setUpCurrentlyUnhandled(); const run = async options => { setOptions(options); - setChalk(options.chalkOptions); if (options.chalkOptions.level > 0) { const {stdout, stderr} = process; diff --git a/lib/worker/options.cjs b/lib/worker/options.cjs index 8a6ca21fa..e98aa04a7 100644 --- a/lib/worker/options.cjs +++ b/lib/worker/options.cjs @@ -1,4 +1,10 @@ 'use strict'; +const chalk = import('../chalk.js'); // eslint-disable-line node/no-unsupported-features/es-syntax +let setChalk; +chalk.then(chalk => { + setChalk = chalk.set; +}); + let options = null; exports.get = () => { if (!options) { @@ -14,4 +20,11 @@ exports.set = newOptions => { } options = newOptions; + if (options.chalkOptions) { + if (setChalk) { + setChalk(options.chalkOptions); + } else { + chalk.then(chalk => chalk.set(options.chalkOptions)); + } + } }; diff --git a/test-tap/assert.js b/test-tap/assert.js index 3cfebf276..742bc8f46 100644 --- a/test-tap/assert.js +++ b/test-tap/assert.js @@ -7,11 +7,8 @@ import {test} from 'tap'; import * as assert from '../lib/assert.js'; import {set as setChalk} from '../lib/chalk.js'; import * as snapshotManager from '../lib/snapshot-manager.js'; -import {set as setOptions} from '../lib/worker/options.cjs'; -const options = {chalkOptions: {level: 0}}; -setOptions(options); -setChalk(options.chalkOptions); +setChalk({level: 0}); let lastFailure = null; let lastPassed = false; diff --git a/test-tap/test-try-commit.js b/test-tap/test-try-commit.js index 043d93400..ba99047c2 100644 --- a/test-tap/test-try-commit.js +++ b/test-tap/test-try-commit.js @@ -1,15 +1,12 @@ import delay from 'delay'; import {test} from 'tap'; -import {set as setChalk} from '../lib/chalk.js'; import ContextRef from '../lib/context-ref.js'; import {set as setOptions} from '../lib/worker/options.cjs'; import {newAva} from './helper/ava-test.js'; -const options = {chalkOptions: {level: 0}}; -setOptions(options); -setChalk(options.chalkOptions); +setOptions({chalkOptions: {level: 0}}); test('try-commit works', async t => { const ava = newAva(); diff --git a/test/snapshot-regenerate-report/test.js b/test/snapshot-regenerate-report/test.js index 2d0a4ca39..2cce1708b 100644 --- a/test/snapshot-regenerate-report/test.js +++ b/test/snapshot-regenerate-report/test.js @@ -3,13 +3,11 @@ import path from 'node:path'; import test from '@ava/test'; -import {set as setChalk} from '../../lib/chalk.js'; import {load} from '../../lib/snapshot-manager.js'; import {set as setOptions} from '../../lib/worker/options.cjs'; import {cwd, fixture} from '../helpers/exec.js'; -setChalk({level: 0}); -setOptions({}); +setOptions({chalkOptions: {level: 0}}); test('snapshot report can be regenerated from .snap file', async t => { const workingDir = cwd(); From 9b45dc3cad91737c8115cd44ffb458e593ee6459 Mon Sep 17 00:00:00 2001 From: Mark Wubben Date: Sat, 27 Aug 2022 18:07:12 +0200 Subject: [PATCH 09/13] Undo changes to lib/chalk.js --- lib/chalk.js | 8 -------- lib/concordance-options.js | 12 ++++-------- lib/worker/base.js | 2 ++ lib/worker/options.cjs | 13 ------------- test-tap/assert.js | 6 +++--- test/snapshot-regenerate-report/test.js | 4 +++- 6 files changed, 12 insertions(+), 33 deletions(-) diff --git a/lib/chalk.js b/lib/chalk.js index 8431fbfce..eca6d4267 100644 --- a/lib/chalk.js +++ b/lib/chalk.js @@ -1,5 +1,3 @@ -import {EventEmitter} from 'node:events'; - import {Chalk} from 'chalk'; // eslint-disable-line unicorn/import-style let chalk = new Chalk(); // eslint-disable-line import/no-mutable-exports @@ -7,9 +5,6 @@ let chalk = new Chalk(); // eslint-disable-line import/no-mutable-exports export {chalk}; let configured = false; -const events = new EventEmitter(); -const on = events.on.bind(events); -const emit = events.emit.bind(events); export function set(options) { if (configured) { throw new Error('Chalk has already been configured'); @@ -17,7 +12,4 @@ export function set(options) { configured = true; chalk = new Chalk(options); - emit('set', chalk); } - -export {on}; diff --git a/lib/concordance-options.js b/lib/concordance-options.js index 21768f306..3e5fbf4be 100644 --- a/lib/concordance-options.js +++ b/lib/concordance-options.js @@ -4,7 +4,7 @@ import ansiStyles from 'ansi-styles'; import {Chalk} from 'chalk'; // eslint-disable-line unicorn/import-style import stripAnsi from 'strip-ansi'; -import {chalk, on as onChalkEvent} from './chalk.js'; +import {chalk} from './chalk.js'; const forceColor = new Chalk({level: Math.max(chalk.level, 1)}); @@ -87,19 +87,15 @@ const colorTheme = { const plainTheme = JSON.parse(JSON.stringify(colorTheme), (_name, value) => typeof value === 'string' ? stripAnsi(value) : value); +const theme = chalk.level > 0 ? colorTheme : plainTheme; + const concordanceOptions = { // Use Node's object inspection depth, clamped to a minimum of 3 get maxDepth() { return Math.max(3, inspect.defaultOptions.depth); }, - theme: undefined, + theme, }; -function setTheme(chalk) { - concordanceOptions.theme = chalk.level > 0 ? colorTheme : plainTheme; -} - -setTheme(chalk); -onChalkEvent('set', setTheme); export default concordanceOptions; diff --git a/lib/worker/base.js b/lib/worker/base.js index 6980eb5bb..a9ed9e4a3 100644 --- a/lib/worker/base.js +++ b/lib/worker/base.js @@ -5,6 +5,7 @@ import {workerData} from 'node:worker_threads'; import setUpCurrentlyUnhandled from 'currently-unhandled'; +import {set as setChalk} from '../chalk.js'; import nowAndTimers from '../now-and-timers.cjs'; import providerManager from '../provider-manager.js'; import Runner from '../runner.js'; @@ -21,6 +22,7 @@ const currentlyUnhandled = setUpCurrentlyUnhandled(); const run = async options => { setOptions(options); + setChalk(options.chalkOptions); if (options.chalkOptions.level > 0) { const {stdout, stderr} = process; diff --git a/lib/worker/options.cjs b/lib/worker/options.cjs index 3d729c5d5..8a6ca21fa 100644 --- a/lib/worker/options.cjs +++ b/lib/worker/options.cjs @@ -1,10 +1,4 @@ 'use strict'; -const chalk = import('../chalk.js'); -let setChalk; -chalk.then(chalk => { - setChalk = chalk.set; -}); - let options = null; exports.get = () => { if (!options) { @@ -20,11 +14,4 @@ exports.set = newOptions => { } options = newOptions; - if (options.chalkOptions) { - if (setChalk) { - setChalk(options.chalkOptions); - } else { - chalk.then(chalk => chalk.set(options.chalkOptions)); - } - } }; diff --git a/test-tap/assert.js b/test-tap/assert.js index 742bc8f46..48ab73d2b 100644 --- a/test-tap/assert.js +++ b/test-tap/assert.js @@ -5,10 +5,10 @@ import stripAnsi from 'strip-ansi'; import {test} from 'tap'; import * as assert from '../lib/assert.js'; -import {set as setChalk} from '../lib/chalk.js'; import * as snapshotManager from '../lib/snapshot-manager.js'; +import {set as setOptions} from '../lib/worker/options.cjs'; -setChalk({level: 0}); +setOptions({chalkOptions: {level: 0}}); let lastFailure = null; let lastPassed = false; @@ -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 { diff --git a/test/snapshot-regenerate-report/test.js b/test/snapshot-regenerate-report/test.js index 2cce1708b..2d0a4ca39 100644 --- a/test/snapshot-regenerate-report/test.js +++ b/test/snapshot-regenerate-report/test.js @@ -3,11 +3,13 @@ import path from 'node:path'; import test from '@ava/test'; +import {set as setChalk} from '../../lib/chalk.js'; import {load} from '../../lib/snapshot-manager.js'; import {set as setOptions} from '../../lib/worker/options.cjs'; import {cwd, fixture} from '../helpers/exec.js'; -setOptions({chalkOptions: {level: 0}}); +setChalk({level: 0}); +setOptions({}); test('snapshot report can be regenerated from .snap file', async t => { const workingDir = cwd(); From fcc1f07a6aa7bc445914c9247b99c552b3a0b79c Mon Sep 17 00:00:00 2001 From: Mark Wubben Date: Sat, 27 Aug 2022 18:10:23 +0200 Subject: [PATCH 10/13] Keep relying on Chalk to parse --color argv --- lib/cli.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cli.js b/lib/cli.js index 815aa29de..c2ddcbca6 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -223,7 +223,7 @@ export default async function loadCli() { // eslint-disable-line complexity const combined = {...conf}; - for (const flag of ['color', ...Object.keys(FLAGS)]) { + for (const flag of Object.keys(FLAGS)) { if (flag === 'no-worker-threads' && Reflect.has(argv, 'worker-threads')) { combined.workerThreads = argv['worker-threads']; continue; From 0c0fd212529ad016b33f58c7dee4aa2791fab9dc Mon Sep 17 00:00:00 2001 From: Mark Wubben Date: Sun, 4 Sep 2022 16:13:55 +0200 Subject: [PATCH 11/13] Tweak result prefixes Use lowercase, since AVA doesn't output anything in all caps. Wrap in square brackets to differentiate from the test title. Remove prefix for passed tests. We assume that most tests pass most of the time. --- lib/reporters/default.js | 18 ++++---- test-tap/reporters/default.failfast.v14.log | 2 +- test-tap/reporters/default.failfast.v16.log | 2 +- test-tap/reporters/default.failfast.v18.log | 2 +- test-tap/reporters/default.failfast2.v14.log | 2 +- test-tap/reporters/default.failfast2.v16.log | 2 +- test-tap/reporters/default.failfast2.v18.log | 2 +- test-tap/reporters/default.only.v14.log | 4 +- test-tap/reporters/default.only.v16.log | 4 +- test-tap/reporters/default.only.v18.log | 4 +- test-tap/reporters/default.regular.v14.log | 42 +++++++++---------- test-tap/reporters/default.regular.v16.log | 42 +++++++++---------- test-tap/reporters/default.regular.v18.log | 42 +++++++++---------- .../default.timeoutinmultiplefiles.v14.log | 8 ++-- .../default.timeoutinmultiplefiles.v16.log | 8 ++-- .../default.timeoutinmultiplefiles.v18.log | 8 ++-- .../default.timeoutinsinglefile.v14.log | 4 +- .../default.timeoutinsinglefile.v16.log | 4 +- .../default.timeoutinsinglefile.v18.log | 4 +- .../default.timeoutwithmatch.v14.log | 2 +- .../default.timeoutwithmatch.v16.log | 2 +- .../default.timeoutwithmatch.v18.log | 2 +- test-tap/reporters/default.watch.v14.log | 6 +-- test-tap/reporters/default.watch.v16.log | 6 +-- test-tap/reporters/default.watch.v18.log | 6 +-- 25 files changed, 114 insertions(+), 114 deletions(-) diff --git a/lib/reporters/default.js b/lib/reporters/default.js index b2af8fbfc..425ae2b04 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(`- 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(`- TODO: ${this.prefixTitle(event.testFile, event.title)}`)); + this.lineWriter.writeLine(colors.todo(`- [todo] ${this.prefixTitle(event.testFile, event.title)}`)); } break; @@ -507,20 +507,20 @@ export default class Reporter { // 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: ✔ PASS: - // * normal test, fail: ✘ FAIL: - // * fail-expected test, fail: ✔ EXPECTED FAIL: - // * fail-expected test, pass: ✘ UNEXPECTED PASS: + // * 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') { - const type = event.knownFailing ? 'UNEXPECTED PASS' : 'FAIL'; + const type = event.knownFailing ? '[unexpected pass]' : '[fail]'; prefix = colors.error(`${figures.cross} ${type}:`); suffix = colors.error(event.err.message); } else if (event.knownFailing) { - prefix = colors.error(figures.tick + ' EXPECTED FAIL:'); + prefix = colors.error(figures.tick + ' [expected fail]'); } else { - prefix = colors.pass(figures.tick + ' PASS:'); + prefix = colors.pass(figures.tick); if (event.duration > this.durationThreshold) { suffix = colors.duration(`(${prettyMs(event.duration)})`); } diff --git a/test-tap/reporters/default.failfast.v14.log b/test-tap/reporters/default.failfast.v14.log index e2eb20272..dba0ad368 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 - ✘ FAIL: a › fails Test failed via `t.fail()` + ✘ [fail]: a › fails Test failed via `t.fail()` ---tty-stream-chunk-separator ─ diff --git a/test-tap/reporters/default.failfast.v16.log b/test-tap/reporters/default.failfast.v16.log index e2eb20272..dba0ad368 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 - ✘ FAIL: a › fails Test failed via `t.fail()` + ✘ [fail]: a › fails Test failed via `t.fail()` ---tty-stream-chunk-separator ─ diff --git a/test-tap/reporters/default.failfast.v18.log b/test-tap/reporters/default.failfast.v18.log index e2eb20272..dba0ad368 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 - ✘ FAIL: a › fails Test failed via `t.fail()` + ✘ [fail]: a › fails Test failed via `t.fail()` ---tty-stream-chunk-separator ─ diff --git a/test-tap/reporters/default.failfast2.v14.log b/test-tap/reporters/default.failfast2.v14.log index d42d1fd9a..a4345435a 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 - ✘ FAIL: a › fails Test failed via `t.fail()` + ✘ [fail]: a › fails Test failed via `t.fail()` ---tty-stream-chunk-separator ─ diff --git a/test-tap/reporters/default.failfast2.v16.log b/test-tap/reporters/default.failfast2.v16.log index d42d1fd9a..a4345435a 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 - ✘ FAIL: a › fails Test failed via `t.fail()` + ✘ [fail]: a › fails Test failed via `t.fail()` ---tty-stream-chunk-separator ─ diff --git a/test-tap/reporters/default.failfast2.v18.log b/test-tap/reporters/default.failfast2.v18.log index d42d1fd9a..a4345435a 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 - ✘ FAIL: a › fails Test failed via `t.fail()` + ✘ [fail]: a › fails Test failed via `t.fail()` ---tty-stream-chunk-separator ─ diff --git a/test-tap/reporters/default.only.v14.log b/test-tap/reporters/default.only.v14.log index 0fd225f5a..f01706e56 100644 --- a/test-tap/reporters/default.only.v14.log +++ b/test-tap/reporters/default.only.v14.log @@ -1,8 +1,8 @@ ---tty-stream-chunk-separator - ✔ PASS: a › only + ✔ a › only ---tty-stream-chunk-separator - ✔ PASS: b › passes + ✔ b › passes ---tty-stream-chunk-separator ─ diff --git a/test-tap/reporters/default.only.v16.log b/test-tap/reporters/default.only.v16.log index 0fd225f5a..f01706e56 100644 --- a/test-tap/reporters/default.only.v16.log +++ b/test-tap/reporters/default.only.v16.log @@ -1,8 +1,8 @@ ---tty-stream-chunk-separator - ✔ PASS: a › only + ✔ a › only ---tty-stream-chunk-separator - ✔ PASS: b › passes + ✔ b › passes ---tty-stream-chunk-separator ─ diff --git a/test-tap/reporters/default.only.v18.log b/test-tap/reporters/default.only.v18.log index 0fd225f5a..f01706e56 100644 --- a/test-tap/reporters/default.only.v18.log +++ b/test-tap/reporters/default.only.v18.log @@ -1,8 +1,8 @@ ---tty-stream-chunk-separator - ✔ PASS: a › only + ✔ a › only ---tty-stream-chunk-separator - ✔ PASS: b › passes + ✔ b › passes ---tty-stream-chunk-separator ─ diff --git a/test-tap/reporters/default.regular.v14.log b/test-tap/reporters/default.regular.v14.log index f7eb9cdd3..5f80ac5d4 100644 --- a/test-tap/reporters/default.regular.v14.log +++ b/test-tap/reporters/default.regular.v14.log @@ -15,9 +15,9 @@ ---tty-stream-chunk-separator ✘ bad-test-chain.cjs exited with a non-zero exit code: 1 ---tty-stream-chunk-separator - ✘ FAIL: nested-objects › format with max depth 4 + ✘ [fail]: nested-objects › format with max depth 4 ---tty-stream-chunk-separator - ✘ FAIL: 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 @@ -28,9 +28,9 @@ output-in-hook › beforeEach hook for failing test ℹ beforeEach ---tty-stream-chunk-separator - ✔ PASS: output-in-hook › passing test + ✔ output-in-hook › passing test ---tty-stream-chunk-separator - ✘ FAIL: 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,37 +44,37 @@ output-in-hook › cleanup ℹ afterAlways ---tty-stream-chunk-separator - - SKIP: test › skip + - [skip] test › skip ---tty-stream-chunk-separator - - TODO: test › todo + - [todo] test › todo ---tty-stream-chunk-separator - ✔ PASS: test › passes + ✔ test › passes ---tty-stream-chunk-separator - ✘ FAIL: test › fails Test failed via `t.fail()` + ✘ [fail]: test › fails Test failed via `t.fail()` ---tty-stream-chunk-separator - ✔ EXPECTED FAIL: test › known failure + ✔ [expected fail] test › known failure ---tty-stream-chunk-separator - ✘ UNEXPECTED PASS: 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 - ✘ FAIL: test › logs Test failed via `t.fail()` + ✘ [fail]: test › logs Test failed via `t.fail()` ℹ hello ℹ world ---tty-stream-chunk-separator - ✘ FAIL: test › formatted + ✘ [fail]: test › formatted ---tty-stream-chunk-separator - ✘ FAIL: test › implementation throws non-error Error thrown in test + ✘ [fail]: test › implementation throws non-error Error thrown in test ---tty-stream-chunk-separator - ✘ FAIL: traces-in-t-throws › throws + ✘ [fail]: traces-in-t-throws › throws ---tty-stream-chunk-separator - ✘ FAIL: traces-in-t-throws › notThrows + ✘ [fail]: traces-in-t-throws › notThrows ---tty-stream-chunk-separator - ✘ FAIL: traces-in-t-throws › notThrowsAsync + ✘ [fail]: traces-in-t-throws › notThrowsAsync ---tty-stream-chunk-separator - ✘ FAIL: traces-in-t-throws › throwsAsync + ✘ [fail]: traces-in-t-throws › throwsAsync ---tty-stream-chunk-separator - ✘ FAIL: traces-in-t-throws › throwsAsync different error + ✘ [fail]: traces-in-t-throws › throwsAsync different error ---tty-stream-chunk-separator - ✔ PASS: uncaught-exception › passes + ✔ uncaught-exception › passes ---tty-stream-chunk-separator Uncaught exception in uncaught-exception.cjs @@ -92,9 +92,9 @@ ---tty-stream-chunk-separator ✘ uncaught-exception.cjs exited with a non-zero exit code: 1 ---tty-stream-chunk-separator - ✔ PASS: unhandled-rejection › passes + ✔ unhandled-rejection › passes ---tty-stream-chunk-separator - ✔ PASS: unhandled-rejection › unhandled non-error rejection + ✔ unhandled-rejection › unhandled non-error rejection ---tty-stream-chunk-separator Unhandled rejection in unhandled-rejection.cjs diff --git a/test-tap/reporters/default.regular.v16.log b/test-tap/reporters/default.regular.v16.log index f7eb9cdd3..5f80ac5d4 100644 --- a/test-tap/reporters/default.regular.v16.log +++ b/test-tap/reporters/default.regular.v16.log @@ -15,9 +15,9 @@ ---tty-stream-chunk-separator ✘ bad-test-chain.cjs exited with a non-zero exit code: 1 ---tty-stream-chunk-separator - ✘ FAIL: nested-objects › format with max depth 4 + ✘ [fail]: nested-objects › format with max depth 4 ---tty-stream-chunk-separator - ✘ FAIL: 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 @@ -28,9 +28,9 @@ output-in-hook › beforeEach hook for failing test ℹ beforeEach ---tty-stream-chunk-separator - ✔ PASS: output-in-hook › passing test + ✔ output-in-hook › passing test ---tty-stream-chunk-separator - ✘ FAIL: 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,37 +44,37 @@ output-in-hook › cleanup ℹ afterAlways ---tty-stream-chunk-separator - - SKIP: test › skip + - [skip] test › skip ---tty-stream-chunk-separator - - TODO: test › todo + - [todo] test › todo ---tty-stream-chunk-separator - ✔ PASS: test › passes + ✔ test › passes ---tty-stream-chunk-separator - ✘ FAIL: test › fails Test failed via `t.fail()` + ✘ [fail]: test › fails Test failed via `t.fail()` ---tty-stream-chunk-separator - ✔ EXPECTED FAIL: test › known failure + ✔ [expected fail] test › known failure ---tty-stream-chunk-separator - ✘ UNEXPECTED PASS: 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 - ✘ FAIL: test › logs Test failed via `t.fail()` + ✘ [fail]: test › logs Test failed via `t.fail()` ℹ hello ℹ world ---tty-stream-chunk-separator - ✘ FAIL: test › formatted + ✘ [fail]: test › formatted ---tty-stream-chunk-separator - ✘ FAIL: test › implementation throws non-error Error thrown in test + ✘ [fail]: test › implementation throws non-error Error thrown in test ---tty-stream-chunk-separator - ✘ FAIL: traces-in-t-throws › throws + ✘ [fail]: traces-in-t-throws › throws ---tty-stream-chunk-separator - ✘ FAIL: traces-in-t-throws › notThrows + ✘ [fail]: traces-in-t-throws › notThrows ---tty-stream-chunk-separator - ✘ FAIL: traces-in-t-throws › notThrowsAsync + ✘ [fail]: traces-in-t-throws › notThrowsAsync ---tty-stream-chunk-separator - ✘ FAIL: traces-in-t-throws › throwsAsync + ✘ [fail]: traces-in-t-throws › throwsAsync ---tty-stream-chunk-separator - ✘ FAIL: traces-in-t-throws › throwsAsync different error + ✘ [fail]: traces-in-t-throws › throwsAsync different error ---tty-stream-chunk-separator - ✔ PASS: uncaught-exception › passes + ✔ uncaught-exception › passes ---tty-stream-chunk-separator Uncaught exception in uncaught-exception.cjs @@ -92,9 +92,9 @@ ---tty-stream-chunk-separator ✘ uncaught-exception.cjs exited with a non-zero exit code: 1 ---tty-stream-chunk-separator - ✔ PASS: unhandled-rejection › passes + ✔ unhandled-rejection › passes ---tty-stream-chunk-separator - ✔ PASS: unhandled-rejection › unhandled non-error rejection + ✔ unhandled-rejection › unhandled non-error rejection ---tty-stream-chunk-separator Unhandled rejection in unhandled-rejection.cjs diff --git a/test-tap/reporters/default.regular.v18.log b/test-tap/reporters/default.regular.v18.log index f7eb9cdd3..5f80ac5d4 100644 --- a/test-tap/reporters/default.regular.v18.log +++ b/test-tap/reporters/default.regular.v18.log @@ -15,9 +15,9 @@ ---tty-stream-chunk-separator ✘ bad-test-chain.cjs exited with a non-zero exit code: 1 ---tty-stream-chunk-separator - ✘ FAIL: nested-objects › format with max depth 4 + ✘ [fail]: nested-objects › format with max depth 4 ---tty-stream-chunk-separator - ✘ FAIL: 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 @@ -28,9 +28,9 @@ output-in-hook › beforeEach hook for failing test ℹ beforeEach ---tty-stream-chunk-separator - ✔ PASS: output-in-hook › passing test + ✔ output-in-hook › passing test ---tty-stream-chunk-separator - ✘ FAIL: 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,37 +44,37 @@ output-in-hook › cleanup ℹ afterAlways ---tty-stream-chunk-separator - - SKIP: test › skip + - [skip] test › skip ---tty-stream-chunk-separator - - TODO: test › todo + - [todo] test › todo ---tty-stream-chunk-separator - ✔ PASS: test › passes + ✔ test › passes ---tty-stream-chunk-separator - ✘ FAIL: test › fails Test failed via `t.fail()` + ✘ [fail]: test › fails Test failed via `t.fail()` ---tty-stream-chunk-separator - ✔ EXPECTED FAIL: test › known failure + ✔ [expected fail] test › known failure ---tty-stream-chunk-separator - ✘ UNEXPECTED PASS: 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 - ✘ FAIL: test › logs Test failed via `t.fail()` + ✘ [fail]: test › logs Test failed via `t.fail()` ℹ hello ℹ world ---tty-stream-chunk-separator - ✘ FAIL: test › formatted + ✘ [fail]: test › formatted ---tty-stream-chunk-separator - ✘ FAIL: test › implementation throws non-error Error thrown in test + ✘ [fail]: test › implementation throws non-error Error thrown in test ---tty-stream-chunk-separator - ✘ FAIL: traces-in-t-throws › throws + ✘ [fail]: traces-in-t-throws › throws ---tty-stream-chunk-separator - ✘ FAIL: traces-in-t-throws › notThrows + ✘ [fail]: traces-in-t-throws › notThrows ---tty-stream-chunk-separator - ✘ FAIL: traces-in-t-throws › notThrowsAsync + ✘ [fail]: traces-in-t-throws › notThrowsAsync ---tty-stream-chunk-separator - ✘ FAIL: traces-in-t-throws › throwsAsync + ✘ [fail]: traces-in-t-throws › throwsAsync ---tty-stream-chunk-separator - ✘ FAIL: traces-in-t-throws › throwsAsync different error + ✘ [fail]: traces-in-t-throws › throwsAsync different error ---tty-stream-chunk-separator - ✔ PASS: uncaught-exception › passes + ✔ uncaught-exception › passes ---tty-stream-chunk-separator Uncaught exception in uncaught-exception.cjs @@ -92,9 +92,9 @@ ---tty-stream-chunk-separator ✘ uncaught-exception.cjs exited with a non-zero exit code: 1 ---tty-stream-chunk-separator - ✔ PASS: unhandled-rejection › passes + ✔ unhandled-rejection › passes ---tty-stream-chunk-separator - ✔ PASS: unhandled-rejection › unhandled non-error rejection + ✔ unhandled-rejection › unhandled non-error rejection ---tty-stream-chunk-separator Unhandled rejection in unhandled-rejection.cjs diff --git a/test-tap/reporters/default.timeoutinmultiplefiles.v14.log b/test-tap/reporters/default.timeoutinmultiplefiles.v14.log index 2a18dead3..f3a678ae2 100644 --- a/test-tap/reporters/default.timeoutinmultiplefiles.v14.log +++ b/test-tap/reporters/default.timeoutinmultiplefiles.v14.log @@ -1,8 +1,8 @@ ---tty-stream-chunk-separator - ✔ PASS: a › a passes + ✔ a › a passes ---tty-stream-chunk-separator - ✔ PASS: a › a passes two + ✔ a › a passes two ---tty-stream-chunk-separator  ✘ Timed out while running tests @@ -13,9 +13,9 @@ ◌ a › a slow two ---tty-stream-chunk-separator - ✔ PASS: b › b passes + ✔ b › b passes ---tty-stream-chunk-separator - ✔ PASS: b › b passes two + ✔ b › b passes two ---tty-stream-chunk-separator  ✘ Timed out while running tests diff --git a/test-tap/reporters/default.timeoutinmultiplefiles.v16.log b/test-tap/reporters/default.timeoutinmultiplefiles.v16.log index 2a18dead3..f3a678ae2 100644 --- a/test-tap/reporters/default.timeoutinmultiplefiles.v16.log +++ b/test-tap/reporters/default.timeoutinmultiplefiles.v16.log @@ -1,8 +1,8 @@ ---tty-stream-chunk-separator - ✔ PASS: a › a passes + ✔ a › a passes ---tty-stream-chunk-separator - ✔ PASS: a › a passes two + ✔ a › a passes two ---tty-stream-chunk-separator  ✘ Timed out while running tests @@ -13,9 +13,9 @@ ◌ a › a slow two ---tty-stream-chunk-separator - ✔ PASS: b › b passes + ✔ b › b passes ---tty-stream-chunk-separator - ✔ PASS: b › b passes two + ✔ b › b passes two ---tty-stream-chunk-separator  ✘ Timed out while running tests diff --git a/test-tap/reporters/default.timeoutinmultiplefiles.v18.log b/test-tap/reporters/default.timeoutinmultiplefiles.v18.log index 2a18dead3..f3a678ae2 100644 --- a/test-tap/reporters/default.timeoutinmultiplefiles.v18.log +++ b/test-tap/reporters/default.timeoutinmultiplefiles.v18.log @@ -1,8 +1,8 @@ ---tty-stream-chunk-separator - ✔ PASS: a › a passes + ✔ a › a passes ---tty-stream-chunk-separator - ✔ PASS: a › a passes two + ✔ a › a passes two ---tty-stream-chunk-separator  ✘ Timed out while running tests @@ -13,9 +13,9 @@ ◌ a › a slow two ---tty-stream-chunk-separator - ✔ PASS: b › b passes + ✔ b › b passes ---tty-stream-chunk-separator - ✔ PASS: b › b passes two + ✔ b › b passes two ---tty-stream-chunk-separator  ✘ Timed out while running tests diff --git a/test-tap/reporters/default.timeoutinsinglefile.v14.log b/test-tap/reporters/default.timeoutinsinglefile.v14.log index 2295471f4..a1059e094 100644 --- a/test-tap/reporters/default.timeoutinsinglefile.v14.log +++ b/test-tap/reporters/default.timeoutinsinglefile.v14.log @@ -1,8 +1,8 @@ ---tty-stream-chunk-separator - ✔ PASS: passes + ✔ passes ---tty-stream-chunk-separator - ✔ PASS: passes two + ✔ passes two ---tty-stream-chunk-separator  ✘ Timed out while running tests diff --git a/test-tap/reporters/default.timeoutinsinglefile.v16.log b/test-tap/reporters/default.timeoutinsinglefile.v16.log index 2295471f4..a1059e094 100644 --- a/test-tap/reporters/default.timeoutinsinglefile.v16.log +++ b/test-tap/reporters/default.timeoutinsinglefile.v16.log @@ -1,8 +1,8 @@ ---tty-stream-chunk-separator - ✔ PASS: passes + ✔ passes ---tty-stream-chunk-separator - ✔ PASS: passes two + ✔ passes two ---tty-stream-chunk-separator  ✘ Timed out while running tests diff --git a/test-tap/reporters/default.timeoutinsinglefile.v18.log b/test-tap/reporters/default.timeoutinsinglefile.v18.log index 2295471f4..a1059e094 100644 --- a/test-tap/reporters/default.timeoutinsinglefile.v18.log +++ b/test-tap/reporters/default.timeoutinsinglefile.v18.log @@ -1,8 +1,8 @@ ---tty-stream-chunk-separator - ✔ PASS: passes + ✔ passes ---tty-stream-chunk-separator - ✔ PASS: passes two + ✔ passes two ---tty-stream-chunk-separator  ✘ Timed out while running tests diff --git a/test-tap/reporters/default.timeoutwithmatch.v14.log b/test-tap/reporters/default.timeoutwithmatch.v14.log index af1adcaac..ae7070c95 100644 --- a/test-tap/reporters/default.timeoutwithmatch.v14.log +++ b/test-tap/reporters/default.timeoutwithmatch.v14.log @@ -1,6 +1,6 @@ ---tty-stream-chunk-separator - ✔ PASS: passes needle + ✔ passes needle ---tty-stream-chunk-separator  ✘ Timed out while running tests diff --git a/test-tap/reporters/default.timeoutwithmatch.v16.log b/test-tap/reporters/default.timeoutwithmatch.v16.log index af1adcaac..ae7070c95 100644 --- a/test-tap/reporters/default.timeoutwithmatch.v16.log +++ b/test-tap/reporters/default.timeoutwithmatch.v16.log @@ -1,6 +1,6 @@ ---tty-stream-chunk-separator - ✔ PASS: passes needle + ✔ passes needle ---tty-stream-chunk-separator  ✘ Timed out while running tests diff --git a/test-tap/reporters/default.timeoutwithmatch.v18.log b/test-tap/reporters/default.timeoutwithmatch.v18.log index af1adcaac..ae7070c95 100644 --- a/test-tap/reporters/default.timeoutwithmatch.v18.log +++ b/test-tap/reporters/default.timeoutwithmatch.v18.log @@ -1,6 +1,6 @@ ---tty-stream-chunk-separator - ✔ PASS: passes needle + ✔ passes needle ---tty-stream-chunk-separator  ✘ Timed out while running tests diff --git a/test-tap/reporters/default.watch.v14.log b/test-tap/reporters/default.watch.v14.log index 35ed5e9c2..ae2dea44b 100644 --- a/test-tap/reporters/default.watch.v14.log +++ b/test-tap/reporters/default.watch.v14.log @@ -1,6 +1,6 @@ ---tty-stream-chunk-separator - ✔ PASS: test › passes + ✔ test › passes ---tty-stream-chunk-separator ─ @@ -11,7 +11,7 @@ ---tty-stream-chunk-separator ---tty-stream-chunk-separator - ✔ PASS: test › passes + ✔ test › passes ---tty-stream-chunk-separator ─ @@ -23,7 +23,7 @@ ---tty-stream-chunk-separator ---tty-stream-chunk-separator - ✔ PASS: test › passes + ✔ test › passes ---tty-stream-chunk-separator ─ diff --git a/test-tap/reporters/default.watch.v16.log b/test-tap/reporters/default.watch.v16.log index 35ed5e9c2..ae2dea44b 100644 --- a/test-tap/reporters/default.watch.v16.log +++ b/test-tap/reporters/default.watch.v16.log @@ -1,6 +1,6 @@ ---tty-stream-chunk-separator - ✔ PASS: test › passes + ✔ test › passes ---tty-stream-chunk-separator ─ @@ -11,7 +11,7 @@ ---tty-stream-chunk-separator ---tty-stream-chunk-separator - ✔ PASS: test › passes + ✔ test › passes ---tty-stream-chunk-separator ─ @@ -23,7 +23,7 @@ ---tty-stream-chunk-separator ---tty-stream-chunk-separator - ✔ PASS: test › passes + ✔ test › passes ---tty-stream-chunk-separator ─ diff --git a/test-tap/reporters/default.watch.v18.log b/test-tap/reporters/default.watch.v18.log index 35ed5e9c2..ae2dea44b 100644 --- a/test-tap/reporters/default.watch.v18.log +++ b/test-tap/reporters/default.watch.v18.log @@ -1,6 +1,6 @@ ---tty-stream-chunk-separator - ✔ PASS: test › passes + ✔ test › passes ---tty-stream-chunk-separator ─ @@ -11,7 +11,7 @@ ---tty-stream-chunk-separator ---tty-stream-chunk-separator - ✔ PASS: test › passes + ✔ test › passes ---tty-stream-chunk-separator ─ @@ -23,7 +23,7 @@ ---tty-stream-chunk-separator ---tty-stream-chunk-separator - ✔ PASS: test › passes + ✔ test › passes ---tty-stream-chunk-separator ─ From ee9f0000806d1cae461ac7182da92455f076fa42 Mon Sep 17 00:00:00 2001 From: Mark Wubben Date: Sun, 4 Sep 2022 16:17:10 +0200 Subject: [PATCH 12/13] Print assertion error in italics To better differentiate from the test title. --- lib/reporters/default.js | 2 +- test-tap/reporters/default.failfast.v14.log | 2 +- test-tap/reporters/default.failfast.v16.log | 2 +- test-tap/reporters/default.failfast.v18.log | 2 +- test-tap/reporters/default.failfast2.v14.log | 2 +- test-tap/reporters/default.failfast2.v16.log | 2 +- test-tap/reporters/default.failfast2.v18.log | 2 +- test-tap/reporters/default.regular.v14.log | 10 +++++----- test-tap/reporters/default.regular.v16.log | 10 +++++----- test-tap/reporters/default.regular.v18.log | 10 +++++----- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/reporters/default.js b/lib/reporters/default.js index 425ae2b04..c1250151b 100644 --- a/lib/reporters/default.js +++ b/lib/reporters/default.js @@ -516,7 +516,7 @@ export default class Reporter { if (event.type === 'hook-failed' || event.type === 'test-failed') { const type = event.knownFailing ? '[unexpected pass]' : '[fail]'; prefix = colors.error(`${figures.cross} ${type}:`); - suffix = colors.error(event.err.message); + suffix = chalk.italic(colors.error(event.err.message)); } else if (event.knownFailing) { prefix = colors.error(figures.tick + ' [expected fail]'); } else { diff --git a/test-tap/reporters/default.failfast.v14.log b/test-tap/reporters/default.failfast.v14.log index dba0ad368..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 - ✘ [fail]: a › fails Test failed via `t.fail()` + ✘ [fail]: a › fails Test failed via `t.fail()` ---tty-stream-chunk-separator ─ diff --git a/test-tap/reporters/default.failfast.v16.log b/test-tap/reporters/default.failfast.v16.log index dba0ad368..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 - ✘ [fail]: a › fails Test failed via `t.fail()` + ✘ [fail]: a › fails Test failed via `t.fail()` ---tty-stream-chunk-separator ─ diff --git a/test-tap/reporters/default.failfast.v18.log b/test-tap/reporters/default.failfast.v18.log index dba0ad368..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 - ✘ [fail]: a › fails Test failed via `t.fail()` + ✘ [fail]: a › fails Test failed via `t.fail()` ---tty-stream-chunk-separator ─ diff --git a/test-tap/reporters/default.failfast2.v14.log b/test-tap/reporters/default.failfast2.v14.log index a4345435a..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 - ✘ [fail]: a › fails Test failed via `t.fail()` + ✘ [fail]: a › fails Test failed via `t.fail()` ---tty-stream-chunk-separator ─ diff --git a/test-tap/reporters/default.failfast2.v16.log b/test-tap/reporters/default.failfast2.v16.log index a4345435a..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 - ✘ [fail]: a › fails Test failed via `t.fail()` + ✘ [fail]: a › fails Test failed via `t.fail()` ---tty-stream-chunk-separator ─ diff --git a/test-tap/reporters/default.failfast2.v18.log b/test-tap/reporters/default.failfast2.v18.log index a4345435a..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 - ✘ [fail]: a › fails Test failed via `t.fail()` + ✘ [fail]: a › fails Test failed via `t.fail()` ---tty-stream-chunk-separator ─ diff --git a/test-tap/reporters/default.regular.v14.log b/test-tap/reporters/default.regular.v14.log index 5f80ac5d4..9b9a969d3 100644 --- a/test-tap/reporters/default.regular.v14.log +++ b/test-tap/reporters/default.regular.v14.log @@ -30,7 +30,7 @@ ---tty-stream-chunk-separator ✔ output-in-hook › passing test ---tty-stream-chunk-separator - ✘ [fail]: 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 @@ -50,19 +50,19 @@ ---tty-stream-chunk-separator ✔ test › passes ---tty-stream-chunk-separator - ✘ [fail]: test › fails Test failed via `t.fail()` + ✘ [fail]: test › fails Test failed via `t.fail()` ---tty-stream-chunk-separator ✔ [expected fail] test › known failure ---tty-stream-chunk-separator - ✘ [unexpected pass]: 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 - ✘ [fail]: test › logs Test failed via `t.fail()` + ✘ [fail]: test › logs Test failed via `t.fail()` ℹ hello ℹ world ---tty-stream-chunk-separator ✘ [fail]: test › formatted ---tty-stream-chunk-separator - ✘ [fail]: test › implementation throws non-error Error thrown in test + ✘ [fail]: test › implementation throws non-error Error thrown in test ---tty-stream-chunk-separator ✘ [fail]: traces-in-t-throws › throws ---tty-stream-chunk-separator diff --git a/test-tap/reporters/default.regular.v16.log b/test-tap/reporters/default.regular.v16.log index 5f80ac5d4..9b9a969d3 100644 --- a/test-tap/reporters/default.regular.v16.log +++ b/test-tap/reporters/default.regular.v16.log @@ -30,7 +30,7 @@ ---tty-stream-chunk-separator ✔ output-in-hook › passing test ---tty-stream-chunk-separator - ✘ [fail]: 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 @@ -50,19 +50,19 @@ ---tty-stream-chunk-separator ✔ test › passes ---tty-stream-chunk-separator - ✘ [fail]: test › fails Test failed via `t.fail()` + ✘ [fail]: test › fails Test failed via `t.fail()` ---tty-stream-chunk-separator ✔ [expected fail] test › known failure ---tty-stream-chunk-separator - ✘ [unexpected pass]: 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 - ✘ [fail]: test › logs Test failed via `t.fail()` + ✘ [fail]: test › logs Test failed via `t.fail()` ℹ hello ℹ world ---tty-stream-chunk-separator ✘ [fail]: test › formatted ---tty-stream-chunk-separator - ✘ [fail]: test › implementation throws non-error Error thrown in test + ✘ [fail]: test › implementation throws non-error Error thrown in test ---tty-stream-chunk-separator ✘ [fail]: traces-in-t-throws › throws ---tty-stream-chunk-separator diff --git a/test-tap/reporters/default.regular.v18.log b/test-tap/reporters/default.regular.v18.log index 5f80ac5d4..9b9a969d3 100644 --- a/test-tap/reporters/default.regular.v18.log +++ b/test-tap/reporters/default.regular.v18.log @@ -30,7 +30,7 @@ ---tty-stream-chunk-separator ✔ output-in-hook › passing test ---tty-stream-chunk-separator - ✘ [fail]: 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 @@ -50,19 +50,19 @@ ---tty-stream-chunk-separator ✔ test › passes ---tty-stream-chunk-separator - ✘ [fail]: test › fails Test failed via `t.fail()` + ✘ [fail]: test › fails Test failed via `t.fail()` ---tty-stream-chunk-separator ✔ [expected fail] test › known failure ---tty-stream-chunk-separator - ✘ [unexpected pass]: 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 - ✘ [fail]: test › logs Test failed via `t.fail()` + ✘ [fail]: test › logs Test failed via `t.fail()` ℹ hello ℹ world ---tty-stream-chunk-separator ✘ [fail]: test › formatted ---tty-stream-chunk-separator - ✘ [fail]: test › implementation throws non-error Error thrown in test + ✘ [fail]: test › implementation throws non-error Error thrown in test ---tty-stream-chunk-separator ✘ [fail]: traces-in-t-throws › throws ---tty-stream-chunk-separator From 2449d74d89679205e360d1c554801a97c1b962b3 Mon Sep 17 00:00:00 2001 From: Mark Wubben Date: Sun, 4 Sep 2022 16:23:18 +0200 Subject: [PATCH 13/13] Update snapshot --- test/snapshot-tests/snapshots/formatting.js.md | 6 +++--- .../snapshot-tests/snapshots/formatting.js.snap | Bin 574 -> 565 bytes 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/snapshot-tests/snapshots/formatting.js.md b/test/snapshot-tests/snapshots/formatting.js.md index ef58e6c35..076bf4f82 100644 --- a/test/snapshot-tests/snapshots/formatting.js.md +++ b/test/snapshot-tests/snapshots/formatting.js.md @@ -31,9 +31,9 @@ Generated by [AVA](https://avajs.dev). > stdout `␊ - √ PASS: a rather wordy test title that is wrapped to meet line length requirements in an unconventional way that may interfere with report formatting␊ - √ PASS: test title␊ - √ PASS: multiline try assertion title␊ + √ a rather wordy test title that is wrapped to meet line length requirements in an unconventional way that may interfere with report formatting␊ + √ test title␊ + √ multiline try assertion title␊ i multiline try assertion title ─ try assertions can have titles too␊ ─␊ ␊ diff --git a/test/snapshot-tests/snapshots/formatting.js.snap b/test/snapshot-tests/snapshots/formatting.js.snap index a24e736969dd3eae723c105adae923a0ea9b5ad9..35cca5ff8ccaabb995764b93ccf2ca5c6a9dde87 100644 GIT binary patch literal 565 zcmV-50?PeCRzV@Ml00000000BUQax`IK@hb;2(cYyx~J`v(Av&obysXHOcgO^M0%iUV&H2h7bLcBtQ zP6k!88V>gl_K!w6QR$!U?#iWPV1~;v;|7C{aHS{*3Ej-is6y;Pk|YZ*^QluM@%Ly9 zFZSS&Zx4pAQENM#H1~Jb>FiPSaWq|6Wk$mZ49Af{2;dX(6Ieq9Hcd`;9Qx4L9Cv!6 z6>S#dFd{Vf4fjoOU#rt-gQv_^w;BF?%kW8`rCfda%EPipIXYNbm({S*fpXb6ymGQE znVc*Xh@5`o3z}oL%HgLIpnF<+}g3!&;VKll6I;;;5 zzSh)rNpw*BrQWwAMLPegd0&xUpvXCbAhjR+5AD9B<$ z^XP4x#^b+9V;#edJl_AeLq#D|XaBM8k9+S-3RzV0X=b}Kdt-&u3VV))^#i@K2Gduc0Dui&3ogotEDo@d-wSQNs_{o zXL+eeDyb2i7KO_Uff7qpz+tIUSR$;9%>@yrkQi$*Ayt9YKpBF?!dQ|`srz)1rh>$~ zessHcx93m)PVfG$AH4xAn)ac_cZHbH(RA(ND0T9pQk{^Q%j#5+JB>2mY;Ilqcxjg#