node/test
Daniel Lemire a6273b1f4a src: embed zstd dictionary for further compile cache size wins
Builds on the zstd compression in #63861 by embedding a small zstd
dictionary trained on a diverse corpus of real modules, so each
small/medium compile-cache entry compresses better. Per entry we keep
the smaller of the plain and dictionary-assisted frame, so the
dictionary only ever helps.

- Add src/compile_cache_zstd.dict (16 KiB). It is trained on V8 code
  caches harvested (via vm.compileFunction, the same shape the CJS
  loader produces) from a diverse corpus: bundled npm packages, lib/,
  tools/ and a few deps.
- Add tools/generate_compile_cache_dict.py and a node.gyp action that
  generates compile_cache_zstd_dict.h into SHARED_INTERMEDIATE_DIR at
  build time; no generated header is checked in. libnode include_dirs
  updated to pick it up.
- Prepare the CDict/DDict once per process (shared across all handlers
  and Workers, matching the lazy-context approach from #63861) and use
  them in Persist() and ReadCacheFile(). Persist() compresses the plain
  and dict frames into separate buffers and selects the smaller, so the
  written bytes and recorded size always agree. The dictionary is only
  tried for entries up to 256 KiB; larger blobs never benefit, so the
  second compression is skipped to avoid wasted work. Falls back to
  plain zstd if dictionary preparation fails.
- The dictionary is embedded in the binary because the compile cache
  must be usable early, portably, and without extra filesystem state.
- No on-disk format change: dict-assisted frames carry the dictID, plain
  frames carry none, and a single DDict decompresses both.
- Size, measured on data held out from training (per-entry min policy):
  diverse modules go from ~1.87x (plain zstd) to ~2.44x with the
  dictionary (~24% smaller on disk); on test/parallel, which is not in
  the training corpus at all, ~1.74x -> ~2.22x (~22% smaller). A real
  end-to-end run (npm --version, ~70 modules) is ~15% smaller. Read
  time is unchanged and the extra write-time work is negligible.
- Add a multi-module write/read roundtrip test and a startup benchmark
  (standard createBenchmark harness).
2026-06-11 21:39:47 -04:00
..
abort
addons test: add regression test for using ObjectWrap in worker 2026-06-05 12:53:44 +00:00
async-hooks test: accept SIGILL aborts in async-hooks tests 2026-06-03 05:34:34 +00:00
benchmark
cctest crypto: fix warnings in test_node_crypto.cc 2026-06-02 08:42:16 +00:00
client-proxy
common
doctool
embedding lib: insert argv[0] at argv[1] in setDeserializeMainFunction 2026-06-10 11:36:03 +09:00
es-module
ffi
fixtures lib: insert argv[0] at argv[1] in setDeserializeMainFunction 2026-06-10 11:36:03 +09:00
fuzzers
internet
js-native-api
known_issues
message
module-hooks
node-api
nop
overlapped-checker
parallel src: embed zstd dictionary for further compile cache size wins 2026-06-11 21:39:47 -04:00
pseudo-tty
pummel
report
sea
sequential watch: cancel pending restart on shutdown 2026-06-04 23:20:48 +00:00
sqlite
system-ca
test-runner test_runner: fix watch cwd with isolation none 2026-06-08 06:56:20 +00:00
test426 test: update test426-fixtures to 2965987bf4c96afa400c9356c8e620cb340aaee 2026-06-02 10:11:31 +00:00
testpy
tick-processor
tools
v8-updates
wasi
wasm-allocation
wpt test: update WPT for WebCryptoAPI to 0c413fb56b 2026-06-01 19:03:32 +00:00
eslint.config_partial.mjs
README.md
root.status

Node.js Core Tests

This directory contains code and data used to test the Node.js implementation.

For a detailed guide on how to write tests in this directory, see the guide on writing tests.

On how to run tests in this directory, see the contributing guide.

For the tests to run on Windows, be sure to clone Node.js source code with the autocrlf git config flag set to true.

Test Directories

Directory Runs on CI Purpose
abort Yes Tests that use --abort-on-uncaught-exception and other cases where we want to avoid generating a core file.
addons Yes Tests for addon functionality along with some tests that require an addon.
async-hooks Yes Tests for async_hooks functionality.
benchmark Yes Test minimal functionality of benchmarks.
cctest Yes C++ tests that are run as part of the build process.
code-cache No Tests for a Node.js binary compiled with V8 code cache.
common N/A Common modules shared among many tests.1
doctool Yes Tests for the documentation generator.
es-module Yes Test ESM module loading.
fixtures N/A Test fixtures used in various tests throughout the test suite.
internet No Tests that make real outbound network connections.2
js-native-api Yes Tests for Node.js-agnostic Node-API functionality.
known_issues Yes Tests reproducing known issues within the system.3
message Yes Tests for messages that are output for various conditions
node-api Yes Tests for Node.js-specific Node-API functionality.
parallel Yes Various tests that are able to be run in parallel.
pseudo-tty Yes Tests that require stdin/stdout/stderr to be a TTY.
pummel No Various tests for various modules / system functionality operating under load.
sequential Yes Various tests that must not run in parallel.
testpy N/A Test configuration utility used by various test suites.
tick-processor No Tests for the V8 tick processor integration.4
v8-updates No Tests for V8 performance integration.

  1. Documentation ↩︎

  2. Tests for networking related modules may also be present in other directories, but those tests do not make outbound connections. ↩︎

  3. All tests inside of this directory are expected to fail. If a test doesn't fail on certain platforms, those should be skipped via known_issues.status. ↩︎

  4. The tests are for the logic in lib/internal/main/prof_process.js and lib/internal/v8_prof_polyfill.js. The tests confirm that the profile processor packages the correct set of scripts from V8 and introduces the correct platform specific logic. ↩︎