diff --git a/android-configure b/android-configure index 0467e7a90b79a4..b2628f95e8e4f4 100755 --- a/android-configure +++ b/android-configure @@ -9,7 +9,6 @@ command -v python3.13 >/dev/null && exec python3.13 "$0" "$@" command -v python3.12 >/dev/null && exec python3.12 "$0" "$@" command -v python3.11 >/dev/null && exec python3.11 "$0" "$@" command -v python3.10 >/dev/null && exec python3.10 "$0" "$@" -command -v python3.9 >/dev/null && exec python3.9 "$0" "$@" command -v python3 >/dev/null && exec python3 "$0" "$@" exec python "$0" "$@" ''' "$0" "$@" @@ -23,7 +22,7 @@ except ImportError: from distutils.spawn import find_executable as which print('Node.js android configure: Found Python {}.{}.{}...'.format(*sys.version_info)) -acceptable_pythons = ((3, 14), (3, 13), (3, 12), (3, 11), (3, 10), (3, 9)) +acceptable_pythons = ((3, 14), (3, 13), (3, 12), (3, 11), (3, 10)) if sys.version_info[:2] in acceptable_pythons: import android_configure else: diff --git a/configure b/configure index 0d8f79ba9ab396..f39c2d55e83dbb 100755 --- a/configure +++ b/configure @@ -9,7 +9,6 @@ command -v python3.13 >/dev/null && exec python3.13 "$0" "$@" command -v python3.12 >/dev/null && exec python3.12 "$0" "$@" command -v python3.11 >/dev/null && exec python3.11 "$0" "$@" command -v python3.10 >/dev/null && exec python3.10 "$0" "$@" -command -v python3.9 >/dev/null && exec python3.9 "$0" "$@" command -v python3 >/dev/null && exec python3 "$0" "$@" exec python "$0" "$@" ''' "$0" "$@" @@ -23,7 +22,7 @@ except ImportError: from distutils.spawn import find_executable as which print('Node.js configure: Found Python {}.{}.{}...'.format(*sys.version_info)) -acceptable_pythons = ((3, 14), (3, 13), (3, 12), (3, 11), (3, 10), (3, 9)) +acceptable_pythons = ((3, 14), (3, 13), (3, 12), (3, 11), (3, 10)) if sys.version_info[:2] in acceptable_pythons: import configure else: diff --git a/configure.py b/configure.py index d24bc8103223de..4c38b55a9f9929 100755 --- a/configure.py +++ b/configure.py @@ -2409,7 +2409,7 @@ def make_bin_override(): if sys.platform == 'win32': raise Exception('make_bin_override should not be called on win32.') # If the system python is not the python we are running (which should be - # python 3.9+), then create a directory with a symlink called `python` to our + # python 3.10+), then create a directory with a symlink called `python` to our # sys.executable. This directory will be prefixed to the PATH, so that # other tools that shell out to `python` will use the appropriate python diff --git a/deps/sqlite/sqlite3.c b/deps/sqlite/sqlite3.c index 912ac26944c6b9..b44fb754da8bdb 100644 --- a/deps/sqlite/sqlite3.c +++ b/deps/sqlite/sqlite3.c @@ -1,6 +1,6 @@ /****************************************************************************** ** This file is an amalgamation of many separate C source files from SQLite -** version 3.51.1. By combining all the individual C code files into this +** version 3.51.2. By combining all the individual C code files into this ** single large file, the entire code can be compiled as a single translation ** unit. This allows many compilers to do optimizations that would not be ** possible if the files were compiled separately. Performance improvements @@ -18,7 +18,7 @@ ** separate file. This file contains only code for the core SQLite library. ** ** The content in this amalgamation comes from Fossil check-in -** 281fc0e9afc38674b9b0991943b9e9d1e64c with changes in files: +** b270f8339eb13b504d0b2ba154ebca966b7d with changes in files: ** ** */ @@ -467,12 +467,12 @@ extern "C" { ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.51.1" -#define SQLITE_VERSION_NUMBER 3051001 -#define SQLITE_SOURCE_ID "2025-11-28 17:28:25 281fc0e9afc38674b9b0991943b9e9d1e64c6cbdb133d35f6f5c87ff6af38a88" +#define SQLITE_VERSION "3.51.2" +#define SQLITE_VERSION_NUMBER 3051002 +#define SQLITE_SOURCE_ID "2026-01-09 17:27:48 b270f8339eb13b504d0b2ba154ebca966b7dde08e40c3ed7d559749818cb2075" #define SQLITE_SCM_BRANCH "branch-3.51" -#define SQLITE_SCM_TAGS "release version-3.51.1" -#define SQLITE_SCM_DATETIME "2025-11-28T17:28:25.933Z" +#define SQLITE_SCM_TAGS "release version-3.51.2" +#define SQLITE_SCM_DATETIME "2026-01-09T17:27:48.405Z" /* ** CAPI3REF: Run-Time Library Version Numbers @@ -41228,12 +41228,18 @@ static int unixLock(sqlite3_file *id, int eFileLock){ pInode->nLock++; pInode->nShared = 1; } - }else if( (eFileLock==EXCLUSIVE_LOCK && pInode->nShared>1) - || unixIsSharingShmNode(pFile) - ){ + }else if( eFileLock==EXCLUSIVE_LOCK && pInode->nShared>1 ){ /* We are trying for an exclusive lock but another thread in this ** same process is still holding a shared lock. */ rc = SQLITE_BUSY; + }else if( unixIsSharingShmNode(pFile) ){ + /* We are in WAL mode and attempting to delete the SHM and WAL + ** files due to closing the connection or changing out of WAL mode, + ** but another process still holds locks on the SHM file, thus + ** indicating that database locks have been broken, perhaps due + ** to a rogue close(open(dbFile)) or similar. + */ + rc = SQLITE_BUSY; }else{ /* The request was for a RESERVED or EXCLUSIVE lock. It is ** assumed that there is a SHARED or greater lock on the file @@ -43872,26 +43878,21 @@ static int unixFcntlExternalReader(unixFile *pFile, int *piOut){ ** still not a disaster. */ static int unixIsSharingShmNode(unixFile *pFile){ - int rc; unixShmNode *pShmNode; + struct flock lock; if( pFile->pShm==0 ) return 0; if( pFile->ctrlFlags & UNIXFILE_EXCL ) return 0; pShmNode = pFile->pShm->pShmNode; - rc = 1; - unixEnterMutex(); - if( ALWAYS(pShmNode->nRef==1) ){ - struct flock lock; - lock.l_whence = SEEK_SET; - lock.l_start = UNIX_SHM_DMS; - lock.l_len = 1; - lock.l_type = F_WRLCK; - osFcntl(pShmNode->hShm, F_GETLK, &lock); - if( lock.l_type==F_UNLCK ){ - rc = 0; - } - } - unixLeaveMutex(); - return rc; +#if SQLITE_ATOMIC_INTRINSICS + assert( AtomicLoad(&pShmNode->nRef)==1 ); +#endif + memset(&lock, 0, sizeof(lock)); + lock.l_whence = SEEK_SET; + lock.l_start = UNIX_SHM_DMS; + lock.l_len = 1; + lock.l_type = F_WRLCK; + osFcntl(pShmNode->hShm, F_GETLK, &lock); + return (lock.l_type!=F_UNLCK); } /* @@ -115316,9 +115317,22 @@ SQLITE_PRIVATE int sqlite3CodeSubselect(Parse *pParse, Expr *pExpr){ pParse->nMem += nReg; if( pExpr->op==TK_SELECT ){ dest.eDest = SRT_Mem; - dest.iSdst = dest.iSDParm; + if( (pSel->selFlags&SF_Distinct) && pSel->pLimit && pSel->pLimit->pRight ){ + /* If there is both a DISTINCT and an OFFSET clause, then allocate + ** a separate dest.iSdst array for sqlite3Select() and other + ** routines to populate. In this case results will be copied over + ** into the dest.iSDParm array only after OFFSET processing. This + ** ensures that in the case where OFFSET excludes all rows, the + ** dest.iSDParm array is not left populated with the contents of the + ** last row visited - it should be all NULLs if all rows were + ** excluded by OFFSET. */ + dest.iSdst = pParse->nMem+1; + pParse->nMem += nReg; + }else{ + dest.iSdst = dest.iSDParm; + } dest.nSdst = nReg; - sqlite3VdbeAddOp3(v, OP_Null, 0, dest.iSDParm, dest.iSDParm+nReg-1); + sqlite3VdbeAddOp3(v, OP_Null, 0, dest.iSDParm, pParse->nMem); VdbeComment((v, "Init subquery result")); }else{ dest.eDest = SRT_Exists; @@ -148186,9 +148200,14 @@ static void selectInnerLoop( assert( nResultCol<=pDest->nSdst ); pushOntoSorter( pParse, pSort, p, regResult, regOrig, nResultCol, nPrefixReg); + pDest->iSDParm = regResult; }else{ assert( nResultCol==pDest->nSdst ); - assert( regResult==iParm ); + if( regResult!=iParm ){ + /* This occurs in cases where the SELECT had both a DISTINCT and + ** an OFFSET clause. */ + sqlite3VdbeAddOp3(v, OP_Copy, regResult, iParm, nResultCol-1); + } /* The LIMIT clause will jump out of the loop for us */ } break; @@ -154203,12 +154222,24 @@ static SQLITE_NOINLINE void existsToJoin( && (pSub->selFlags & SF_Aggregate)==0 && !pSub->pSrc->a[0].fg.isSubquery && pSub->pLimit==0 + && pSub->pPrior==0 ){ + /* Before combining the sub-select with the parent, renumber the + ** cursor used by the subselect. This is because the EXISTS expression + ** might be a copy of another EXISTS expression from somewhere + ** else in the tree, and in this case it is important that it use + ** a unique cursor number. */ + sqlite3 *db = pParse->db; + int *aCsrMap = sqlite3DbMallocZero(db, (pParse->nTab+2)*sizeof(int)); + if( aCsrMap==0 ) return; + aCsrMap[0] = (pParse->nTab+1); + renumberCursors(pParse, pSub, -1, aCsrMap); + sqlite3DbFree(db, aCsrMap); + memset(pWhere, 0, sizeof(*pWhere)); pWhere->op = TK_INTEGER; pWhere->u.iValue = 1; ExprSetProperty(pWhere, EP_IntValue); - assert( p->pWhere!=0 ); pSub->pSrc->a[0].fg.fromExists = 1; pSub->pSrc->a[0].fg.jointype |= JT_CROSS; @@ -174001,6 +174032,9 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){ sqlite3 *db = pParse->db; int iEnd = sqlite3VdbeCurrentAddr(v); int nRJ = 0; +#ifndef SQLITE_DISABLE_SKIPAHEAD_DISTINCT + int addrSeek = 0; +#endif /* Generate loop termination code. */ @@ -174013,7 +174047,10 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){ ** the RIGHT JOIN table */ WhereRightJoin *pRJ = pLevel->pRJ; sqlite3VdbeResolveLabel(v, pLevel->addrCont); - pLevel->addrCont = 0; + /* Replace addrCont with a new label that will never be used, just so + ** the subsequent call to resolve pLevel->addrCont will have something + ** to resolve. */ + pLevel->addrCont = sqlite3VdbeMakeLabel(pParse); pRJ->endSubrtn = sqlite3VdbeCurrentAddr(v); sqlite3VdbeAddOp3(v, OP_Return, pRJ->regReturn, pRJ->addrSubrtn, 1); VdbeCoverage(v); @@ -174022,7 +174059,6 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){ pLoop = pLevel->pWLoop; if( pLevel->op!=OP_Noop ){ #ifndef SQLITE_DISABLE_SKIPAHEAD_DISTINCT - int addrSeek = 0; Index *pIdx; int n; if( pWInfo->eDistinct==WHERE_DISTINCT_ORDERED @@ -174045,25 +174081,26 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){ sqlite3VdbeAddOp2(v, OP_Goto, 1, pLevel->p2); } #endif /* SQLITE_DISABLE_SKIPAHEAD_DISTINCT */ - if( pTabList->a[pLevel->iFrom].fg.fromExists && i==pWInfo->nLevel-1 ){ - /* If the EXISTS-to-JOIN optimization was applied, then the EXISTS - ** loop(s) will be the inner-most loops of the join. There might be - ** multiple EXISTS loops, but they will all be nested, and the join - ** order will not have been changed by the query planner. If the - ** inner-most EXISTS loop sees a single successful row, it should - ** break out of *all* EXISTS loops. But only the inner-most of the - ** nested EXISTS loops should do this breakout. */ - int nOuter = 0; /* Nr of outer EXISTS that this one is nested within */ - while( nOutera[pLevel[-nOuter-1].iFrom].fg.fromExists ) break; - nOuter++; - } - testcase( nOuter>0 ); - sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel[-nOuter].addrBrk); - VdbeComment((v, "EXISTS break")); - } - /* The common case: Advance to the next row */ - if( pLevel->addrCont ) sqlite3VdbeResolveLabel(v, pLevel->addrCont); + } + if( pTabList->a[pLevel->iFrom].fg.fromExists && i==pWInfo->nLevel-1 ){ + /* If the EXISTS-to-JOIN optimization was applied, then the EXISTS + ** loop(s) will be the inner-most loops of the join. There might be + ** multiple EXISTS loops, but they will all be nested, and the join + ** order will not have been changed by the query planner. If the + ** inner-most EXISTS loop sees a single successful row, it should + ** break out of *all* EXISTS loops. But only the inner-most of the + ** nested EXISTS loops should do this breakout. */ + int nOuter = 0; /* Nr of outer EXISTS that this one is nested within */ + while( nOutera[pLevel[-nOuter-1].iFrom].fg.fromExists ) break; + nOuter++; + } + testcase( nOuter>0 ); + sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel[-nOuter].addrBrk); + VdbeComment((v, "EXISTS break")); + } + sqlite3VdbeResolveLabel(v, pLevel->addrCont); + if( pLevel->op!=OP_Noop ){ sqlite3VdbeAddOp3(v, pLevel->op, pLevel->p1, pLevel->p2, pLevel->p3); sqlite3VdbeChangeP5(v, pLevel->p5); VdbeCoverage(v); @@ -174076,10 +174113,11 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){ VdbeCoverage(v); } #ifndef SQLITE_DISABLE_SKIPAHEAD_DISTINCT - if( addrSeek ) sqlite3VdbeJumpHere(v, addrSeek); + if( addrSeek ){ + sqlite3VdbeJumpHere(v, addrSeek); + addrSeek = 0; + } #endif - }else if( pLevel->addrCont ){ - sqlite3VdbeResolveLabel(v, pLevel->addrCont); } if( (pLoop->wsFlags & WHERE_IN_ABLE)!=0 && pLevel->u.in.nIn>0 ){ struct InLoop *pIn; @@ -219453,7 +219491,7 @@ static void rtreenode(sqlite3_context *ctx, int nArg, sqlite3_value **apArg){ if( node.zData==0 ) return; nData = sqlite3_value_bytes(apArg[1]); if( nData<4 ) return; - if( nDatanLevel ){ if( fts5IndexMerge(p, &pStruct, nMerge, nMin) ){ @@ -260304,7 +260348,7 @@ static void fts5SourceIdFunc( ){ assert( nArg==0 ); UNUSED_PARAM2(nArg, apUnused); - sqlite3_result_text(pCtx, "fts5: 2025-11-28 17:28:25 281fc0e9afc38674b9b0991943b9e9d1e64c6cbdb133d35f6f5c87ff6af38a88", -1, SQLITE_TRANSIENT); + sqlite3_result_text(pCtx, "fts5: 2026-01-09 17:27:48 b270f8339eb13b504d0b2ba154ebca966b7dde08e40c3ed7d559749818cb2075", -1, SQLITE_TRANSIENT); } /* diff --git a/deps/sqlite/sqlite3.h b/deps/sqlite/sqlite3.h index 76c567d050a0e1..6e975a6d199273 100644 --- a/deps/sqlite/sqlite3.h +++ b/deps/sqlite/sqlite3.h @@ -146,12 +146,12 @@ extern "C" { ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.51.1" -#define SQLITE_VERSION_NUMBER 3051001 -#define SQLITE_SOURCE_ID "2025-11-28 17:28:25 281fc0e9afc38674b9b0991943b9e9d1e64c6cbdb133d35f6f5c87ff6af38a88" +#define SQLITE_VERSION "3.51.2" +#define SQLITE_VERSION_NUMBER 3051002 +#define SQLITE_SOURCE_ID "2026-01-09 17:27:48 b270f8339eb13b504d0b2ba154ebca966b7dde08e40c3ed7d559749818cb2075" #define SQLITE_SCM_BRANCH "branch-3.51" -#define SQLITE_SCM_TAGS "release version-3.51.1" -#define SQLITE_SCM_DATETIME "2025-11-28T17:28:25.933Z" +#define SQLITE_SCM_TAGS "release version-3.51.2" +#define SQLITE_SCM_DATETIME "2026-01-09T17:27:48.405Z" /* ** CAPI3REF: Run-Time Library Version Numbers diff --git a/doc/api/packages.md b/doc/api/packages.md index 6110d25be530a7..b14c107e14fcca 100644 --- a/doc/api/packages.md +++ b/doc/api/packages.md @@ -620,7 +620,7 @@ import featureY from 'es-module-package/features/y/y.js'; // Loads ./node_modules/es-module-package/src/features/y/y.js import internalZ from '#internal/z.js'; -// Loads ./node_modules/es-module-package/src/internal/z.js +// Loads ./src/internal/z.js ``` This is a direct static matching and replacement without any special handling diff --git a/doc/api/test.md b/doc/api/test.md index 29d071e668b8c6..927208af853d38 100644 --- a/doc/api/test.md +++ b/doc/api/test.md @@ -224,6 +224,57 @@ test('todo() method with message', (t) => { }); ``` +## Expecting tests to fail + + + +This flips the pass/fail reporting for a specific test or suite: A flagged test/test-case must throw +in order to "pass"; a test/test-case that does not throw, fails. + +In the following, `doTheThing()` returns _currently_ `false` (`false` does not equal `true`, causing +`strictEqual` to throw, so the test-case passes). + +```js +it.expectFailure('should do the thing', () => { + assert.strictEqual(doTheThing(), true); +}); + +it('should do the thing', { expectFailure: true }, () => { + assert.strictEqual(doTheThing(), true); +}); +``` + +`skip` and/or `todo` are mutually exclusive to `expectFailure`, and `skip` or `todo` +will "win" when both are applied (`skip` wins against both, and `todo` wins +against `expectFailure`). + +These tests will be skipped (and not run): + +```js +it.expectFailure('should do the thing', { skip: true }, () => { + assert.strictEqual(doTheThing(), true); +}); + +it.skip('should do the thing', { expectFailure: true }, () => { + assert.strictEqual(doTheThing(), true); +}); +``` + +These tests will be marked "todo" (silencing errors): + +```js +it.expectFailure('should do the thing', { todo: true }, () => { + assert.strictEqual(doTheThing(), true); +}); + +it.todo('should do the thing', { expectFailure: true }, () => { + assert.strictEqual(doTheThing(), true); +}); +``` + ## `describe()` and `it()` aliases Suites and tests can also be written using the `describe()` and `it()` diff --git a/doc/api/tls.md b/doc/api/tls.md index faa2c3eced54b5..ffd69849ad53a2 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -952,6 +952,18 @@ The listener callback is passed a single argument when called: Typically, the `response` is a digitally signed object from the server's CA that contains information about server's certificate revocation status. +### Event: `'secure'` + + + +The `'secure'` event is emitted after the TLS handshake has successfully +completed and a secure connection has been established. + +This event is emitted on both client and server {tls.TLSSocket} instances, +including sockets created using the `new tls.TLSSocket()` constructor. + ### Event: `'secureConnect'` - + + - - - - - + + + + + - + - - + + diff --git a/test/fixtures/test-runner/output/lcov_reporter.js b/test/fixtures/test-runner/output/lcov_reporter.js index a4669a85f2724f..832b5d2247965c 100644 --- a/test/fixtures/test-runner/output/lcov_reporter.js +++ b/test/fixtures/test-runner/output/lcov_reporter.js @@ -3,14 +3,14 @@ require('../../../common'); const fixtures = require('../../../common/fixtures'); const spawn = require('node:child_process').spawn; -spawn(process.execPath, - [ - '--no-warnings', - '--experimental-test-coverage', - '--test-coverage-exclude=!test/**', - '--test-reporter', - 'lcov', - fixtures.path('test-runner/output/output.js'), - ], - { stdio: 'inherit' }, +spawn( + process.execPath, + [ + '--no-warnings', + '--experimental-test-coverage', + '--test-coverage-exclude=!test/**', + '--test-reporter', 'lcov', + fixtures.path('test-runner/output/output.js'), + ], + { stdio: 'inherit' }, ); diff --git a/test/fixtures/test-runner/output/lcov_reporter.snapshot b/test/fixtures/test-runner/output/lcov_reporter.snapshot index 4dd0c0dc96a0de..fca250d2844291 100644 --- a/test/fixtures/test-runner/output/lcov_reporter.snapshot +++ b/test/fixtures/test-runner/output/lcov_reporter.snapshot @@ -3,110 +3,116 @@ SF:test/fixtures/test-runner/output/output.js FN:8,anonymous_0 FN:12,anonymous_1 FN:16,anonymous_2 -FN:21,anonymous_3 -FN:26,anonymous_4 -FN:30,anonymous_5 -FN:34,anonymous_6 -FN:38,anonymous_7 -FN:42,anonymous_8 -FN:46,anonymous_9 +FN:20,anonymous_3 +FN:24,anonymous_4 +FN:28,anonymous_5 +FN:32,anonymous_6 +FN:36,anonymous_7 +FN:40,anonymous_8 +FN:45,anonymous_9 FN:50,anonymous_10 FN:54,anonymous_11 -FN:59,anonymous_12 -FN:64,anonymous_13 -FN:68,anonymous_14 -FN:72,anonymous_15 -FN:76,anonymous_16 -FN:80,anonymous_17 -FN:81,anonymous_18 -FN:86,anonymous_19 -FN:87,anonymous_20 -FN:92,anonymous_21 -FN:93,anonymous_22 -FN:94,anonymous_23 -FN:100,anonymous_24 -FN:101,anonymous_25 -FN:107,anonymous_26 -FN:111,anonymous_27 -FN:112,anonymous_28 -FN:113,anonymous_29 -FN:114,anonymous_30 -FN:122,anonymous_31 -FN:123,anonymous_32 -FN:130,anonymous_33 -FN:131,anonymous_34 -FN:132,anonymous_35 -FN:140,anonymous_36 -FN:141,anonymous_37 -FN:142,anonymous_38 -FN:150,anonymous_39 -FN:151,anonymous_40 -FN:159,anonymous_41 -FN:160,anonymous_42 -FN:161,anonymous_43 +FN:58,anonymous_12 +FN:62,anonymous_13 +FN:66,anonymous_14 +FN:70,anonymous_15 +FN:74,anonymous_16 +FN:78,anonymous_17 +FN:83,anonymous_18 +FN:88,anonymous_19 +FN:92,anonymous_20 +FN:96,anonymous_21 +FN:100,anonymous_22 +FN:104,anonymous_23 +FN:105,anonymous_24 +FN:110,anonymous_25 +FN:111,anonymous_26 +FN:116,anonymous_27 +FN:117,anonymous_28 +FN:118,anonymous_29 +FN:124,anonymous_30 +FN:125,anonymous_31 +FN:131,anonymous_32 +FN:135,anonymous_33 +FN:136,anonymous_34 +FN:137,anonymous_35 +FN:138,anonymous_36 +FN:146,anonymous_37 +FN:147,anonymous_38 +FN:154,anonymous_39 +FN:155,anonymous_40 +FN:156,anonymous_41 +FN:164,anonymous_42 +FN:165,anonymous_43 FN:166,anonymous_44 -FN:167,anonymous_45 -FN:171,anonymous_46 -FN:172,anonymous_47 -FN:173,anonymous_48 -FN:179,anonymous_49 -FN:183,anonymous_50 -FN:187,anonymous_51 -FN:195,functionOnly -FN:198,anonymous_53 -FN:213,functionAndOptions -FN:215,anonymous_55 -FN:219,anonymous_56 -FN:220,anonymous_57 -FN:225,anonymous_58 -FN:229,anonymous_59 -FN:233,anonymous_60 -FN:238,anonymous_61 -FN:242,anonymous_62 -FN:246,anonymous_63 -FN:251,anonymous_64 -FN:256,anonymous_65 +FN:174,anonymous_45 +FN:175,anonymous_46 +FN:183,anonymous_47 +FN:184,anonymous_48 +FN:185,anonymous_49 +FN:190,anonymous_50 +FN:191,anonymous_51 +FN:195,anonymous_52 +FN:196,anonymous_53 +FN:197,anonymous_54 +FN:203,anonymous_55 +FN:207,anonymous_56 +FN:211,anonymous_57 +FN:219,functionOnly +FN:222,anonymous_59 +FN:237,functionAndOptions +FN:239,anonymous_61 +FN:243,anonymous_62 +FN:244,anonymous_63 +FN:249,anonymous_64 +FN:253,anonymous_65 FN:257,anonymous_66 -FN:263,anonymous_67 -FN:264,anonymous_68 -FN:269,anonymous_69 -FN:270,anonymous_70 -FN:277,anonymous_71 -FN:287,anonymous_72 -FN:289,obj -FN:298,anonymous_74 -FN:300,obj -FN:309,anonymous_76 -FN:310,anonymous_77 -FN:313,anonymous_78 -FN:318,anonymous_79 -FN:319,anonymous_80 -FN:320,anonymous_81 -FN:327,anonymous_82 -FN:328,anonymous_83 -FN:335,anonymous_84 -FN:336,anonymous_85 -FN:341,anonymous_86 -FN:345,anonymous_87 -FN:348,get then -FN:351,anonymous_89 -FN:356,anonymous_90 -FN:359,get then -FN:362,anonymous_92 -FN:367,anonymous_93 -FN:368,anonymous_94 -FN:369,anonymous_95 -FN:373,anonymous_96 -FN:374,anonymous_97 -FN:375,anonymous_98 -FN:381,anonymous_99 -FN:385,anonymous_100 +FN:262,anonymous_67 +FN:266,anonymous_68 +FN:270,anonymous_69 +FN:275,anonymous_70 +FN:280,anonymous_71 +FN:281,anonymous_72 +FN:287,anonymous_73 +FN:288,anonymous_74 +FN:293,anonymous_75 +FN:294,anonymous_76 +FN:301,anonymous_77 +FN:311,anonymous_78 +FN:313,obj +FN:322,anonymous_80 +FN:324,obj +FN:333,anonymous_82 +FN:334,anonymous_83 +FN:337,anonymous_84 +FN:342,anonymous_85 +FN:343,anonymous_86 +FN:344,anonymous_87 +FN:351,anonymous_88 +FN:352,anonymous_89 +FN:359,anonymous_90 +FN:360,anonymous_91 +FN:365,anonymous_92 +FN:369,anonymous_93 +FN:372,get then +FN:375,anonymous_95 +FN:380,anonymous_96 +FN:383,get then +FN:386,anonymous_98 +FN:391,anonymous_99 +FN:392,anonymous_100 +FN:393,anonymous_101 +FN:397,anonymous_102 +FN:398,anonymous_103 +FN:399,anonymous_104 +FN:405,anonymous_105 +FN:409,anonymous_106 FNDA:1,anonymous_0 FNDA:1,anonymous_1 FNDA:1,anonymous_2 FNDA:1,anonymous_3 FNDA:1,anonymous_4 -FNDA:1,anonymous_5 +FNDA:0,anonymous_5 FNDA:1,anonymous_6 FNDA:1,anonymous_7 FNDA:1,anonymous_8 @@ -150,18 +156,18 @@ FNDA:1,anonymous_45 FNDA:1,anonymous_46 FNDA:1,anonymous_47 FNDA:1,anonymous_48 -FNDA:0,anonymous_49 -FNDA:0,anonymous_50 +FNDA:1,anonymous_49 +FNDA:1,anonymous_50 FNDA:1,anonymous_51 -FNDA:1,functionOnly +FNDA:1,anonymous_52 FNDA:1,anonymous_53 -FNDA:0,functionAndOptions -FNDA:1,anonymous_55 -FNDA:1,anonymous_56 +FNDA:1,anonymous_54 +FNDA:0,anonymous_55 +FNDA:0,anonymous_56 FNDA:1,anonymous_57 -FNDA:1,anonymous_58 +FNDA:1,functionOnly FNDA:1,anonymous_59 -FNDA:1,anonymous_60 +FNDA:0,functionAndOptions FNDA:1,anonymous_61 FNDA:1,anonymous_62 FNDA:1,anonymous_63 @@ -174,141 +180,152 @@ FNDA:1,anonymous_69 FNDA:1,anonymous_70 FNDA:1,anonymous_71 FNDA:1,anonymous_72 -FNDA:1,obj +FNDA:1,anonymous_73 FNDA:1,anonymous_74 -FNDA:1,obj +FNDA:1,anonymous_75 FNDA:1,anonymous_76 FNDA:1,anonymous_77 FNDA:1,anonymous_78 -FNDA:1,anonymous_79 +FNDA:1,obj FNDA:1,anonymous_80 -FNDA:1,anonymous_81 +FNDA:1,obj FNDA:1,anonymous_82 FNDA:1,anonymous_83 FNDA:1,anonymous_84 FNDA:1,anonymous_85 FNDA:1,anonymous_86 FNDA:1,anonymous_87 -FNDA:1,get then +FNDA:1,anonymous_88 FNDA:1,anonymous_89 FNDA:1,anonymous_90 -FNDA:1,get then +FNDA:1,anonymous_91 FNDA:1,anonymous_92 FNDA:1,anonymous_93 -FNDA:1,anonymous_94 +FNDA:1,get then FNDA:1,anonymous_95 FNDA:1,anonymous_96 -FNDA:1,anonymous_97 +FNDA:1,get then FNDA:1,anonymous_98 FNDA:1,anonymous_99 FNDA:1,anonymous_100 -FNF:101 -FNH:98 +FNDA:1,anonymous_101 +FNDA:1,anonymous_102 +FNDA:1,anonymous_103 +FNDA:1,anonymous_104 +FNDA:1,anonymous_105 +FNDA:1,anonymous_106 +FNF:107 +FNH:103 BRDA:1,0,0,1 BRDA:8,1,0,1 BRDA:12,2,0,1 BRDA:16,3,0,1 -BRDA:21,4,0,1 -BRDA:26,5,0,1 -BRDA:30,6,0,1 -BRDA:34,7,0,1 -BRDA:38,8,0,1 -BRDA:42,9,0,1 -BRDA:46,10,0,1 -BRDA:50,11,0,1 -BRDA:54,12,0,1 -BRDA:59,13,0,1 -BRDA:64,14,0,1 -BRDA:68,15,0,1 -BRDA:72,16,0,1 -BRDA:76,17,0,1 -BRDA:80,18,0,1 -BRDA:81,19,0,1 -BRDA:86,20,0,1 -BRDA:87,21,0,1 -BRDA:92,22,0,1 -BRDA:93,23,0,1 -BRDA:94,24,0,1 -BRDA:100,25,0,1 -BRDA:101,26,0,1 -BRDA:107,27,0,1 -BRDA:111,28,0,1 -BRDA:112,29,0,1 -BRDA:113,30,0,1 -BRDA:114,31,0,1 -BRDA:122,32,0,1 -BRDA:123,33,0,1 -BRDA:130,34,0,1 -BRDA:131,35,0,1 -BRDA:132,36,0,1 -BRDA:140,37,0,1 -BRDA:141,38,0,1 -BRDA:142,39,0,1 -BRDA:150,40,0,1 -BRDA:151,41,0,1 -BRDA:159,42,0,1 -BRDA:160,43,0,1 -BRDA:161,44,0,1 -BRDA:166,45,0,1 -BRDA:167,46,0,1 -BRDA:171,47,0,1 -BRDA:172,48,0,1 -BRDA:173,49,0,1 -BRDA:187,50,0,1 -BRDA:195,51,0,1 -BRDA:198,52,0,1 -BRDA:215,53,0,1 -BRDA:219,54,0,1 -BRDA:220,55,0,1 -BRDA:225,56,0,1 -BRDA:229,57,0,1 -BRDA:233,58,0,1 -BRDA:238,59,0,1 -BRDA:242,60,0,1 -BRDA:246,61,0,1 -BRDA:251,62,0,1 -BRDA:256,63,0,1 -BRDA:257,64,0,1 -BRDA:263,65,0,1 -BRDA:264,66,0,1 -BRDA:269,67,0,1 -BRDA:270,68,0,1 -BRDA:277,69,0,1 +BRDA:20,4,0,1 +BRDA:24,5,0,1 +BRDA:32,6,0,1 +BRDA:36,7,0,1 +BRDA:40,8,0,1 +BRDA:45,9,0,1 +BRDA:50,10,0,1 +BRDA:54,11,0,1 +BRDA:58,12,0,1 +BRDA:62,13,0,1 +BRDA:66,14,0,1 +BRDA:70,15,0,1 +BRDA:74,16,0,1 +BRDA:78,17,0,1 +BRDA:83,18,0,1 +BRDA:88,19,0,1 +BRDA:92,20,0,1 +BRDA:96,21,0,1 +BRDA:100,22,0,1 +BRDA:104,23,0,1 +BRDA:105,24,0,1 +BRDA:110,25,0,1 +BRDA:111,26,0,1 +BRDA:116,27,0,1 +BRDA:117,28,0,1 +BRDA:118,29,0,1 +BRDA:124,30,0,1 +BRDA:125,31,0,1 +BRDA:131,32,0,1 +BRDA:135,33,0,1 +BRDA:136,34,0,1 +BRDA:137,35,0,1 +BRDA:138,36,0,1 +BRDA:146,37,0,1 +BRDA:147,38,0,1 +BRDA:154,39,0,1 +BRDA:155,40,0,1 +BRDA:156,41,0,1 +BRDA:164,42,0,1 +BRDA:165,43,0,1 +BRDA:166,44,0,1 +BRDA:174,45,0,1 +BRDA:175,46,0,1 +BRDA:183,47,0,1 +BRDA:184,48,0,1 +BRDA:185,49,0,1 +BRDA:190,50,0,1 +BRDA:191,51,0,1 +BRDA:195,52,0,1 +BRDA:196,53,0,1 +BRDA:197,54,0,1 +BRDA:211,55,0,1 +BRDA:219,56,0,1 +BRDA:222,57,0,1 +BRDA:239,58,0,1 +BRDA:243,59,0,1 +BRDA:244,60,0,1 +BRDA:249,61,0,1 +BRDA:253,62,0,1 +BRDA:257,63,0,1 +BRDA:262,64,0,1 +BRDA:266,65,0,1 +BRDA:270,66,0,1 +BRDA:275,67,0,1 +BRDA:280,68,0,1 +BRDA:281,69,0,1 BRDA:287,70,0,1 -BRDA:289,71,0,1 -BRDA:298,72,0,1 -BRDA:300,73,0,1 -BRDA:309,74,0,1 -BRDA:310,75,0,1 +BRDA:288,71,0,1 +BRDA:293,72,0,1 +BRDA:294,73,0,1 +BRDA:301,74,0,1 +BRDA:311,75,0,1 BRDA:313,76,0,1 -BRDA:318,77,0,1 -BRDA:319,78,0,1 -BRDA:320,79,0,1 -BRDA:327,80,0,1 -BRDA:328,81,0,1 -BRDA:335,82,0,1 -BRDA:336,83,0,1 -BRDA:341,84,0,1 -BRDA:345,85,0,1 -BRDA:348,86,0,1 -BRDA:349,87,0,0 -BRDA:351,88,0,1 -BRDA:356,89,0,1 -BRDA:359,90,0,1 -BRDA:360,91,0,0 -BRDA:362,92,0,1 -BRDA:367,93,0,1 -BRDA:370,94,0,0 -BRDA:368,95,0,1 -BRDA:369,96,0,1 -BRDA:373,97,0,1 -BRDA:376,98,0,0 -BRDA:374,99,0,1 -BRDA:375,100,0,1 -BRDA:381,101,0,1 -BRDA:385,102,0,1 -BRF:103 -BRH:99 +BRDA:322,77,0,1 +BRDA:324,78,0,1 +BRDA:333,79,0,1 +BRDA:334,80,0,1 +BRDA:337,81,0,1 +BRDA:342,82,0,1 +BRDA:343,83,0,1 +BRDA:344,84,0,1 +BRDA:351,85,0,1 +BRDA:352,86,0,1 +BRDA:359,87,0,1 +BRDA:360,88,0,1 +BRDA:365,89,0,1 +BRDA:369,90,0,1 +BRDA:372,91,0,1 +BRDA:373,92,0,0 +BRDA:375,93,0,1 +BRDA:380,94,0,1 +BRDA:383,95,0,1 +BRDA:384,96,0,0 +BRDA:386,97,0,1 +BRDA:391,98,0,1 +BRDA:394,99,0,0 +BRDA:392,100,0,1 +BRDA:393,101,0,1 +BRDA:397,102,0,1 +BRDA:400,103,0,0 +BRDA:398,104,0,1 +BRDA:399,105,0,1 +BRDA:405,106,0,1 +BRDA:409,107,0,1 +BRF:108 +BRH:104 DA:1,1 DA:2,1 DA:3,1 @@ -337,7 +354,7 @@ DA:25,1 DA:26,1 DA:27,1 DA:28,1 -DA:29,1 +DA:29,0 DA:30,1 DA:31,1 DA:32,1 @@ -488,11 +505,11 @@ DA:176,1 DA:177,1 DA:178,1 DA:179,1 -DA:180,0 +DA:180,1 DA:181,1 DA:182,1 DA:183,1 -DA:184,0 +DA:184,1 DA:185,1 DA:186,1 DA:187,1 @@ -512,11 +529,11 @@ DA:200,1 DA:201,1 DA:202,1 DA:203,1 -DA:204,1 +DA:204,0 DA:205,1 DA:206,1 DA:207,1 -DA:208,1 +DA:208,0 DA:209,1 DA:210,1 DA:211,1 @@ -715,6 +732,30 @@ DA:403,1 DA:404,1 DA:405,1 DA:406,1 -LH:404 -LF:406 +DA:407,1 +DA:408,1 +DA:409,1 +DA:410,1 +DA:411,1 +DA:412,1 +DA:413,1 +DA:414,1 +DA:415,1 +DA:416,1 +DA:417,1 +DA:418,1 +DA:419,1 +DA:420,1 +DA:421,1 +DA:422,1 +DA:423,1 +DA:424,1 +DA:425,1 +DA:426,1 +DA:427,1 +DA:428,1 +DA:429,1 +DA:430,1 +LH:427 +LF:430 end_of_record diff --git a/test/fixtures/test-runner/output/output.js b/test/fixtures/test-runner/output/output.js index 766c93d0e3dbde..24a27a01791f21 100644 --- a/test/fixtures/test-runner/output/output.js +++ b/test/fixtures/test-runner/output/output.js @@ -5,6 +5,30 @@ const assert = require('node:assert'); const test = require('node:test'); const util = require('util'); +test.expectFailure('sync expect fail (method)', () => { + throw new Error('should pass'); +}); + +test('sync expect fail (options)', { expectFailure: true }, () => { + throw new Error('should pass'); +}); + +test.expectFailure('async expect fail (method)', async () => { + throw new Error('should pass'); +}); + +test('async expect fail (options)', { expectFailure: true }, async () => { + throw new Error('should pass'); +}); + +test.todo('sync todo with expect fail', { expectFailure: true }, () => { + throw new Error('should not count as an expected failure'); +}); + +test.skip('sync skip expect fail', { expectFailure: true }, () => { + throw new Error('should not fail'); +}); + test('sync pass todo', (t) => { t.todo(); }); diff --git a/test/fixtures/test-runner/output/output.snapshot b/test/fixtures/test-runner/output/output.snapshot index 044ac4137fa78d..8c84cd6feadd46 100644 --- a/test/fixtures/test-runner/output/output.snapshot +++ b/test/fixtures/test-runner/output/output.snapshot @@ -1,18 +1,54 @@ TAP version 13 +# Subtest: sync expect fail (method) +ok 1 - sync expect fail (method) # EXPECTED FAILURE + --- + duration_ms: * + type: 'test' + ... +# Subtest: sync expect fail (options) +ok 2 - sync expect fail (options) # EXPECTED FAILURE + --- + duration_ms: * + type: 'test' + ... +# Subtest: async expect fail (method) +ok 3 - async expect fail (method) # EXPECTED FAILURE + --- + duration_ms: * + type: 'test' + ... +# Subtest: async expect fail (options) +ok 4 - async expect fail (options) # EXPECTED FAILURE + --- + duration_ms: * + type: 'test' + ... +# Subtest: sync todo with expect fail +ok 5 - sync todo with expect fail # TODO + --- + duration_ms: * + type: 'test' + ... +# Subtest: sync skip expect fail +ok 6 - sync skip expect fail # SKIP + --- + duration_ms: * + type: 'test' + ... # Subtest: sync pass todo -ok 1 - sync pass todo # TODO +ok 7 - sync pass todo # TODO --- duration_ms: * type: 'test' ... # Subtest: sync pass todo with message -ok 2 - sync pass todo with message # TODO this is a passing todo +ok 8 - sync pass todo with message # TODO this is a passing todo --- duration_ms: * type: 'test' ... # Subtest: sync fail todo -not ok 3 - sync fail todo # TODO +not ok 9 - sync fail todo # TODO --- duration_ms: * type: 'test' @@ -30,7 +66,7 @@ not ok 3 - sync fail todo # TODO * ... # Subtest: sync fail todo with message -not ok 4 - sync fail todo with message # TODO this is a failing todo +not ok 10 - sync fail todo with message # TODO this is a failing todo --- duration_ms: * type: 'test' @@ -48,26 +84,26 @@ not ok 4 - sync fail todo with message # TODO this is a failing todo * ... # Subtest: sync skip pass -ok 5 - sync skip pass # SKIP +ok 11 - sync skip pass # SKIP --- duration_ms: * type: 'test' ... # Subtest: sync skip pass with message -ok 6 - sync skip pass with message # SKIP this is skipped +ok 12 - sync skip pass with message # SKIP this is skipped --- duration_ms: * type: 'test' ... # Subtest: sync pass -ok 7 - sync pass +ok 13 - sync pass --- duration_ms: * type: 'test' ... # this test should pass # Subtest: sync throw fail -not ok 8 - sync throw fail +not ok 14 - sync throw fail --- duration_ms: * type: 'test' @@ -85,19 +121,19 @@ not ok 8 - sync throw fail * ... # Subtest: async skip pass -ok 9 - async skip pass # SKIP +ok 15 - async skip pass # SKIP --- duration_ms: * type: 'test' ... # Subtest: async pass -ok 10 - async pass +ok 16 - async pass --- duration_ms: * type: 'test' ... # Subtest: async throw fail -not ok 11 - async throw fail +not ok 17 - async throw fail --- duration_ms: * type: 'test' @@ -115,7 +151,7 @@ not ok 11 - async throw fail * ... # Subtest: async skip fail -not ok 12 - async skip fail # SKIP +not ok 18 - async skip fail # SKIP --- duration_ms: * type: 'test' @@ -133,7 +169,7 @@ not ok 12 - async skip fail # SKIP * ... # Subtest: async assertion fail -not ok 13 - async assertion fail +not ok 19 - async assertion fail --- duration_ms: * type: 'test' @@ -159,13 +195,13 @@ not ok 13 - async assertion fail * ... # Subtest: resolve pass -ok 14 - resolve pass +ok 20 - resolve pass --- duration_ms: * type: 'test' ... # Subtest: reject fail -not ok 15 - reject fail +not ok 21 - reject fail --- duration_ms: * type: 'test' @@ -183,31 +219,31 @@ not ok 15 - reject fail * ... # Subtest: unhandled rejection - passes but warns -ok 16 - unhandled rejection - passes but warns +ok 22 - unhandled rejection - passes but warns --- duration_ms: * type: 'test' ... # Subtest: async unhandled rejection - passes but warns -ok 17 - async unhandled rejection - passes but warns +ok 23 - async unhandled rejection - passes but warns --- duration_ms: * type: 'test' ... # Subtest: immediate throw - passes but warns -ok 18 - immediate throw - passes but warns +ok 24 - immediate throw - passes but warns --- duration_ms: * type: 'test' ... # Subtest: immediate reject - passes but warns -ok 19 - immediate reject - passes but warns +ok 25 - immediate reject - passes but warns --- duration_ms: * type: 'test' ... # Subtest: immediate resolve pass -ok 20 - immediate resolve pass +ok 26 - immediate resolve pass --- duration_ms: * type: 'test' @@ -236,7 +272,7 @@ ok 20 - immediate resolve pass ... # this subtest should make its parent test fail 1..1 -not ok 21 - subtest sync throw fail +not ok 27 - subtest sync throw fail --- duration_ms: * type: 'test' @@ -246,7 +282,7 @@ not ok 21 - subtest sync throw fail code: 'ERR_TEST_FAILURE' ... # Subtest: sync throw non-error fail -not ok 22 - sync throw non-error fail +not ok 28 - sync throw non-error fail --- duration_ms: * type: 'test' @@ -281,7 +317,7 @@ not ok 22 - sync throw non-error fail type: 'test' ... 1..4 -ok 23 - level 0a +ok 29 - level 0a --- duration_ms: * type: 'test' @@ -307,31 +343,31 @@ ok 23 - level 0a type: 'test' ... 1..2 -ok 24 - top level +ok 30 - top level --- duration_ms: * type: 'test' ... # Subtest: invalid subtest - pass but subtest fails -ok 25 - invalid subtest - pass but subtest fails +ok 31 - invalid subtest - pass but subtest fails --- duration_ms: * type: 'test' ... # Subtest: sync skip option -ok 26 - sync skip option # SKIP +ok 32 - sync skip option # SKIP --- duration_ms: * type: 'test' ... # Subtest: sync skip option with message -ok 27 - sync skip option with message # SKIP this is skipped +ok 33 - sync skip option with message # SKIP this is skipped --- duration_ms: * type: 'test' ... # Subtest: sync skip option is false fail -not ok 28 - sync skip option is false fail +not ok 34 - sync skip option is false fail --- duration_ms: * type: 'test' @@ -349,61 +385,61 @@ not ok 28 - sync skip option is false fail * ... # Subtest: -ok 29 - +ok 35 - --- duration_ms: * type: 'test' ... # Subtest: functionOnly -ok 30 - functionOnly +ok 36 - functionOnly --- duration_ms: * type: 'test' ... # Subtest: -ok 31 - +ok 37 - --- duration_ms: * type: 'test' ... # Subtest: test with only a name provided -ok 32 - test with only a name provided +ok 38 - test with only a name provided --- duration_ms: * type: 'test' ... # Subtest: -ok 33 - +ok 39 - --- duration_ms: * type: 'test' ... # Subtest: -ok 34 - # SKIP +ok 40 - # SKIP --- duration_ms: * type: 'test' ... # Subtest: test with a name and options provided -ok 35 - test with a name and options provided # SKIP +ok 41 - test with a name and options provided # SKIP --- duration_ms: * type: 'test' ... # Subtest: functionAndOptions -ok 36 - functionAndOptions # SKIP +ok 42 - functionAndOptions # SKIP --- duration_ms: * type: 'test' ... # Subtest: callback pass -ok 37 - callback pass +ok 43 - callback pass --- duration_ms: * type: 'test' ... # Subtest: callback fail -not ok 38 - callback fail +not ok 44 - callback fail --- duration_ms: * type: 'test' @@ -416,25 +452,25 @@ not ok 38 - callback fail * ... # Subtest: sync t is this in test -ok 39 - sync t is this in test +ok 45 - sync t is this in test --- duration_ms: * type: 'test' ... # Subtest: async t is this in test -ok 40 - async t is this in test +ok 46 - async t is this in test --- duration_ms: * type: 'test' ... # Subtest: callback t is this in test -ok 41 - callback t is this in test +ok 47 - callback t is this in test --- duration_ms: * type: 'test' ... # Subtest: callback also returns a Promise -not ok 42 - callback also returns a Promise +not ok 48 - callback also returns a Promise --- duration_ms: * type: 'test' @@ -444,7 +480,7 @@ not ok 42 - callback also returns a Promise code: 'ERR_TEST_FAILURE' ... # Subtest: callback throw -not ok 43 - callback throw +not ok 49 - callback throw --- duration_ms: * type: 'test' @@ -462,7 +498,7 @@ not ok 43 - callback throw * ... # Subtest: callback called twice -not ok 44 - callback called twice +not ok 50 - callback called twice --- duration_ms: * type: 'test' @@ -475,13 +511,13 @@ not ok 44 - callback called twice * ... # Subtest: callback called twice in different ticks -ok 45 - callback called twice in different ticks +ok 51 - callback called twice in different ticks --- duration_ms: * type: 'test' ... # Subtest: callback called twice in future tick -not ok 46 - callback called twice in future tick +not ok 52 - callback called twice in future tick --- duration_ms: * type: 'test' @@ -493,7 +529,7 @@ not ok 46 - callback called twice in future tick * ... # Subtest: callback async throw -not ok 47 - callback async throw +not ok 53 - callback async throw --- duration_ms: * type: 'test' @@ -506,7 +542,7 @@ not ok 47 - callback async throw * ... # Subtest: callback async throw after done -ok 48 - callback async throw after done +ok 54 - callback async throw after done --- duration_ms: * type: 'test' @@ -531,13 +567,13 @@ ok 48 - callback async throw after done type: 'test' ... 1..3 -ok 49 - only is set on subtests but not in only mode +ok 55 - only is set on subtests but not in only mode --- duration_ms: * type: 'test' ... # Subtest: custom inspect symbol fail -not ok 50 - custom inspect symbol fail +not ok 56 - custom inspect symbol fail --- duration_ms: * type: 'test' @@ -547,7 +583,7 @@ not ok 50 - custom inspect symbol fail code: 'ERR_TEST_FAILURE' ... # Subtest: custom inspect symbol that throws fail -not ok 51 - custom inspect symbol that throws fail +not ok 57 - custom inspect symbol that throws fail --- duration_ms: * type: 'test' @@ -602,7 +638,7 @@ not ok 51 - custom inspect symbol that throws fail * ... 1..2 -not ok 52 - subtest sync throw fails +not ok 58 - subtest sync throw fails --- duration_ms: * type: 'test' @@ -612,7 +648,7 @@ not ok 52 - subtest sync throw fails code: 'ERR_TEST_FAILURE' ... # Subtest: timed out async test -not ok 53 - timed out async test +not ok 59 - timed out async test --- duration_ms: * type: 'test' @@ -622,7 +658,7 @@ not ok 53 - timed out async test code: 'ERR_TEST_FAILURE' ... # Subtest: timed out callback test -not ok 54 - timed out callback test +not ok 60 - timed out callback test --- duration_ms: * type: 'test' @@ -632,25 +668,25 @@ not ok 54 - timed out callback test code: 'ERR_TEST_FAILURE' ... # Subtest: large timeout async test is ok -ok 55 - large timeout async test is ok +ok 61 - large timeout async test is ok --- duration_ms: * type: 'test' ... # Subtest: large timeout callback test is ok -ok 56 - large timeout callback test is ok +ok 62 - large timeout callback test is ok --- duration_ms: * type: 'test' ... # Subtest: successful thenable -ok 57 - successful thenable +ok 63 - successful thenable --- duration_ms: * type: 'test' ... # Subtest: rejected thenable -not ok 58 - rejected thenable +not ok 64 - rejected thenable --- duration_ms: * type: 'test' @@ -660,7 +696,7 @@ not ok 58 - rejected thenable code: 'ERR_TEST_FAILURE' ... # Subtest: unfinished test with uncaughtException -not ok 59 - unfinished test with uncaughtException +not ok 65 - unfinished test with uncaughtException --- duration_ms: * type: 'test' @@ -674,7 +710,7 @@ not ok 59 - unfinished test with uncaughtException * ... # Subtest: unfinished test with unhandledRejection -not ok 60 - unfinished test with unhandledRejection +not ok 66 - unfinished test with unhandledRejection --- duration_ms: * type: 'test' @@ -688,7 +724,7 @@ not ok 60 - unfinished test with unhandledRejection * ... # Subtest: assertion errors display actual and expected properly -not ok 61 - assertion errors display actual and expected properly +not ok 67 - assertion errors display actual and expected properly --- duration_ms: * type: 'test' @@ -758,7 +794,7 @@ not ok 61 - assertion errors display actual and expected properly * ... # Subtest: invalid subtest fail -not ok 62 - invalid subtest fail +not ok 68 - invalid subtest fail --- duration_ms: * type: 'test' @@ -769,7 +805,7 @@ not ok 62 - invalid subtest fail stack: |- * ... -1..62 +1..68 # Error: Test "unhandled rejection - passes but warns" at test/fixtures/test-runner/output/output.js:(LINE):1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. # Error: Test "async unhandled rejection - passes but warns" at test/fixtures/test-runner/output/output.js:(LINE):1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from async unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. # Error: A resource generated asynchronous activity after the test ended. This activity created the error "Error: uncaught from outside of a test" which triggered an uncaughtException event, caught by the test runner. @@ -777,11 +813,11 @@ not ok 62 - invalid subtest fail # Error: Test "immediate reject - passes but warns" at test/fixtures/test-runner/output/output.js:(LINE):1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from immediate reject fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. # Error: Test "callback called twice in different ticks" at test/fixtures/test-runner/output/output.js:(LINE):1 generated asynchronous activity after the test ended. This activity created the error "Error [ERR_TEST_FAILURE]: callback invoked multiple times" and would have caused the test to fail, but instead triggered an uncaughtException event. # Error: Test "callback async throw after done" at test/fixtures/test-runner/output/output.js:(LINE):1 generated asynchronous activity after the test ended. This activity created the error "Error: thrown from callback async throw after done" and would have caused the test to fail, but instead triggered an uncaughtException event. -# tests 75 +# tests 81 # suites 0 -# pass 36 +# pass 40 # fail 24 # cancelled 2 -# skipped 9 -# todo 4 +# skipped 10 +# todo 5 # duration_ms * diff --git a/test/fixtures/test-runner/output/output_cli.js b/test/fixtures/test-runner/output/output_cli.js index a36c099b7363a2..c5ac9399b77aa4 100644 --- a/test/fixtures/test-runner/output/output_cli.js +++ b/test/fixtures/test-runner/output/output_cli.js @@ -3,10 +3,14 @@ require('../../../common'); const fixtures = require('../../../common/fixtures'); const spawn = require('node:child_process').spawn; -spawn(process.execPath, - [ - '--no-warnings', '--test', '--test-reporter', 'tap', - fixtures.path('test-runner/output/output.js'), - fixtures.path('test-runner/output/single.js'), - ], - { stdio: 'inherit' }); +spawn( + process.execPath, + [ + '--no-warnings', + '--test-reporter', 'tap', + '--test', + fixtures.path('test-runner/output/output.js'), + fixtures.path('test-runner/output/single.js'), + ], + { stdio: 'inherit' }, +); diff --git a/test/fixtures/test-runner/output/output_cli.snapshot b/test/fixtures/test-runner/output/output_cli.snapshot index eaa085d97d06d1..8b75d4c8d89bb7 100644 --- a/test/fixtures/test-runner/output/output_cli.snapshot +++ b/test/fixtures/test-runner/output/output_cli.snapshot @@ -1,18 +1,54 @@ TAP version 13 +# Subtest: sync expect fail (method) +ok 1 - sync expect fail (method) # EXPECTED FAILURE + --- + duration_ms: * + type: 'test' + ... +# Subtest: sync expect fail (options) +ok 2 - sync expect fail (options) # EXPECTED FAILURE + --- + duration_ms: * + type: 'test' + ... +# Subtest: async expect fail (method) +ok 3 - async expect fail (method) # EXPECTED FAILURE + --- + duration_ms: * + type: 'test' + ... +# Subtest: async expect fail (options) +ok 4 - async expect fail (options) # EXPECTED FAILURE + --- + duration_ms: * + type: 'test' + ... +# Subtest: sync todo with expect fail +ok 5 - sync todo with expect fail # TODO + --- + duration_ms: * + type: 'test' + ... +# Subtest: sync skip expect fail +ok 6 - sync skip expect fail # SKIP + --- + duration_ms: * + type: 'test' + ... # Subtest: sync pass todo -ok 1 - sync pass todo # TODO +ok 7 - sync pass todo # TODO --- duration_ms: * type: 'test' ... # Subtest: sync pass todo with message -ok 2 - sync pass todo with message # TODO this is a passing todo +ok 8 - sync pass todo with message # TODO this is a passing todo --- duration_ms: * type: 'test' ... # Subtest: sync fail todo -not ok 3 - sync fail todo # TODO +not ok 9 - sync fail todo # TODO --- duration_ms: * type: 'test' @@ -30,7 +66,7 @@ not ok 3 - sync fail todo # TODO * ... # Subtest: sync fail todo with message -not ok 4 - sync fail todo with message # TODO this is a failing todo +not ok 10 - sync fail todo with message # TODO this is a failing todo --- duration_ms: * type: 'test' @@ -48,26 +84,26 @@ not ok 4 - sync fail todo with message # TODO this is a failing todo * ... # Subtest: sync skip pass -ok 5 - sync skip pass # SKIP +ok 11 - sync skip pass # SKIP --- duration_ms: * type: 'test' ... # Subtest: sync skip pass with message -ok 6 - sync skip pass with message # SKIP this is skipped +ok 12 - sync skip pass with message # SKIP this is skipped --- duration_ms: * type: 'test' ... # Subtest: sync pass -ok 7 - sync pass +ok 13 - sync pass --- duration_ms: * type: 'test' ... # this test should pass # Subtest: sync throw fail -not ok 8 - sync throw fail +not ok 14 - sync throw fail --- duration_ms: * type: 'test' @@ -85,19 +121,19 @@ not ok 8 - sync throw fail * ... # Subtest: async skip pass -ok 9 - async skip pass # SKIP +ok 15 - async skip pass # SKIP --- duration_ms: * type: 'test' ... # Subtest: async pass -ok 10 - async pass +ok 16 - async pass --- duration_ms: * type: 'test' ... # Subtest: async throw fail -not ok 11 - async throw fail +not ok 17 - async throw fail --- duration_ms: * type: 'test' @@ -115,7 +151,7 @@ not ok 11 - async throw fail * ... # Subtest: async skip fail -not ok 12 - async skip fail # SKIP +not ok 18 - async skip fail # SKIP --- duration_ms: * type: 'test' @@ -133,7 +169,7 @@ not ok 12 - async skip fail # SKIP * ... # Subtest: async assertion fail -not ok 13 - async assertion fail +not ok 19 - async assertion fail --- duration_ms: * type: 'test' @@ -159,13 +195,13 @@ not ok 13 - async assertion fail * ... # Subtest: resolve pass -ok 14 - resolve pass +ok 20 - resolve pass --- duration_ms: * type: 'test' ... # Subtest: reject fail -not ok 15 - reject fail +not ok 21 - reject fail --- duration_ms: * type: 'test' @@ -183,31 +219,31 @@ not ok 15 - reject fail * ... # Subtest: unhandled rejection - passes but warns -ok 16 - unhandled rejection - passes but warns +ok 22 - unhandled rejection - passes but warns --- duration_ms: * type: 'test' ... # Subtest: async unhandled rejection - passes but warns -ok 17 - async unhandled rejection - passes but warns +ok 23 - async unhandled rejection - passes but warns --- duration_ms: * type: 'test' ... # Subtest: immediate throw - passes but warns -ok 18 - immediate throw - passes but warns +ok 24 - immediate throw - passes but warns --- duration_ms: * type: 'test' ... # Subtest: immediate reject - passes but warns -ok 19 - immediate reject - passes but warns +ok 25 - immediate reject - passes but warns --- duration_ms: * type: 'test' ... # Subtest: immediate resolve pass -ok 20 - immediate resolve pass +ok 26 - immediate resolve pass --- duration_ms: * type: 'test' @@ -236,7 +272,7 @@ ok 20 - immediate resolve pass ... # this subtest should make its parent test fail 1..1 -not ok 21 - subtest sync throw fail +not ok 27 - subtest sync throw fail --- duration_ms: * type: 'test' @@ -246,7 +282,7 @@ not ok 21 - subtest sync throw fail code: 'ERR_TEST_FAILURE' ... # Subtest: sync throw non-error fail -not ok 22 - sync throw non-error fail +not ok 28 - sync throw non-error fail --- duration_ms: * type: 'test' @@ -281,7 +317,7 @@ not ok 22 - sync throw non-error fail type: 'test' ... 1..4 -ok 23 - level 0a +ok 29 - level 0a --- duration_ms: * type: 'test' @@ -307,31 +343,31 @@ ok 23 - level 0a type: 'test' ... 1..2 -ok 24 - top level +ok 30 - top level --- duration_ms: * type: 'test' ... # Subtest: invalid subtest - pass but subtest fails -ok 25 - invalid subtest - pass but subtest fails +ok 31 - invalid subtest - pass but subtest fails --- duration_ms: * type: 'test' ... # Subtest: sync skip option -ok 26 - sync skip option # SKIP +ok 32 - sync skip option # SKIP --- duration_ms: * type: 'test' ... # Subtest: sync skip option with message -ok 27 - sync skip option with message # SKIP this is skipped +ok 33 - sync skip option with message # SKIP this is skipped --- duration_ms: * type: 'test' ... # Subtest: sync skip option is false fail -not ok 28 - sync skip option is false fail +not ok 34 - sync skip option is false fail --- duration_ms: * type: 'test' @@ -349,61 +385,61 @@ not ok 28 - sync skip option is false fail * ... # Subtest: -ok 29 - +ok 35 - --- duration_ms: * type: 'test' ... # Subtest: functionOnly -ok 30 - functionOnly +ok 36 - functionOnly --- duration_ms: * type: 'test' ... # Subtest: -ok 31 - +ok 37 - --- duration_ms: * type: 'test' ... # Subtest: test with only a name provided -ok 32 - test with only a name provided +ok 38 - test with only a name provided --- duration_ms: * type: 'test' ... # Subtest: -ok 33 - +ok 39 - --- duration_ms: * type: 'test' ... # Subtest: -ok 34 - # SKIP +ok 40 - # SKIP --- duration_ms: * type: 'test' ... # Subtest: test with a name and options provided -ok 35 - test with a name and options provided # SKIP +ok 41 - test with a name and options provided # SKIP --- duration_ms: * type: 'test' ... # Subtest: functionAndOptions -ok 36 - functionAndOptions # SKIP +ok 42 - functionAndOptions # SKIP --- duration_ms: * type: 'test' ... # Subtest: callback pass -ok 37 - callback pass +ok 43 - callback pass --- duration_ms: * type: 'test' ... # Subtest: callback fail -not ok 38 - callback fail +not ok 44 - callback fail --- duration_ms: * type: 'test' @@ -416,25 +452,25 @@ not ok 38 - callback fail * ... # Subtest: sync t is this in test -ok 39 - sync t is this in test +ok 45 - sync t is this in test --- duration_ms: * type: 'test' ... # Subtest: async t is this in test -ok 40 - async t is this in test +ok 46 - async t is this in test --- duration_ms: * type: 'test' ... # Subtest: callback t is this in test -ok 41 - callback t is this in test +ok 47 - callback t is this in test --- duration_ms: * type: 'test' ... # Subtest: callback also returns a Promise -not ok 42 - callback also returns a Promise +not ok 48 - callback also returns a Promise --- duration_ms: * type: 'test' @@ -444,7 +480,7 @@ not ok 42 - callback also returns a Promise code: 'ERR_TEST_FAILURE' ... # Subtest: callback throw -not ok 43 - callback throw +not ok 49 - callback throw --- duration_ms: * type: 'test' @@ -462,7 +498,7 @@ not ok 43 - callback throw * ... # Subtest: callback called twice -not ok 44 - callback called twice +not ok 50 - callback called twice --- duration_ms: * type: 'test' @@ -475,13 +511,13 @@ not ok 44 - callback called twice * ... # Subtest: callback called twice in different ticks -ok 45 - callback called twice in different ticks +ok 51 - callback called twice in different ticks --- duration_ms: * type: 'test' ... # Subtest: callback called twice in future tick -not ok 46 - callback called twice in future tick +not ok 52 - callback called twice in future tick --- duration_ms: * type: 'test' @@ -493,7 +529,7 @@ not ok 46 - callback called twice in future tick * ... # Subtest: callback async throw -not ok 47 - callback async throw +not ok 53 - callback async throw --- duration_ms: * type: 'test' @@ -506,7 +542,7 @@ not ok 47 - callback async throw * ... # Subtest: callback async throw after done -ok 48 - callback async throw after done +ok 54 - callback async throw after done --- duration_ms: * type: 'test' @@ -539,13 +575,13 @@ ok 48 - callback async throw after done type: 'test' ... 1..4 -ok 49 - only is set on subtests but not in only mode +ok 55 - only is set on subtests but not in only mode --- duration_ms: * type: 'test' ... # Subtest: custom inspect symbol fail -not ok 50 - custom inspect symbol fail +not ok 56 - custom inspect symbol fail --- duration_ms: * type: 'test' @@ -555,7 +591,7 @@ not ok 50 - custom inspect symbol fail code: 'ERR_TEST_FAILURE' ... # Subtest: custom inspect symbol that throws fail -not ok 51 - custom inspect symbol that throws fail +not ok 57 - custom inspect symbol that throws fail --- duration_ms: * type: 'test' @@ -610,7 +646,7 @@ not ok 51 - custom inspect symbol that throws fail * ... 1..2 -not ok 52 - subtest sync throw fails +not ok 58 - subtest sync throw fails --- duration_ms: * type: 'test' @@ -620,7 +656,7 @@ not ok 52 - subtest sync throw fails code: 'ERR_TEST_FAILURE' ... # Subtest: timed out async test -not ok 53 - timed out async test +not ok 59 - timed out async test --- duration_ms: * type: 'test' @@ -630,7 +666,7 @@ not ok 53 - timed out async test code: 'ERR_TEST_FAILURE' ... # Subtest: timed out callback test -not ok 54 - timed out callback test +not ok 60 - timed out callback test --- duration_ms: * type: 'test' @@ -640,25 +676,25 @@ not ok 54 - timed out callback test code: 'ERR_TEST_FAILURE' ... # Subtest: large timeout async test is ok -ok 55 - large timeout async test is ok +ok 61 - large timeout async test is ok --- duration_ms: * type: 'test' ... # Subtest: large timeout callback test is ok -ok 56 - large timeout callback test is ok +ok 62 - large timeout callback test is ok --- duration_ms: * type: 'test' ... # Subtest: successful thenable -ok 57 - successful thenable +ok 63 - successful thenable --- duration_ms: * type: 'test' ... # Subtest: rejected thenable -not ok 58 - rejected thenable +not ok 64 - rejected thenable --- duration_ms: * type: 'test' @@ -668,7 +704,7 @@ not ok 58 - rejected thenable code: 'ERR_TEST_FAILURE' ... # Subtest: unfinished test with uncaughtException -not ok 59 - unfinished test with uncaughtException +not ok 65 - unfinished test with uncaughtException --- duration_ms: * type: 'test' @@ -682,7 +718,7 @@ not ok 59 - unfinished test with uncaughtException * ... # Subtest: unfinished test with unhandledRejection -not ok 60 - unfinished test with unhandledRejection +not ok 66 - unfinished test with unhandledRejection --- duration_ms: * type: 'test' @@ -696,7 +732,7 @@ not ok 60 - unfinished test with unhandledRejection * ... # Subtest: assertion errors display actual and expected properly -not ok 61 - assertion errors display actual and expected properly +not ok 67 - assertion errors display actual and expected properly --- duration_ms: * type: 'test' @@ -766,7 +802,7 @@ not ok 61 - assertion errors display actual and expected properly * ... # Subtest: invalid subtest fail -not ok 62 - invalid subtest fail +not ok 68 - invalid subtest fail --- duration_ms: * type: 'test' @@ -785,17 +821,17 @@ not ok 62 - invalid subtest fail # Error: Test "callback called twice in different ticks" at test/fixtures/test-runner/output/output.js:(LINE):1 generated asynchronous activity after the test ended. This activity created the error "Error [ERR_TEST_FAILURE]: callback invoked multiple times" and would have caused the test to fail, but instead triggered an uncaughtException event. # Error: Test "callback async throw after done" at test/fixtures/test-runner/output/output.js:(LINE):1 generated asynchronous activity after the test ended. This activity created the error "Error: thrown from callback async throw after done" and would have caused the test to fail, but instead triggered an uncaughtException event. # Subtest: last test -ok 63 - last test +ok 69 - last test --- duration_ms: * type: 'test' ... -1..63 -# tests 77 +1..69 +# tests 83 # suites 0 -# pass 38 +# pass 42 # fail 24 # cancelled 2 -# skipped 9 -# todo 4 +# skipped 10 +# todo 5 # duration_ms * diff --git a/test/fixtures/test-runner/output/spec_reporter.js b/test/fixtures/test-runner/output/spec_reporter.js index 46e18b1ca8630d..5edcb6e8d9c8df 100644 --- a/test/fixtures/test-runner/output/spec_reporter.js +++ b/test/fixtures/test-runner/output/spec_reporter.js @@ -3,9 +3,16 @@ require('../../../common'); const fixtures = require('../../../common/fixtures'); const spawn = require('node:child_process').spawn; -const child = spawn(process.execPath, - ['--no-warnings', '--test-reporter', 'spec', fixtures.path('test-runner/output/output.js')], - { stdio: 'pipe' }); +const child = spawn( + process.execPath, + [ + '--no-warnings', + '--test-reporter', 'spec', + fixtures.path('test-runner/output/output.js'), + ], + { stdio: 'pipe' }, +); + // eslint-disable-next-line no-control-regex child.stdout.on('data', (d) => process.stdout.write(d.toString().replace(/[^\x00-\x7F]/g, '').replace(/\u001b\[\d+m/g, ''))); child.stderr.pipe(process.stderr); diff --git a/test/fixtures/test-runner/output/spec_reporter.snapshot b/test/fixtures/test-runner/output/spec_reporter.snapshot index 749f0dce43a450..70adcbcf0e2ef2 100644 --- a/test/fixtures/test-runner/output/spec_reporter.snapshot +++ b/test/fixtures/test-runner/output/spec_reporter.snapshot @@ -1,3 +1,9 @@ + sync expect fail (method) (*ms) # EXPECTED FAILURE + sync expect fail (options) (*ms) # EXPECTED FAILURE + async expect fail (method) (*ms) # EXPECTED FAILURE + async expect fail (options) (*ms) # EXPECTED FAILURE + sync todo with expect fail (*ms) # TODO + sync skip expect fail (*ms) # SKIP sync pass todo (*ms) # TODO sync pass todo with message (*ms) # this is a passing todo sync fail todo (*ms) # TODO @@ -81,20 +87,20 @@ unfinished test with unhandledRejection (*ms) assertion errors display actual and expected properly (*ms) invalid subtest fail (*ms) - Error: Test "unhandled rejection - passes but warns" at test/fixtures/test-runner/output/output.js:72:1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. - Error: Test "async unhandled rejection - passes but warns" at test/fixtures/test-runner/output/output.js:76:1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from async unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. + Error: Test "unhandled rejection - passes but warns" at test/fixtures/test-runner/output/output.js:96:1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. + Error: Test "async unhandled rejection - passes but warns" at test/fixtures/test-runner/output/output.js:100:1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from async unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. Error: A resource generated asynchronous activity after the test ended. This activity created the error "Error: uncaught from outside of a test" which triggered an uncaughtException event, caught by the test runner. - Error: Test "immediate throw - passes but warns" at test/fixtures/test-runner/output/output.js:80:1 generated asynchronous activity after the test ended. This activity created the error "Error: thrown from immediate throw fail" and would have caused the test to fail, but instead triggered an uncaughtException event. - Error: Test "immediate reject - passes but warns" at test/fixtures/test-runner/output/output.js:86:1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from immediate reject fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. - Error: Test "callback called twice in different ticks" at test/fixtures/test-runner/output/output.js:251:1 generated asynchronous activity after the test ended. This activity created the error "Error [ERR_TEST_FAILURE]: callback invoked multiple times" and would have caused the test to fail, but instead triggered an uncaughtException event. - Error: Test "callback async throw after done" at test/fixtures/test-runner/output/output.js:269:1 generated asynchronous activity after the test ended. This activity created the error "Error: thrown from callback async throw after done" and would have caused the test to fail, but instead triggered an uncaughtException event. - tests 75 + Error: Test "immediate throw - passes but warns" at test/fixtures/test-runner/output/output.js:104:1 generated asynchronous activity after the test ended. This activity created the error "Error: thrown from immediate throw fail" and would have caused the test to fail, but instead triggered an uncaughtException event. + Error: Test "immediate reject - passes but warns" at test/fixtures/test-runner/output/output.js:110:1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from immediate reject fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. + Error: Test "callback called twice in different ticks" at test/fixtures/test-runner/output/output.js:275:1 generated asynchronous activity after the test ended. This activity created the error "Error [ERR_TEST_FAILURE]: callback invoked multiple times" and would have caused the test to fail, but instead triggered an uncaughtException event. + Error: Test "callback async throw after done" at test/fixtures/test-runner/output/output.js:293:1 generated asynchronous activity after the test ended. This activity created the error "Error: thrown from callback async throw after done" and would have caused the test to fail, but instead triggered an uncaughtException event. + tests 81 suites 0 - pass 36 + pass 40 fail 24 cancelled 2 - skipped 9 - todo 4 + skipped 10 + todo 5 duration_ms * failing tests: diff --git a/test/fixtures/test-runner/output/spec_reporter_cli.js b/test/fixtures/test-runner/output/spec_reporter_cli.js index 6fefa6b550b9f1..9802c6b3414a91 100644 --- a/test/fixtures/test-runner/output/spec_reporter_cli.js +++ b/test/fixtures/test-runner/output/spec_reporter_cli.js @@ -3,12 +3,17 @@ require('../../../common'); const fixtures = require('../../../common/fixtures'); const spawn = require('node:child_process').spawn; -const child = spawn(process.execPath, - [ - '--no-warnings', '--test', '--test-reporter', 'spec', - fixtures.path('test-runner/output/output.js'), - ], - { stdio: 'pipe' }); +const child = spawn( + process.execPath, + [ + '--no-warnings', + '--test-reporter', 'spec', + '--test', + fixtures.path('test-runner/output/output.js'), + ], + { stdio: 'pipe' }, +); + // eslint-disable-next-line no-control-regex child.stdout.on('data', (d) => process.stdout.write(d.toString().replace(/[^\x00-\x7F]/g, '').replace(/\u001b\[\d+m/g, ''))); child.stderr.pipe(process.stderr); diff --git a/test/fixtures/test-runner/output/spec_reporter_cli.snapshot b/test/fixtures/test-runner/output/spec_reporter_cli.snapshot index b3a352092c677a..64f65d0edfbead 100644 --- a/test/fixtures/test-runner/output/spec_reporter_cli.snapshot +++ b/test/fixtures/test-runner/output/spec_reporter_cli.snapshot @@ -1,3 +1,9 @@ + sync expect fail (method) (*ms) # EXPECTED FAILURE + sync expect fail (options) (*ms) # EXPECTED FAILURE + async expect fail (method) (*ms) # EXPECTED FAILURE + async expect fail (options) (*ms) # EXPECTED FAILURE + sync todo with expect fail (*ms) # TODO + sync skip expect fail (*ms) # SKIP sync pass todo (*ms) # TODO sync pass todo with message (*ms) # this is a passing todo sync fail todo (*ms) # TODO @@ -84,20 +90,20 @@ unfinished test with unhandledRejection (*ms) assertion errors display actual and expected properly (*ms) invalid subtest fail (*ms) - Error: Test "unhandled rejection - passes but warns" at test/fixtures/test-runner/output/output.js:72:1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. - Error: Test "async unhandled rejection - passes but warns" at test/fixtures/test-runner/output/output.js:76:1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from async unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. + Error: Test "unhandled rejection - passes but warns" at test/fixtures/test-runner/output/output.js:96:1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. + Error: Test "async unhandled rejection - passes but warns" at test/fixtures/test-runner/output/output.js:100:1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from async unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. Error: A resource generated asynchronous activity after the test ended. This activity created the error "Error: uncaught from outside of a test" which triggered an uncaughtException event, caught by the test runner. - Error: Test "immediate throw - passes but warns" at test/fixtures/test-runner/output/output.js:80:1 generated asynchronous activity after the test ended. This activity created the error "Error: thrown from immediate throw fail" and would have caused the test to fail, but instead triggered an uncaughtException event. - Error: Test "immediate reject - passes but warns" at test/fixtures/test-runner/output/output.js:86:1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from immediate reject fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. - Error: Test "callback called twice in different ticks" at test/fixtures/test-runner/output/output.js:251:1 generated asynchronous activity after the test ended. This activity created the error "Error [ERR_TEST_FAILURE]: callback invoked multiple times" and would have caused the test to fail, but instead triggered an uncaughtException event. - Error: Test "callback async throw after done" at test/fixtures/test-runner/output/output.js:269:1 generated asynchronous activity after the test ended. This activity created the error "Error: thrown from callback async throw after done" and would have caused the test to fail, but instead triggered an uncaughtException event. - tests 76 + Error: Test "immediate throw - passes but warns" at test/fixtures/test-runner/output/output.js:104:1 generated asynchronous activity after the test ended. This activity created the error "Error: thrown from immediate throw fail" and would have caused the test to fail, but instead triggered an uncaughtException event. + Error: Test "immediate reject - passes but warns" at test/fixtures/test-runner/output/output.js:110:1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from immediate reject fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. + Error: Test "callback called twice in different ticks" at test/fixtures/test-runner/output/output.js:275:1 generated asynchronous activity after the test ended. This activity created the error "Error [ERR_TEST_FAILURE]: callback invoked multiple times" and would have caused the test to fail, but instead triggered an uncaughtException event. + Error: Test "callback async throw after done" at test/fixtures/test-runner/output/output.js:293:1 generated asynchronous activity after the test ended. This activity created the error "Error: thrown from callback async throw after done" and would have caused the test to fail, but instead triggered an uncaughtException event. + tests 82 suites 0 - pass 37 + pass 41 fail 24 cancelled 2 - skipped 9 - todo 4 + skipped 10 + todo 5 duration_ms * failing tests: diff --git a/typings/globals.d.ts b/typings/globals.d.ts index 9b5a38db71a061..060494300c1caa 100644 --- a/typings/globals.d.ts +++ b/typings/globals.d.ts @@ -18,6 +18,7 @@ import { OSBinding } from './internalBinding/os'; import { ProcessBinding } from './internalBinding/process'; import { SeaBinding } from './internalBinding/sea'; import { SerdesBinding } from './internalBinding/serdes'; +import { StringDecoderBinding } from './internalBinding/string_decoder'; import { SymbolsBinding } from './internalBinding/symbols'; import { TimersBinding } from './internalBinding/timers'; import { TypesBinding } from './internalBinding/types'; @@ -52,6 +53,7 @@ interface InternalBindingMap { process: ProcessBinding; sea: SeaBinding; serdes: SerdesBinding; + string_decoder: StringDecoderBinding; symbols: SymbolsBinding; timers: TimersBinding; types: TypesBinding; diff --git a/typings/internalBinding/string_decoder.d.ts b/typings/internalBinding/string_decoder.d.ts new file mode 100644 index 00000000000000..b014f83eebd412 --- /dev/null +++ b/typings/internalBinding/string_decoder.d.ts @@ -0,0 +1,19 @@ +declare namespace InternalStringDecoderBinding { + type Buffer = Uint8Array; +} + +export interface StringDecoderBinding { + readonly kIncompleteCharactersStart: number; + readonly kIncompleteCharactersEnd: number; + readonly kMissingBytes: number; + readonly kBufferedBytes: number; + readonly kEncodingField: number; + readonly kNumFields: number; + readonly kSize: number; + + readonly encodings: string[]; + + decode(decoder: InternalStringDecoderBinding.Buffer, buffer: ArrayBufferView): string; + flush(decoder: InternalStringDecoderBinding.Buffer): string; +} +