mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 12:20:27 +01:00
The option name should be `directory` to be consistent with the returned result. It should also allow environment variable overrides. This also adds documentation for the new options and improves it. PR-URL: https://github.com/nodejs/node/pull/59931 Reviewed-By: Aditi Singh <aditisingh1400@gmail.com>
24 lines
870 B
JavaScript
24 lines
870 B
JavaScript
'use strict';
|
|
|
|
const { enableCompileCache, getCompileCacheDir, constants } = require('module');
|
|
|
|
console.log('dir before enableCompileCache:', getCompileCacheDir());
|
|
const options = JSON.parse(process.env.NODE_TEST_COMPILE_CACHE_OPTIONS);
|
|
console.log('options:', options);
|
|
const result = enableCompileCache(options);
|
|
switch (result.status) {
|
|
case constants.compileCacheStatus.FAILED:
|
|
console.log('Compile cache failed. ' + result.message);
|
|
break;
|
|
case constants.compileCacheStatus.ENABLED:
|
|
console.log('Compile cache enabled. ' + result.directory);
|
|
break;
|
|
case constants.compileCacheStatus.ALREADY_ENABLED:
|
|
console.log('Compile cache already enabled.');
|
|
break;
|
|
case constants.compileCacheStatus.DISABLED:
|
|
console.log('Compile cache already disabled.');
|
|
break;
|
|
}
|
|
console.log('dir after enableCompileCache:', getCompileCacheDir());
|