-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
module: skip NODE_COMPILE_CACHE when policy is enabled
It might be worth designing a policy for the compilation cache. For now, just skip the cache when policy is enabled. PR-URL: #52577 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]>
- Loading branch information
1 parent
c29d53c
commit 2231be6
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
'use strict'; | ||
|
||
// This tests NODE_COMPILE_CACHE is disabled when policy is used. | ||
|
||
const common = require('../common'); | ||
if (!common.hasCrypto) | ||
common.skip('missing crypto'); | ||
|
||
const { spawnSyncAndAssert } = require('../common/child_process'); | ||
const assert = require('assert'); | ||
const fs = require('fs'); | ||
const tmpdir = require('../common/tmpdir'); | ||
const fixtures = require('../common/fixtures'); | ||
|
||
{ | ||
tmpdir.refresh(); | ||
const dir = tmpdir.resolve('.compile_cache_dir'); | ||
const script = fixtures.path('policy', 'parent.js'); | ||
const policy = fixtures.path( | ||
'policy', | ||
'dependencies', | ||
'dependencies-redirect-policy.json'); | ||
spawnSyncAndAssert( | ||
process.execPath, | ||
['--experimental-policy', policy, script], | ||
{ | ||
env: { | ||
...process.env, | ||
NODE_DEBUG_NATIVE: 'COMPILE_CACHE', | ||
NODE_COMPILE_CACHE: dir | ||
}, | ||
cwd: tmpdir.path | ||
}, | ||
{ | ||
stderr: /skipping cache because policy is enabled/ | ||
}); | ||
assert(!fs.existsSync(dir)); | ||
} |