node/test/parallel/test-compile-cache-api-error.js
Joyee Cheung 4dfed556ba module: throw when invalid argument is passed to enableCompileCache()
PR-URL: https://github.com/nodejs/node/pull/54971
Fixes: https://github.com/nodejs/node/issues/54770
Fixes: https://github.com/nodejs/node/issues/54465
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2024-09-20 19:05:06 +00:00

12 lines
356 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, () => {}, {}, []]) {
assert.throws(() => enableCompileCache(invalid), { code: 'ERR_INVALID_ARG_TYPE' });
}