node/test/parallel/test-compile-cache-api-error.js
Aditi 94422e8a40
src: add an option to make compile cache portable
Adds an option (NODE_COMPILE_CACHE_PORTABLE) for
the built-in compile cache to encode the hashes with
relative file paths. On enabling the option,
the source directory along with cache directory can be
bundled and moved, and the cache continues to work.

When enabled, paths encoded in hash are relative to
compile cache directory.

PR-URL: https://github.com/nodejs/node/pull/58797
Fixes: https://github.com/nodejs/node/issues/58755
Refs: https://github.com/nodejs/node/issues/52696
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2025-09-12 11:00:39 +00:00

12 lines
363 B
JavaScript

'use strict';
// This tests module.enableCompileCache() throws when an invalid argument is passed.
require('../common');
const { enableCompileCache } = require('module');
const assert = require('assert');
for (const invalid of [0, null, false, 1, NaN, true, Symbol(0)]) {
assert.throws(() => enableCompileCache(invalid), { code: 'ERR_INVALID_ARG_TYPE' });
}