Support function mocking on Node.js test runner
The node:test
module supports mocking during testing via a top-level mock
object.
test('spies on an object method', (t) => {
const number = {
value: 5,
add(a) {
return this.value + a;
},
};
t.mock.method(number, 'add');
assert.strictEqual(number.add(3), 8);
assert.strictEqual(number.add.mock.calls.length, 1);
});
Contributed by Colin Ihrig in #45326
fs.watch recursive support on Linux
fs.watch
supports recursive watch using the recursive: true
option.
const watcher = fs.watch(testDirectory, { recursive: true });
watcher.on('change', function(event, filename) {
});
Contributed by Yagiz Nizipli in #45098
Other notable changes
- deps
- update ICU to 72.1 (Michaël Zasso) #45068
- doc
- lib
- drop fetch experimental warning (Matteo Collina) #45287
- util
Commits
- [
c9cf399ec7
] – benchmark: add parameters to text-decoder benchmark (Yagiz Nizipli) #45363 - [
79f6bb061d
] – benchmark: fix text-decoder benchmark (Yagiz Nizipli) #45363 - [
a27c994ced
] – benchmark: add blob benchmark (Yagiz Nizipli) #44990 - [
c45b6aee78
] – bootstrap: merge main thread and worker thread initializations (Joyee Cheung) #44869 - [
33691208df
] – buffer: fix validation of options inBlob
constructor (Antoine du Hamel) #45156 - [
7b938df296
] – build: support Python 3.11 (Luigi Pinca) #45191 - [
75e0a2d109
] – build: workaround for node-core-utils (Jiawen Geng) #45199 - [
f598edbdf4
] – build: fix icu-small build with ICU 72.1 (Steven R. Loomis) #45195 - [
29b9f4f90c
] – build: remove unused language files (Ben Noordhuis) #45138 - [
3a1ee940d1
] – build: add GitHub token to auto-start-ci workflow (Richard Lau) #45185 - [
17349a2f42
] – build: restore Windows resource file (Richard Lau) #45042 - [
24e24bd063
] – build: add version info to timezone update PR (Darshan Sen) #45021 - [
8d7aa53e6b
] – build,win: pass –debug-nghttp2 to configure (Santiago Gimeno) #45209 - [
b2e60480f3
] – child_process: validate arguments for null bytes (Darshan Sen) #44782 - [
1f0edde412
] – crypto: handle more webcrypto errors with OperationError (Filip Skokan) #45320 - [
13fb05e12b
] – crypto: handle unsupported AES ciphers in webcrypto (Filip Skokan) #45321 - [
c168cbfbb3
] – deps: V8: cherry-pick 56816d76c121 (Shi Pujin) #45353 - [
1432474abf
] – deps: upgrade npm to 8.19.3 (npm team) #45322 - [
f35d56200d
] – deps: update corepack to 0.15.1 (Node.js GitHub Bot) #45331 - [
44de2321aa
] – deps: patch V8 to 10.7.193.20 (Michaël Zasso) #45228 - [
bfe3819f08
] – deps: upgrade to libuv 1.44.2 (Luigi Pinca) #42340 - [
0d41df96b3
] – deps: update corepack to 0.15.0 (Node.js GitHub Bot) #45235 - [
0d241638ca
] – deps: update undici to 5.12.0 (Node.js GitHub Bot) #45236 - [
f58996188a
] – Revert “deps: make V8 compilable with older glibc” (Michaël Zasso) #45162 - [
8cda730e58
] – deps: update ICU to 72.1 (Michaël Zasso) #45068 - [
0a6ed6f710
] – Revert “deps: V8: forward declaration ofRtl*FunctionTable
” (Michaël Zasso) #45119 - [
2f7518ada2
] – deps: update timezone (Node.js GitHub Bot) #44950 - [
3bfba6df79
] – deps: patch V8 to 10.7.193.16 (Michaël Zasso) #45023 - [
b5baaa61b3
] – dns: fix port validation (Antoine du Hamel) #45135 - [
0e9bad97cc
] – doc: allow for holidays in triage response (Michael Dawson) #45267 - [
d4aabb9d3d
] – doc: include last security release date (Juan José Arboleda) #45368 - [
ba45373164
] – doc: fix email for Ashley (Michael Dawson) #45364 - [
d5e5c75b13
] – doc: fix test runner’s only tests section header (Colin Ihrig) #45343 - [
a7c5f31c47
] – doc: run license-builder (github-actions[bot]) #45349 - [
3de125743e
] – doc: add more info for timer.setInterval (theanarkh) #45232 - [
5a1252d9b4
] – doc: use module names in stability overview table (Filip Skokan) #45312 - [
4d38bf2c5f
] – doc: addnode:
prefix for examples (Daeyeon Jeong) #45328 - [
b4b6b95f48
] – doc: update name of Node.js core Slack channel (Rich Trott) #45293 - [
7d7e7c316b
] – doc: fix “task_processor.js” typo (andreysoktoev) #45257 - [
b9039a54af
] – doc: add history section tofetch
-related globals (Antoine du Hamel) #45198 - [
d9163f1632
] – doc: clarify moderation inonboarding.md
(Benjamin Gruenbaum) #41930 - [
c179c1478b
] – doc: change make lint to make lint-md (RafaelGSS) #45197 - [
58bec56fab
] – doc: add more lts update steps to release guide (Ruy Adorno) #45177 - [
8f8d7e76ac
] – doc: add bmuenzenmeyer to triagers (Brian Muenzenmeyer) #45155 - [
de2df550f6
] – doc: update process.release (Filip Skokan) #45170 - [
916e8760ba
] – doc: add link to triage guide (Brian Muenzenmeyer) #45154 - [
54d806853e
] – doc: mark Node.js 12 as End-of-Life (Rafael Gonzaga) #45186 - [
3a26347649
] – doc: add lukekarrys to collaborators (Luke Karrys) #45180 - [
85cb4d795c
] – doc: update mark release line lts on release guide (Ruy Adorno) #45101 - [
c23e023a2d
] – doc: be more definite and present tense-y (Ben Noordhuis) #45120 - [
519002152b
] – doc: add major version note to release guide (Ruy Adorno) #45054 - [
809e8dcbd2
] – doc: fix v14.x link maintaining openssl guide (RafaelGSS) #45071 - [
9d449d389d
] – doc: add note about latest GitHub release (Michaël Zasso) #45111 - [
ee34a3a1bc
] – doc: mention v18.x openssl maintaining guide (Rafael Gonzaga) #45070 - [
3e4033a90d
] – doc: fix display of “problematic” ASCII characters (John Gardner) #44373 - [
533e38b0b8
] – doc: mark Node.js v17.x as EOL (KaKa) #45110 - [
93a34faa39
] – doc: update Node.js 16 End-of-Life date (Richard Lau) #45103 - [
b4beddef79
] – doc: fix typo in parseArgs default value (Tobias Nießen) #45083 - [
e8103fd33b
] – doc: updated security stewards (Michael Dawson) #45005 - [
5fbccae4f0
] – doc: fix http and http2 writeEarlyHints() parameter (Fabian Meyer) #45000 - [
d47f83251a
] – doc: run license-builder (github-actions[bot]) #45034 - [
e6bbc5033d
] – doc: improve the workflow to test release binaries (Rafael Gonzaga) #45004 - [
f0c18f04f0
] – doc: fix undici version in changelog (Michael Dawson) #44982 - [
ffba3218ec
] – doc: add info on fixup to security release process (Michael Dawson) #44807 - [
edb92f4510
] – doc: add anonrig to collaborators (Yagiz Nizipli) #45002 - [
58334a38e8
] – doc, async_hooks: improve and add migration hints (Gerhard Stöbich) #45369 - [
7225a7d46b
] – doc, http: add Uint8Array as allowed type (Gerhard Stöbich) #45167 - [
40a5e22328
] – esm: protect ESM loader from prototype pollution (Antoine du Hamel) #45175 - [
2e5d8e7239
] – esm: protect ESM loader from prototype pollution (Antoine du Hamel) #45044 - [
c3dd696081
] – events: add unique events benchmark (Yagiz Nizipli) #44657 - [
daff3b8b09
] – fs: update todo message (Yagiz Nizipli) #45265 - [
670def3d6f
] – fs: fix opts.filter issue in cpSync (Tho) #45143 - [
34bfef91a9
] – (SEMVER-MINOR) fs: add recursive watch to linux (Yagiz Nizipli) #45098 - [
d89ca1b443
] – fs: trace more fs api (theanarkh) #45095 - [
1a04881494
] – http: headers(Distinct), trailers(Distinct) setters to be no-op (Madhuri) #45176 - [
8abc3f732a
] – http: add priority to common http headers (James M Snell) #45045 - [
316354e3d3
] – http2: improve session close/destroy procedures (Santiago Gimeno) #45115 - [
1635140952
] – http2: fix crash on Http2Stream::diagnostic_name() (Santiago Gimeno) #45123 - [
94b7f5338c
] – http2: fix debugStream method (Santiago Gimeno) #45129 - [
3db37e7d1b
] – inspector: refactorinspector/promises
to be more robust (Antoine du Hamel) #45041 - [
0478e4063f
] – lib: add options to the heap snapshot APIs (Joyee Cheung) #44989 - [
a8e901555a
] – lib: fix JSDoc issues (Rich Trott) #45243 - [
74352842bc
] – lib: use process.nextTick() instead of setImmediate() (Luigi Pinca) #42340 - [
9f3d2f6879
] – lib: drop fetch experimental warning (Matteo Collina) #45287 - [
e2181e057b
] – lib: fix eslint early return (RafaelGSS) #45409 - [
d1726692ee
] – lib: fix TypeError when converting a detached buffer source (Kohei Ueno) #44020 - [
d7470ad986
] – lib: fixAbortSignal.timeout
parameter validation (dnalborczyk) #42856 - [
c7b7f2bec2
] – lib: add lint rule to protect againstObject.prototype.then
pollution (Antoine du Hamel) #45061 - [
9ed9aa8233
] – lib: add ability to add separate event name to defineEventHandler (James M Snell) #45032 - [
8b4a41e23d
] – lib: fix typo inpre_execution.js
(Antoine du Hamel) #45039 - [
cc2393c9fe
] – lib: promise version of streams.finished call clean up (Naor Tedgi (Abu Emma)) #44862 - [
17ef1bbc8e
] – lib: make properties on Blob and URL enumerable (Khafra) #44918 - [
8199841e9c
] – lib: support more attributes for early hint link (Yagiz Nizipli) #44874 - [
88c3bb609b
] – meta: update AUTHORS (Node.js GitHub Bot) #45333 - [
a866e8c163
] – meta: update collaborator email address in README (Rich Trott) #45251 - [
bfbfacad79
] – meta: fix email address typo in README (Rich Trott) #45250 - [
0d58bb9531
] – meta: remove dont-land-on-v12 auto labeling (Moshe Atlow) #45233 - [
b41b5ba658
] – meta: update AUTHORS (Node.js GitHub Bot) #45238 - [
ad9a5bb61f
] – meta: move a collaborator to emeritus (Rich Trott) #45160 - [
ec8683052b
] – meta: move one or more collaborators to emeritus (Node.js GitHub Bot) #45036 - [
7900810fb3
] – meta: update AUTHORS (Node.js GitHub Bot) #45020 - [
738144c311
] – module: ensure relative requires work from deleted directories (Bradley Farias) #42384 - [
36acf8a13e
] – net: remove _readableState from debug statement (Rich Trott) #45063 - [
aaca54c5c0
] – node-api: handle no support for external buffers (Michael Dawson) #45181 - [
2105f099ea
] – node-api,test: fix test_reference_double_free crash (Vladimir Morozov) #44927 - [
2fcf851a91
] – os: convert uid and gid to 32-bit signed integers (Luigi Pinca) #42340 - [
dfe4237d77
] – perf_hooks: align toStringTag with other Web Performance implementations (Daeyeon Jeong) #45157 - [
9d15da3341
] – report: add more memory info (theanarkh) #45254 - [
a2620acad7
] – report: add rss and use/kernel cpu usage fields (theanarkh) #45043 - [
66e1dc4979
] – report,doc: define report version semantics (Gireesh Punathil) #45050 - [
86e22b4e19
] – src: track contexts in the Environment instead of AsyncHooks (Joyee Cheung) #45282 - [
326d19af3d
] – src: resolve TODO related to inspector CVEs (Tobias Nießen) #45341 - [
4e45585ca2
] – src: revert is_release to 0 (RafaelGSS) #45315 - [
5d480118fb
] – src: print nghttp2 logs when using –debug-nghttp2 (Santiago Gimeno) #45209 - [
3e46ebda3c
] – src: trace threadpool event (theanarkh) #44458 - [
97547bcd14
] – src: lock-free init_process_flags (Jérémy Lal) #45221 - [
42db84913b
] – src: call uv_library_shutdown before DisposePlatform (theanarkh) #45226 - [
aa4152a1b6
] – src: fixcrypto.privateEncrypt
fails first time (liuxingbaoyu) #42793 - [
243c141b69
] – src: clarify OptionEnvvarSettings member names (Chengzhong Wu) #45057 - [
5335e29ce7
] – src: let http2 streams end after session close (Santiago Gimeno) #45153 - [
8d5682266e
] – src: remap invalid file descriptors usingdup2
(Obiwac) #44461 - [
4e14ed8878
] – src: remove unusedcontextify_global_private_symbol
(Daeyeon Jeong) #45128 - [
a8412f5677
] – src: forbid running watch mode in REPL (Moshe Atlow) #45058 - [
162bf0ddff
] – src: fix test runner coverage (Moshe Atlow) #45055 - [
e5b1179630
] – src: optimize ALPN callback (Ben Noordhuis) #44875 - [
9dc21a1f86
] – src: simplify ALPN code, remove indirection (Ben Noordhuis) #44875 - [
5fce8e3495
] – src: iwyu in cleanup_queue.cc (Shelley Vohr) #44983 - [
824dcfc422
] – src: return void in InitializeInspector() (Joyee Cheung) #44903 - [
7a31ae8ab1
] – src,lib: retrieve parsed source map url from v8 (Chengzhong Wu) #44798 - [
ccb1c1e9a2
] – stream: add compose operator (Raz Luvaton) #44937 - [
e60d9053bc
] – stream: fix duplexify premature destroy (Robert Nagy) #45133 - [
bc0ae3e74e
] – stream: fix web streams have no Symbol.toStringTag (Jithil P Ponnan) #45117 - [
1655532fd2
] – stream: don’t push null from closed promise #42694 (David Halls) #45026 - [
717db1d46a
] – test: skip test-fs-largefile if not enough disk space (Rich Trott) #45339 - [
4a80aff16e
] – test: fix catching failed assertion (Pavel Horal) #45222 - [
66e7821506
] – test: defer invocation checks (Luigi Pinca) #42340 - [
43db0fbd49
] – test: fix test-socket-write-after-fin-error (Luigi Pinca) #42340 - [
d5f4d98847
] – test: maketest-eventemitter-asyncresource.js
shorter (Juan José) #45146 - [
7428651100
] – test: convert test-debugger-pid to async/await (Luke Karrys) #45179 - [
f10f2c1121
] – test: fix textdecoder test for small-icu builds (Richard Lau) #45225 - [
eed799bd31
] – test: improve test coverage intest-event-capture-rejections.js
(Juan José) #45148 - [
069747bfdd
] – test: fix timeout of test-heap-prof.js in riscv devices (Yu Gu) #42674 - [
ddb7df76de
] – test: deflake test-http2-empty-frame-without-eof (Santiago Gimeno) #45212 - [
02ebde39d3
] – test: use common/tmpdir in watch-mode ipc test (Richard Lau) #45211 - [
f9bc40a1fc
] – test: use uv_sleep() where possible (Santiago Gimeno) #45124 - [
3c7ea23b8f
] – test: fix typo intest/parallel/test-fs-rm.js
(Tim Shilov) #44882 - [
b39dcde056
] – test: remove a snapshot blob from test-inspect-address-in-use.js (Daeyeon Jeong) #45132 - [
fabed9bdc8
] – test: add test for Module._stat (Darshan Sen) #44713 - [
2b3b291c97
] – test: watch mode inspect restart repeatedly (Moshe Atlow) #45060 - [
17e86e4188
] – test: remove experimental-wasm-threads flag (Michaël Zasso) #45074 - [
f0480d68e9
] – test: remove unnecessary noop function args tomustCall()
(Antoine du Hamel) #45047 - [
82e6043118
] – test: mark test-watch-mode* as flaky on all platforms (Pierrick Bouvier) #45049 - [
26a2ae2489
] – test: wrap missingcommon.mustCall
(Moshe Atlow) #45064 - [
8662399cda
] – test: remove mentions of--experimental-async-stack-tagging-api
flag (Simon) #45051 - [
71b8d506ed
] – test: improve assertions intest-repl-unsupported-option.js
(Juan José) #44953 - [
dbc696d363
] – test: remove unnecessary noop function args to mustCall() (Rich Trott) #45027 - [
c1ca19fb06
] – test: update WPT resources (Khaidi Chu) #44948 - [
43677e5a34
] – test: skip test depending onoverlapped-checker
when not available (Antoine du Hamel) #45015 - [
3519d74e87
] – test: improve test coverage foros
package (Juan José) #44959 - [
ea0cfc9a83
] – test: add test to improve coverage in http2-compat-serverresponse (Cesar Mario Diaz) #44970 - [
482578682c
] – test: improve test coverage intest-child-process-spawn-argv0.js
(Juan José) #44955 - [
a618dc3c3e
] – test: use CHECK instead of EXPECT where necessary (Tobias Nießen) #44795 - [
c59d3b76e6
] – test: refactor promises to async/await (Madhuri) #44980 - [
36c5927c60
] – test,crypto: update WebCryptoAPI WPT (Filip Skokan) #45165 - [
6158d740f3
] – test_runner: support function mocking (Colin Ihrig) #45326 - [
920804dc46
] – test_runner: avoid swallowing of asynchronously thrown errors (MURAKAMI Masahiko) #45264 - [
8e7f9de45e
] – test_runner: fix afterEach not running on test failures (Jithil P Ponnan) #45204 - [
0040030443
] – test_runner: report tap subtest in order (Moshe Atlow) #45220 - [
afa8291c7c
] – test_runner: call {before,after}Each() on suites (Colin Ihrig) #45161 - [
ff174b0937
] – test_runner: add extra fields in AssertionError YAML (Bryan English) #44952 - [
bf868fdfab
] – (SEMVER-MINOR) tls: add “ca” property to certificate object (Ben Noordhuis) #44935 - [
e8075fd1f8
] – tools: add automation for updating acorn dependency (Facundo Tuesca) #45357 - [
9aa305ff3e
] – tools: add documentation regarding our api tooling (Claudio Wunder) #45270 - [
76cbc07f9b
] – tools: allow scripts to run from anywhere (Luigi Pinca) #45361 - [
aa875a4d6a
] – tools: update eslint to 8.27.0 (Node.js GitHub Bot) #45358 - [
4b71db13ae
] – tools: update eslint to 8.26.0 (Node.js GitHub Bot) #45243 - [
63267dfefb
] – tools: update lint-md-dependencies to rollup@3.2.5 (Node.js GitHub Bot) #45332 - [
e275859138
] – tools: fix stability index generation (Antoine du Hamel) #45346 - [
97fe8bacb1
] – tools: increase macOS cores to 3 on GitHub CI (Rich Trott) #45340 - [
eda4ae51ca
] – tools: add automation for updating base64 dependency (Facundo Tuesca) #45300 - [
2ee052f794
] – tools: fixrequest-ci-failed
comment (Antoine du Hamel) #45291 - [
e118dd88fd
] – tools: refactor dynamic strings creation in shell scripts (Antoine du Hamel) #45240 - [
ba89cea683
] – tools: update lint-md-dependencies (Node.js GitHub Bot) #45237 - [
786f086800
] – tools: use Python 3.11 in GitHub Actions workflows (Luigi Pinca) #45191 - [
0738d14fa4
] – tools: fixrequest-ci-failed
comment (Antoine du Hamel) #45218 - [
49be13ccd8
] – tools: keep Emeriti lists case-insensitive alphabetic (Rich Trott) #45159 - [
6e30d2231b
] – tools: update actions/setup-python to v4 (Yagiz Nizipli) #45178 - [
a4158692d7
] – tools: update V8 gypfiles for RISC-V (Andreas Schwab) #45149 - [
c43bc2169f
] – tools: fixcreate-or-update-pull-request-action
hash on GHA (Antoine du Hamel) #45166 - [
2ccc03ec32
] – tools: update gr2m/create-or-update-pull-request-action (Luigi Pinca) #45022 - [
a70b27629f
] – tools: do not use the set-output command in workflows (Luigi Pinca) #45024 - [
025e616662
] – tools: update lint-md-dependencies (Node.js GitHub Bot) #45019 - [
732f9a78d3
] – trace_events: fix getCategories (theanarkh) #45092 - [
1bc84ce52c
] – url: remove \t \n \r in url.parse() similar to WHATWG (Rich Trott) #45116 - [
84e7388160
] – url: improve port validation (Rich Trott) #45012 - [
02cff4a3d3
] – url: improve url.parse() compliance with WHATWG URL (Rich Trott) #45011 - [
89390a6be2
] – util: improve text-decoder performance (Yagiz Nizipli) #45363 - [
0deed8daeb
] – util: improve textdecoder decode performance (Yagiz Nizipli) #45294 - [
d41f8ffc36
] – (SEMVER-MINOR) util: add MIME utilities (#21128) (Bradley Farias) #21128
Windows 32-bit Installer: https://nodejs.org/dist/v19.1.0/node-v19.1.0-x86.msi
Windows 64-bit Installer: https://nodejs.org/dist/v19.1.0/node-v19.1.0-x64.msi
Windows 32-bit Binary: https://nodejs.org/dist/v19.1.0/win-x86/node.exe
Windows 64-bit Binary: https://nodejs.org/dist/v19.1.0/win-x64/node.exe
macOS 64-bit Installer: https://nodejs.org/dist/v19.1.0/node-v19.1.0.pkg
macOS Apple Silicon 64-bit Binary: https://nodejs.org/dist/v19.1.0/node-v19.1.0-darwin-arm64.tar.gz
macOS Intel 64-bit Binary: https://nodejs.org/dist/v19.1.0/node-v19.1.0-darwin-x64.tar.gz
Linux 64-bit Binary: https://nodejs.org/dist/v19.1.0/node-v19.1.0-linux-x64.tar.xz
Linux PPC LE 64-bit Binary: https://nodejs.org/dist/v19.1.0/node-v19.1.0-linux-ppc64le.tar.xz
Linux s390x 64-bit Binary: https://nodejs.org/dist/v19.1.0/node-v19.1.0-linux-s390x.tar.xz
AIX 64-bit Binary: https://nodejs.org/dist/v19.1.0/node-v19.1.0-aix-ppc64.tar.gz
ARMv7 32-bit Binary: https://nodejs.org/dist/v19.1.0/node-v19.1.0-linux-armv7l.tar.xz
ARMv8 64-bit Binary: https://nodejs.org/dist/v19.1.0/node-v19.1.0-linux-arm64.tar.xz
Source Code: https://nodejs.org/dist/v19.1.0/node-v19.1.0.tar.gz
Other release files: https://nodejs.org/dist/v19.1.0/
Documentation: https://nodejs.org/docs/v19.1.0/api/