MCPcopy Create free account
hub / github.com/npm/cli / node

Function node

workspaces/arborist/test/script-allowed.js:9–25  ·  view source on GitHub ↗
(overrides = {})

Source from the content-addressed store, hash-verified

7// simulate manifest confusion (mismatched URL) can override `resolved`
8// independently.
9const node = (overrides = {}) => {
10 const name = overrides.name ?? overrides.packageName ?? 'pkg'
11 const packageName = overrides.packageName ?? name
12 const version = overrides.version ?? '1.0.0'
13 // For real aliased installs, the URL is the TARGET package's URL, so
14 // build the default URL from packageName, not name.
15 const urlPkg = packageName
16 return {
17 name,
18 packageName,
19 version,
20 resolved: overrides.resolved
21 ?? `https://registry.npmjs.org/${urlPkg}/-/${urlPkg}-${version}.tgz`,
22 location: overrides.location ?? `node_modules/${name}`,
23 ...overrides,
24 }
25}
26
27t.test('returns null when no policy is set', t => {
28 t.equal(isScriptAllowed(node(), null), null)

Callers 1

script-allowed.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected