diff options
author | Bradley Farias <bradley.meck@gmail.com> | 2021-02-09 19:56:53 +0300 |
---|---|---|
committer | Danielle Adams <adamzdanielle@gmail.com> | 2021-02-16 17:16:20 +0300 |
commit | 799b2d52753c3283da7089c9d75e950afe9d819b (patch) | |
tree | 20db5af3e2039c31d83075f2977cd8509b9f2742 /test | |
parent | 88d3f74c85eaa62b4d721a880cb6bc8ea2237bc3 (diff) |
policy: fix cascade getting scope
PR-URL: https://github.com/nodejs/node/pull/37298
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Co-authored-by: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/fixtures/policy/dependencies/dependencies-scopes-and-resources-policy.json | 14 | ||||
-rw-r--r-- | test/fixtures/policy/multi-deps.js | 3 | ||||
-rw-r--r-- | test/parallel/test-policy-scopes.js | 16 |
3 files changed, 32 insertions, 1 deletions
diff --git a/test/fixtures/policy/dependencies/dependencies-scopes-and-resources-policy.json b/test/fixtures/policy/dependencies/dependencies-scopes-and-resources-policy.json new file mode 100644 index 00000000000..0cf33b16363 --- /dev/null +++ b/test/fixtures/policy/dependencies/dependencies-scopes-and-resources-policy.json @@ -0,0 +1,14 @@ +{ + "resources": { + "../multi-deps.js": { + "integrity": true, + "cascade": true + } + }, + "scopes": { + "../": { + "integrity": true, + "dependencies": true + } + } +} diff --git a/test/fixtures/policy/multi-deps.js b/test/fixtures/policy/multi-deps.js new file mode 100644 index 00000000000..51cdf617839 --- /dev/null +++ b/test/fixtures/policy/multi-deps.js @@ -0,0 +1,3 @@ +'use strict'; +require('fs'); +require('process'); diff --git a/test/parallel/test-policy-scopes.js b/test/parallel/test-policy-scopes.js index 129287c73c7..43789713cc9 100644 --- a/test/parallel/test-policy-scopes.js +++ b/test/parallel/test-policy-scopes.js @@ -10,8 +10,8 @@ const fixtures = require('../common/fixtures'); const assert = require('assert'); const { spawnSync } = require('child_process'); -const dep = fixtures.path('policy', 'main.mjs'); { + const dep = fixtures.path('policy', 'main.mjs'); const depPolicy = fixtures.path( 'policy', 'dependencies', @@ -24,3 +24,17 @@ const dep = fixtures.path('policy', 'main.mjs'); ); assert.strictEqual(status, 0); } +{ + const dep = fixtures.path('policy', 'multi-deps.js'); + const depPolicy = fixtures.path( + 'policy', + 'dependencies', + 'dependencies-scopes-and-resources-policy.json'); + const { status } = spawnSync( + process.execPath, + [ + '--experimental-policy', depPolicy, dep, + ] + ); + assert.strictEqual(status, 0); +} |