From e8932f2e49a664c12194fa1370feaae12b91b886 Mon Sep 17 00:00:00 2001 From: fisker Date: Wed, 29 Oct 2025 06:28:50 +0800 Subject: [PATCH 01/17] Replace `strip-ansi` with `node:util.stripVTControlCharacters` --- lib/concordance-options.js | 5 ++--- lib/reporters/tap.js | 10 +++++----- package.json | 1 - test-tap/assert.js | 7 +++---- test-tap/integration/assorted.js | 7 +++---- 5 files changed, 13 insertions(+), 17 deletions(-) diff --git a/lib/concordance-options.js b/lib/concordance-options.js index 3e5fbf4be..141cba7f8 100644 --- a/lib/concordance-options.js +++ b/lib/concordance-options.js @@ -1,8 +1,7 @@ -import {inspect} from 'node:util'; +import {inspect, stripVTControlCharacters} from 'node:util'; 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'; @@ -85,7 +84,7 @@ const colorTheme = { undefined: ansiStyles.yellow, }; -const plainTheme = JSON.parse(JSON.stringify(colorTheme), (_name, value) => typeof value === 'string' ? stripAnsi(value) : value); +const plainTheme = JSON.parse(JSON.stringify(colorTheme), (_name, value) => typeof value === 'string' ? stripVTControlCharacters(value) : value); const theme = chalk.level > 0 ? colorTheme : plainTheme; diff --git a/lib/reporters/tap.js b/lib/reporters/tap.js index 258c927fc..21878d6d6 100644 --- a/lib/reporters/tap.js +++ b/lib/reporters/tap.js @@ -1,9 +1,9 @@ import os from 'node:os'; import path from 'node:path'; +import {stripVTControlCharacters} from 'node:util'; import indentString from 'indent-string'; import plur from 'plur'; -import stripAnsi from 'strip-ansi'; import * as supertap from 'supertap'; import prefixTitle from './prefix-title.js'; @@ -20,7 +20,7 @@ function dumpError({ if (type === 'unknown') { return { message: 'Non-native error', - formatted: stripAnsi(formattedError), + formatted: stripVTControlCharacters(formattedError), }; } @@ -33,8 +33,8 @@ function dumpError({ if (formattedDetails.length > 0) { originalError.details = Object.fromEntries(formattedDetails.map(({label, formatted}) => [ - stripAnsi(label), - stripAnsi(formatted), + stripVTControlCharacters(label), + stripVTControlCharacters(formatted), ])); } } @@ -119,7 +119,7 @@ export default class TapReporter { } writeComment(evt, {title = this.prefixTitle(evt.testFile, evt.title)}) { - this.reportStream.write(`# ${stripAnsi(title)}${os.EOL}`); + this.reportStream.write(`# ${stripVTControlCharacters(title)}${os.EOL}`); if (evt.logs) { for (const log of evt.logs) { const logLines = indentString(log, 4).replaceAll(/^ {4}/gm, '# '); diff --git a/package.json b/package.json index dfa0b63e1..9eb6d670f 100644 --- a/package.json +++ b/package.json @@ -121,7 +121,6 @@ "pretty-ms": "^9.2.0", "resolve-cwd": "^3.0.0", "stack-utils": "^2.0.6", - "strip-ansi": "^7.1.0", "supertap": "^3.0.1", "temp-dir": "^3.0.0", "write-file-atomic": "^6.0.0", diff --git a/test-tap/assert.js b/test-tap/assert.js index 9f47de960..cffe87f3a 100644 --- a/test-tap/assert.js +++ b/test-tap/assert.js @@ -1,7 +1,6 @@ import path from 'node:path'; -import {fileURLToPath} from 'node:url'; +import {fileURLToPath, stripVTControlCharacters} from 'node:url'; -import stripAnsi from 'strip-ansi'; import {test} from 'tap'; import * as assert from '../lib/assert.js'; @@ -70,8 +69,8 @@ function assertFailure(t, subset) { if (subset.formattedDetails) { t.equal(lastFailure.formattedDetails.length, subset.formattedDetails.length); for (const [i, s] of lastFailure.formattedDetails.entries()) { - t.equal(stripAnsi(s.label), subset.formattedDetails[i].label); - t.match(stripAnsi(s.formatted), subset.formattedDetails[i].formatted); + t.equal(stripVTControlCharacters(s.label), subset.formattedDetails[i].label); + t.match(stripVTControlCharacters(s.formatted), subset.formattedDetails[i].formatted); } } else { t.same(lastFailure.formattedDetails, []); diff --git a/test-tap/integration/assorted.js b/test-tap/integration/assorted.js index 694b47c6f..3eae20976 100644 --- a/test-tap/integration/assorted.js +++ b/test-tap/integration/assorted.js @@ -1,10 +1,9 @@ import childProcess from 'node:child_process'; import fs from 'node:fs'; import path from 'node:path'; -import {fileURLToPath} from 'node:url'; +import {fileURLToPath, stripVTControlCharacters} from 'node:url'; import ciInfo from 'ci-info'; -import stripAnsi from 'strip-ansi'; import {test} from 'tap'; import {execCli} from '../helper/cli.js'; @@ -82,7 +81,7 @@ test('tests without assertions do not fail if failWithoutAssertions option is se test('--no-color disables formatting colors', t => { execCli(['--no-color', 'formatting-color.cjs'], (error, stdout) => { t.ok(error); - t.equal(stripAnsi(stdout), stdout); + t.equal(stripVTControlCharacters(stdout), stdout); t.end(); }); }); @@ -90,7 +89,7 @@ test('--no-color disables formatting colors', t => { test('--color enables formatting colors', t => { execCli(['--color', 'formatting-color.cjs'], (error, stdout) => { t.ok(error); - t.not(stripAnsi(stdout), stdout); + t.not(stripVTControlCharacters(stdout), stdout); t.end(); }); }); From 6444e2590039cf22b185388391b59fea5a560ed3 Mon Sep 17 00:00:00 2001 From: fisker Date: Wed, 29 Oct 2025 06:47:06 +0800 Subject: [PATCH 02/17] Lock file --- package-lock.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index fe4112682..e735c84df 100644 --- a/package-lock.json +++ b/package-lock.json @@ -44,7 +44,6 @@ "pretty-ms": "^9.2.0", "resolve-cwd": "^3.0.0", "stack-utils": "^2.0.6", - "strip-ansi": "^7.1.0", "supertap": "^3.0.1", "temp-dir": "^3.0.0", "write-file-atomic": "^6.0.0", From e9d19ccdfb00f2bbcc5d60f2d9f78f43a398aa72 Mon Sep 17 00:00:00 2001 From: fisker Date: Wed, 29 Oct 2025 06:52:32 +0800 Subject: [PATCH 03/17] Fix tests? --- test/external-assertions/snapshots/test.js.md | 49 ++++++++---------- .../snapshots/test.js.snap | Bin 503 -> 500 bytes 2 files changed, 22 insertions(+), 27 deletions(-) diff --git a/test/external-assertions/snapshots/test.js.md b/test/external-assertions/snapshots/test.js.md index 7d97da549..b030661f4 100644 --- a/test/external-assertions/snapshots/test.js.md +++ b/test/external-assertions/snapshots/test.js.md @@ -9,8 +9,8 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `␊ - ✘ [fail]: test Assertion failed␊ - ✘ [fail]: test async Assertion failed␊ + × [fail]: test Assertion failed␊ + × [fail]: test async Assertion failed␊ ─␊ ␊ test␊ @@ -51,8 +51,8 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `␊ - ✘ [fail]: test Assertion failed␊ - ✘ [fail]: test async Assertion failed␊ + × [fail]: test Assertion failed␊ + × [fail]: test async Assertion failed␊ ─␊ ␊ test␊ @@ -101,8 +101,8 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `␊ - ✘ [fail]: test Assertion failed␊ - ✘ [fail]: test async Assertion failed␊ + × [fail]: test Assertion failed␊ + × [fail]: test async Assertion failed␊ ─␊ ␊ test␊ @@ -143,8 +143,8 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `␊ - ✘ [fail]: test Assertion failed␊ - ✘ [fail]: test async Assertion failed␊ + × [fail]: test Assertion failed␊ + × [fail]: test async Assertion failed␊ ─␊ ␊ test␊ @@ -193,8 +193,8 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `␊ - ✘ [fail]: test Assertion failed␊ - ✘ [fail]: test async Assertion failed␊ + × [fail]: test Assertion failed␊ + × [fail]: test async Assertion failed␊ ─␊ ␊ test␊ @@ -240,8 +240,8 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `␊ - ✘ [fail]: test Assertion failed␊ - ✘ [fail]: test async Assertion failed␊ + × [fail]: test Assertion failed␊ + × [fail]: test async Assertion failed␊ ─␊ ␊ test␊ @@ -290,8 +290,8 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `␊ - ✘ [fail]: test Assertion failed␊ - ✘ [fail]: test async Assertion failed␊ + × [fail]: test Assertion failed␊ + × [fail]: test async Assertion failed␊ ─␊ ␊ test␊ @@ -337,8 +337,8 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `␊ - ✘ [fail]: test Assertion failed␊ - ✘ [fail]: test async Assertion failed␊ + × [fail]: test Assertion failed␊ + × [fail]: test async Assertion failed␊ ─␊ ␊ test␊ @@ -387,22 +387,17 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `␊ - ✘ [fail]: test Assertion failed␊ - ✘ [fail]: test async Assertion failed␊ + × [fail]: test Assertion failed␊ + × [fail]: test async Assertion failed␊ ─␊ ␊ test␊ ␊ Assertion failed: ␊ ␊ - The expression evaluated to a falsy value:␊ - ␊ - assert.ok(false)␊ - ␊ - AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:␊ - ␊ - assert.ok(false)␊ + false == true␊ ␊ + AssertionError [ERR_ASSERTION]: false == true␊ at ---␊ at ---␊ at ---␊ @@ -434,8 +429,8 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `␊ - ✘ [fail]: test Assertion failed␊ - ✘ [fail]: test async Assertion failed␊ + × [fail]: test Assertion failed␊ + × [fail]: test async Assertion failed␊ ─␊ ␊ test␊ diff --git a/test/external-assertions/snapshots/test.js.snap b/test/external-assertions/snapshots/test.js.snap index 52bc4f0fbc02458d80b344055c37b49cd0245bab..93281fa9e799fda8d4c2bb77515252bc50388dd9 100644 GIT binary patch literal 500 zcmV?RzVFc^ooi3q)U_75+J&>|~a@i2-zOxVGTLbr>IDY1RW z>Pj=3Y`B|VJqw=aN6}BszP=`U(VJ63*dTQ06@EP3YZ}Bw;yqhogXnFMfFYF2z@r{cl~tpNM$o7_ z&UK|$t2*_wi}R*EGXdgt(V!dbnIBBlr#6GPZ1L630s zfKwoGDgzLGXlrpGqZ696qsNIEKlz*?jqRpa&mKH@na|=I_y#_Sq}!B@c2gW{!1Pj*d})$Dzy2WO_N^Z}UHbTn%ws+d z_k++yAe3Unyf6Tjw~adrgX{8%=Fx!kXeVU!VeGnuk*oasR&FQ9pZs=ixA2x%06t!x zq1h&$-?D%qWl;V49PdRpsfN%|;3QT)-75;jMf|;3VFB-L6Q3efD!`&X&Xv`oD2$+4 zv+bK|y{yetXK=Xhbj^4pbh_*ehCLki&|!e_GOJK1 z=yNC(3)!GB*|Qp20#43t8eHAmV}Mx-@5$b*WIQa*$O;`a$d z7gz`+&SeC=4=p8*WO7C$?5c5Q+E0Gzb*v#WqnSCbnC>{KH>tO^>21lC&NQXlq}w)m tb4(^qicKtT#7N>VVmp>%lVaPb*b<48ViSuSF_K7w>=WgLn17BJ003Tg@D%_6 From 9eb3b50e1acb40257497c8f75139582d911fd93a Mon Sep 17 00:00:00 2001 From: fisker Date: Wed, 29 Oct 2025 07:06:02 +0800 Subject: [PATCH 04/17] =?UTF-8?q?Replace=20`=C3=97`=20with=20`=E2=9C=98`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/external-assertions/snapshots/test.js.md | 32 +++++++++--------- .../snapshots/test.js.snap | Bin 500 -> 530 bytes test/external-assertions/test.js | 1 + 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/test/external-assertions/snapshots/test.js.md b/test/external-assertions/snapshots/test.js.md index b030661f4..7cc308637 100644 --- a/test/external-assertions/snapshots/test.js.md +++ b/test/external-assertions/snapshots/test.js.md @@ -9,8 +9,8 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `␊ - × [fail]: test Assertion failed␊ - × [fail]: test async Assertion failed␊ + ✘ [fail]: test Assertion failed␊ + ✘ [fail]: test async Assertion failed␊ ─␊ ␊ test␊ @@ -51,8 +51,8 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `␊ - × [fail]: test Assertion failed␊ - × [fail]: test async Assertion failed␊ + ✘ [fail]: test Assertion failed␊ + ✘ [fail]: test async Assertion failed␊ ─␊ ␊ test␊ @@ -101,8 +101,8 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `␊ - × [fail]: test Assertion failed␊ - × [fail]: test async Assertion failed␊ + ✘ [fail]: test Assertion failed␊ + ✘ [fail]: test async Assertion failed␊ ─␊ ␊ test␊ @@ -143,8 +143,8 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `␊ - × [fail]: test Assertion failed␊ - × [fail]: test async Assertion failed␊ + ✘ [fail]: test Assertion failed␊ + ✘ [fail]: test async Assertion failed␊ ─␊ ␊ test␊ @@ -193,8 +193,8 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `␊ - × [fail]: test Assertion failed␊ - × [fail]: test async Assertion failed␊ + ✘ [fail]: test Assertion failed␊ + ✘ [fail]: test async Assertion failed␊ ─␊ ␊ test␊ @@ -240,8 +240,8 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `␊ - × [fail]: test Assertion failed␊ - × [fail]: test async Assertion failed␊ + ✘ [fail]: test Assertion failed␊ + ✘ [fail]: test async Assertion failed␊ ─␊ ␊ test␊ @@ -290,8 +290,8 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `␊ - × [fail]: test Assertion failed␊ - × [fail]: test async Assertion failed␊ + ✘ [fail]: test Assertion failed␊ + ✘ [fail]: test async Assertion failed␊ ─␊ ␊ test␊ @@ -337,8 +337,8 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `␊ - × [fail]: test Assertion failed␊ - × [fail]: test async Assertion failed␊ + ✘ [fail]: test Assertion failed␊ + ✘ [fail]: test async Assertion failed␊ ─␊ ␊ test␊ diff --git a/test/external-assertions/snapshots/test.js.snap b/test/external-assertions/snapshots/test.js.snap index 93281fa9e799fda8d4c2bb77515252bc50388dd9..78f3d2f976f8182a02279a51aaab6cbba571dbd9 100644 GIT binary patch literal 530 zcmV+t0`2`lRzVpw7p2FvL;g+ z8=8{c7JJjHXF(5M>Z7PHAijZ5BAd2KO42HpX2t9!?CflI=jYoWX4pJ;T(eDY9+BD1 z!ON|VYatLy(POsT0fo=C3kv9>{CT8fYKYHD42Ny`B5 z5BE@S65DAQz>qR1eg2L|(F)5UbkH$FGjFeC8T=&voz5_TN1Mc<2*n~WuZMxOvgf%T z)XSC1S*cnrS89jHM-5|Y1Neh5$mMcNo5+*0MzzOK+?Tq#e-S!9b^^l&UUt!Bfc`P_ zP>^x~6f#mgD2(o`cxa;CM@!Y1dw?~s$65nLxs7| z-nPunF`T%>*u>&S3?+VJY`b9{<7)u3C*CnW-_50LIwk2B|B~N?fgoiAAZ$u;fFQ;j U6M-5rl!!v?1D|Dp?IRZe0Po2E3;+NC literal 500 zcmV?RzVFc^ooi3q)U_75+J&>|~a@i2-zOxVGTLbr>IDY1RW z>Pj=3Y`B|VJqw=aN6}BszP=`U(VJ63*dTQ06@EP3YZ}Bw;yqhogXnFMfFYF2z@r{cl~tpNM$o7_ z&UK|$t2*_wi}R*EGXdgt(V!dbnIBBlr#6GPZ1L630s zfKwoGDgzLGXlrpGqZ696qsNIEKlz { const normalized = stdout .replaceAll('\r', '') .replaceAll(/\/{3}/g, '//') + .replaceAll('×', '✘') .replaceAll(/(\b)at.*\n/g, '$1at ---\n'); t.snapshot(normalized); From a4bac3009b1ada877ec751e7436c5db6c7d44127 Mon Sep 17 00:00:00 2001 From: fisker Date: Wed, 29 Oct 2025 07:07:15 +0800 Subject: [PATCH 05/17] 24 --- test/external-assertions/snapshots/test.js.md | 8 ++++---- test/external-assertions/snapshots/test.js.snap | Bin 530 -> 501 bytes 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/external-assertions/snapshots/test.js.md b/test/external-assertions/snapshots/test.js.md index 7cc308637..9d0b483ae 100644 --- a/test/external-assertions/snapshots/test.js.md +++ b/test/external-assertions/snapshots/test.js.md @@ -387,8 +387,8 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `␊ - × [fail]: test Assertion failed␊ - × [fail]: test async Assertion failed␊ + ✘ [fail]: test Assertion failed␊ + ✘ [fail]: test async Assertion failed␊ ─␊ ␊ test␊ @@ -429,8 +429,8 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `␊ - × [fail]: test Assertion failed␊ - × [fail]: test async Assertion failed␊ + ✘ [fail]: test Assertion failed␊ + ✘ [fail]: test async Assertion failed␊ ─␊ ␊ test␊ diff --git a/test/external-assertions/snapshots/test.js.snap b/test/external-assertions/snapshots/test.js.snap index 78f3d2f976f8182a02279a51aaab6cbba571dbd9..26b367eb2d0c3e30bc2c38e13fa050e6d5ec377f 100644 GIT binary patch literal 501 zcmVRzVVIPYK00000000B+m%&QIFc`&>jqRpa&mKH@na|=I_y#_Sq}!B@byFN`!1Pj*d})$Dzy2Vj)@?xD4tsn>?(+Z# z`yurZ2xAy=pN3EnZS#&n|GIRd`z$0~)~1|2j69EUa+Q7G%Isvslikkj=H9Xzz{kro zG+M+Dnl^A`94cR*6TRpysv&F`x(h3x?lleKBJrNDutD^;NWc)vW#CZ{XUeKkL?dWa z9p|P}t5u!)`Q=5^o|^#iLpT_Qv9X3WJ=XZ_DID%QT`S%Qn=CtpVGjpgbU9$W%qkRe z#taJiTskO>_gsk3MZb@pZgP5t^{B_&!-6gfoXN-}C(#w>X#aky+}y~K#45-RlZ|5) z;S{W*St=>>{4etyB$;O^63Rf5@gqkPt6+m=21+2!o+0fhCDQ6`6hTGEm>9x733`O1 z2b=$!32o#Y literal 530 zcmV+t0`2`lRzVpw7p2FvL;g+ z8=8{c7JJjHXF(5M>Z7PHAijZ5BAd2KO42HpX2t9!?CflI=jYoWX4pJ;T(eDY9+BD1 z!ON|VYatLy(POsT0fo=C3kv9>{CT8fYKYHD42Ny`B5 z5BE@S65DAQz>qR1eg2L|(F)5UbkH$FGjFeC8T=&voz5_TN1Mc<2*n~WuZMxOvgf%T z)XSC1S*cnrS89jHM-5|Y1Neh5$mMcNo5+*0MzzOK+?Tq#e-S!9b^^l&UUt!Bfc`P_ zP>^x~6f#mgD2(o`cxa;CM@!Y1dw?~s$65nLxs7| z-nPunF`T%>*u>&S3?+VJY`b9{<7)u3C*CnW-_50LIwk2B|B~N?fgoiAAZ$u;fFQ;j U6M-5rl!!v?1D|Dp?IRZe0Po2E3;+NC From 33ba2a1e5a2d7e75c80d714ea69d31b0b769866c Mon Sep 17 00:00:00 2001 From: fisker Date: Wed, 29 Oct 2025 07:15:25 +0800 Subject: [PATCH 06/17] Fix imports --- test-tap/assert.js | 3 ++- test-tap/integration/assorted.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/test-tap/assert.js b/test-tap/assert.js index cffe87f3a..ae0fd3bac 100644 --- a/test-tap/assert.js +++ b/test-tap/assert.js @@ -1,5 +1,6 @@ import path from 'node:path'; -import {fileURLToPath, stripVTControlCharacters} from 'node:url'; +import {fileURLToPath} from 'node:url'; +import {stripVTControlCharacters} from 'node:util'; import {test} from 'tap'; diff --git a/test-tap/integration/assorted.js b/test-tap/integration/assorted.js index 3eae20976..91cefff66 100644 --- a/test-tap/integration/assorted.js +++ b/test-tap/integration/assorted.js @@ -1,7 +1,8 @@ import childProcess from 'node:child_process'; import fs from 'node:fs'; import path from 'node:path'; -import {fileURLToPath, stripVTControlCharacters} from 'node:url'; +import {fileURLToPath} from 'node:url'; +import {stripVTControlCharacters} from 'node:util'; import ciInfo from 'ci-info'; import {test} from 'tap'; From 520e763b640047bb59dc80265d44e587772662b0 Mon Sep 17 00:00:00 2001 From: fisker Date: Wed, 29 Oct 2025 07:18:12 +0800 Subject: [PATCH 07/17] Add comment --- test/external-assertions/test.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/external-assertions/test.js b/test/external-assertions/test.js index b24176d53..09b2aa3f3 100644 --- a/test/external-assertions/test.js +++ b/test/external-assertions/test.js @@ -8,7 +8,9 @@ const snapshotStdout = (t, stdout) => { const normalized = stdout .replaceAll('\r', '') .replaceAll(/\/{3}/g, '//') - .replaceAll('×', '✘') + // Not sure how, but this Symbol may different on different system + // https://github.com/nodejs/node/blob/dec0213c834607e7721ee250d8c46ef9cd112efe/lib/internal/test_runner/reporter/utils.js#L21 + .replaceAll('× ', '✘ ') .replaceAll(/(\b)at.*\n/g, '$1at ---\n'); t.snapshot(normalized); From 6a7dc7142939351904b794b15d23d417a4c2fa90 Mon Sep 17 00:00:00 2001 From: fisker Date: Wed, 29 Oct 2025 07:32:03 +0800 Subject: [PATCH 08/17] Update snapshots --- test/external-assertions/snapshots/test.js.md | 9 ++------- test/external-assertions/snapshots/test.js.snap | Bin 501 -> 502 bytes 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/test/external-assertions/snapshots/test.js.md b/test/external-assertions/snapshots/test.js.md index 9d0b483ae..174c6b260 100644 --- a/test/external-assertions/snapshots/test.js.md +++ b/test/external-assertions/snapshots/test.js.md @@ -298,14 +298,9 @@ Generated by [AVA](https://avajs.dev). ␊ Assertion failed: ␊ ␊ - The expression evaluated to a falsy value:␊ - ␊ - assert.ok(false)␊ - ␊ - AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:␊ - ␊ - assert.ok(false)␊ + false == true␊ ␊ + AssertionError [ERR_ASSERTION]: false == true␊ at ---␊ at ---␊ at ---␊ diff --git a/test/external-assertions/snapshots/test.js.snap b/test/external-assertions/snapshots/test.js.snap index 26b367eb2d0c3e30bc2c38e13fa050e6d5ec377f..3b34f8e5bf59216f25106eb362759b68d5b79dc5 100644 GIT binary patch delta 394 zcmV;50d@ZM1NH+lK~_N^Q*L2!b7*gLAa*kf0|0p6WkS(!U9uB(ba=>_-RVd_)85Hul zbWj*Sb0I<({XTlS$>|x^qaJS$3%V$9CNq`!NGS5;Zlz}AUM~);`!3N6=lt7w2L)uYoN~G1>D1wTRF)@XG67&d14>$!9 z=Q0E_hPD<*GCre8JB2ti{U@*VI`)v6(bOE5Pj;Nro6_6b^tR-e&a%{p)n-X2@t1BP o3d%T=aU(|(e=*LnGLAA%G78E#l5rzP5=oGK0$#Z=D!>*10Jl7|rT_o{ delta 393 zcmV;40e1fO1N8$kK~_N^Q*L2!b7*gLAa*kf0{}{j0@;Lb@yRt6om#sLEn4!l6lr`> zCT8k`PLw=f#bJ>$N}14~k-iofpA)_4Evg}G7`h89pYAmc;v(^$ zudqS%k?bCSn*i}cI2eYpv4%E1*7)ox9PT?^E8Ym3EIWl^4+mXzIbgiZDim_Y3<~*N zIw*|yT!_#`zmJ}7a(agKsK?vGf-VZ2$;c!p(G}-t|9-06+{lr{D##9#jbjzz6s)3I zDk<~)FY_EEnP({y%0QCwBS#XeV1s1_N+8XiA?+w^CDQ6`6hTGEm>9x733`O12b=$!T#d20 From bb2c0cadef0a96a9364eb54a1e759b2c56165a67 Mon Sep 17 00:00:00 2001 From: fisker Date: Wed, 29 Oct 2025 07:36:07 +0800 Subject: [PATCH 09/17] Add `check-latest` --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 737d4870e..f5c6dba01 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,6 +33,7 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: npm + check-latest: true - run: npm install --no-audit - run: ./scripts/ci.sh shell: bash From fc7cfbb16e66a9811fd79d9b6bf30be0e86dde6f Mon Sep 17 00:00:00 2001 From: fisker Date: Wed, 29 Oct 2025 07:44:57 +0800 Subject: [PATCH 10/17] Fix? --- test/external-assertions/test.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/test/external-assertions/test.js b/test/external-assertions/test.js index 09b2aa3f3..e555cd40e 100644 --- a/test/external-assertions/test.js +++ b/test/external-assertions/test.js @@ -5,7 +5,7 @@ import test from '@ava/test'; import {fixture} from '../helpers/exec.js'; const snapshotStdout = (t, stdout) => { - const normalized = stdout + let normalized = stdout .replaceAll('\r', '') .replaceAll(/\/{3}/g, '//') // Not sure how, but this Symbol may different on different system @@ -13,6 +13,26 @@ const snapshotStdout = (t, stdout) => { .replaceAll('× ', '✘ ') .replaceAll(/(\b)at.*\n/g, '$1at ---\n'); + if (/^22\./.test(process.versions.node)) { + console.log({normalized}); + normalized = normalized.replace( + ` +The expression evaluated to a falsy value: + + assert.ok(false) + +AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value: + + assert.ok(false) +`.split('\n').map(line => line ? ` ${line}` : '').join('\n'), + ` +false == true + +AssertionError [ERR_ASSERTION]: false == true +`.split('\n').map(line => line ? ` ${line}` : '').join('\n'), + ); + } + t.snapshot(normalized); }; From f04823450d7b3353cf9061f49aee88bf5fb13bec Mon Sep 17 00:00:00 2001 From: fisker Date: Wed, 29 Oct 2025 07:45:35 +0800 Subject: [PATCH 11/17] Remove `check-latest` --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f5c6dba01..737d4870e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,6 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: npm - check-latest: true - run: npm install --no-audit - run: ./scripts/ci.sh shell: bash From 82d5fb5be046a56f8abb8a85a4d826af505c6b04 Mon Sep 17 00:00:00 2001 From: fisker Date: Wed, 29 Oct 2025 07:52:08 +0800 Subject: [PATCH 12/17] Fix? --- test/external-assertions/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/external-assertions/test.js b/test/external-assertions/test.js index e555cd40e..7f7310826 100644 --- a/test/external-assertions/test.js +++ b/test/external-assertions/test.js @@ -29,7 +29,7 @@ AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value: false == true AssertionError [ERR_ASSERTION]: false == true -`.split('\n').map(line => line ? ` ${line}` : '').join('\n'), +`.split('\n').map(line => line ? ` ${line}` : '').join('\n') + '\n', ); } From cebfa85b00d4d4cda11c409e93f201a99dbf5a8a Mon Sep 17 00:00:00 2001 From: fisker Date: Wed, 29 Oct 2025 07:55:34 +0800 Subject: [PATCH 13/17] Fix? --- test/external-assertions/test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/external-assertions/test.js b/test/external-assertions/test.js index 7f7310826..1b82d6f58 100644 --- a/test/external-assertions/test.js +++ b/test/external-assertions/test.js @@ -24,12 +24,12 @@ The expression evaluated to a falsy value: AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value: assert.ok(false) -`.split('\n').map(line => line ? ` ${line}` : '').join('\n'), +`.split('\n').map(line => line ? ` ${line}` : '').join('\n') + '\n', ` false == true AssertionError [ERR_ASSERTION]: false == true -`.split('\n').map(line => line ? ` ${line}` : '').join('\n') + '\n', +`.split('\n').map(line => line ? ` ${line}` : '').join('\n'), ); } From eadfa26e13fe1ab9aff3941c38c0b6eed2e480a0 Mon Sep 17 00:00:00 2001 From: fisker Date: Wed, 29 Oct 2025 08:04:44 +0800 Subject: [PATCH 14/17] Minor tweak --- test/external-assertions/test.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/external-assertions/test.js b/test/external-assertions/test.js index 1b82d6f58..a4959b2d6 100644 --- a/test/external-assertions/test.js +++ b/test/external-assertions/test.js @@ -24,7 +24,8 @@ The expression evaluated to a falsy value: AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value: assert.ok(false) -`.split('\n').map(line => line ? ` ${line}` : '').join('\n') + '\n', + +`.split('\n').map(line => line ? ` ${line}` : '').join('\n'), ` false == true From 62e5577de1d1ab5456dd50f2515a2f7c34466d68 Mon Sep 17 00:00:00 2001 From: Mark Wubben Date: Wed, 5 Nov 2025 16:04:41 +0100 Subject: [PATCH 15/17] Pin latest node@22 and npm@11 --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index dfa0b63e1..9e8e1337f 100644 --- a/package.json +++ b/package.json @@ -153,7 +153,7 @@ } }, "volta": { - "node": "22.16.0", - "npm": "11.4.1" + "node": "22.21.1", + "npm": "11.6.2" } } From a83af9fe32c82fa665e51e3e4477a743d49b3348 Mon Sep 17 00:00:00 2001 From: Mark Wubben Date: Wed, 5 Nov 2025 16:06:11 +0100 Subject: [PATCH 16/17] Update Node.js assertion output snapshots --- test/external-assertions/snapshots/test.js.md | 18 ++++-------------- .../snapshots/test.js.snap | Bin 503 -> 502 bytes 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/test/external-assertions/snapshots/test.js.md b/test/external-assertions/snapshots/test.js.md index 7d97da549..174c6b260 100644 --- a/test/external-assertions/snapshots/test.js.md +++ b/test/external-assertions/snapshots/test.js.md @@ -298,14 +298,9 @@ Generated by [AVA](https://avajs.dev). ␊ Assertion failed: ␊ ␊ - The expression evaluated to a falsy value:␊ - ␊ - assert.ok(false)␊ - ␊ - AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:␊ - ␊ - assert.ok(false)␊ + false == true␊ ␊ + AssertionError [ERR_ASSERTION]: false == true␊ at ---␊ at ---␊ at ---␊ @@ -395,14 +390,9 @@ Generated by [AVA](https://avajs.dev). ␊ Assertion failed: ␊ ␊ - The expression evaluated to a falsy value:␊ - ␊ - assert.ok(false)␊ - ␊ - AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:␊ - ␊ - assert.ok(false)␊ + false == true␊ ␊ + AssertionError [ERR_ASSERTION]: false == true␊ at ---␊ at ---␊ at ---␊ diff --git a/test/external-assertions/snapshots/test.js.snap b/test/external-assertions/snapshots/test.js.snap index 52bc4f0fbc02458d80b344055c37b49cd0245bab..3b34f8e5bf59216f25106eb362759b68d5b79dc5 100644 GIT binary patch literal 502 zcmVF00000000B+m%&QIFc`&>jqRpa&mKH@na|=I_y#_Sq}!B@byFNRu;fybd}*3Lzy4@Pt=oXQ9rpN&+~)xf z_Cx9+5XLa#J`JHD`sN*j{&nd@_gP4~tW7z47} zj2RU2xpYt%KXV~M7yUkZy220#43t2cJww`2N~G1>D1wTRF)@XG67&d1 z4>$!9=Q0E_hPD<*GCre8JB2ti{U@*VI`)v6(bOE5Pj;Nro6_6b^tR-e&a%{p)n-X2 s@t1BP3d%T=aU(|(e=*LnGLAA%G78E#l5rzP5=oGK0$#Z=D!>*10Djo!2mk;8 literal 503 zcmV*?jqRpa&mKH@na|=I_y#_Sq}!B@c2gW{!1Pj*d})$Dzy2WO_N^Z}UHbTn%ws+d z_k++yAe3Unyf6Tjw~adrgX{8%=Fx!kXeVU!VeGnuk*oasR&FQ9pZs=ixA2x%06t!x zq1h&$-?D%qWl;V49PdRpsfN%|;3QT)-75;jMf|;3VFB-L6Q3efD!`&X&Xv`oD2$+4 zv+bK|y{yetXK=Xhbj^4pbh_*ehCLki&|!e_GOJK1 z=yNC(3)!GB*|Qp20#43t8eHAmV}Mx-@5$b*WIQa*$O;`a$d z7gz`+&SeC=4=p8*WO7C$?5c5Q+E0Gzb*v#WqnSCbnC>{KH>tO^>21lC&NQXlq}w)m tb4(^qicKtT#7N>VVmp>%lVaPb*b<48ViSuSF_K7w>=WgLn17BJ003Tg@D%_6 From 21db2ed8ad6df63b1a8644eeb5ec459ab36a23a2 Mon Sep 17 00:00:00 2001 From: Mark Wubben Date: Wed, 5 Nov 2025 16:09:13 +0100 Subject: [PATCH 17/17] Revert unnecessary changes --- test/external-assertions/test.js | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/test/external-assertions/test.js b/test/external-assertions/test.js index a4959b2d6..4851d2c98 100644 --- a/test/external-assertions/test.js +++ b/test/external-assertions/test.js @@ -5,35 +5,11 @@ import test from '@ava/test'; import {fixture} from '../helpers/exec.js'; const snapshotStdout = (t, stdout) => { - let normalized = stdout + const normalized = stdout .replaceAll('\r', '') .replaceAll(/\/{3}/g, '//') - // Not sure how, but this Symbol may different on different system - // https://github.com/nodejs/node/blob/dec0213c834607e7721ee250d8c46ef9cd112efe/lib/internal/test_runner/reporter/utils.js#L21 - .replaceAll('× ', '✘ ') .replaceAll(/(\b)at.*\n/g, '$1at ---\n'); - if (/^22\./.test(process.versions.node)) { - console.log({normalized}); - normalized = normalized.replace( - ` -The expression evaluated to a falsy value: - - assert.ok(false) - -AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value: - - assert.ok(false) - -`.split('\n').map(line => line ? ` ${line}` : '').join('\n'), - ` -false == true - -AssertionError [ERR_ASSERTION]: false == true -`.split('\n').map(line => line ? ` ${line}` : '').join('\n'), - ); - } - t.snapshot(normalized); };