Skip to content

Commit a027230

Browse files
committed
chore: attempt at test for extraneous dependancies
1 parent 09ad624 commit a027230

File tree

5 files changed

+97
-0
lines changed

5 files changed

+97
-0
lines changed

workspaces/arborist/test/arborist/build-ideal-tree.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4091,3 +4091,15 @@ t.test('should take devEngines in account', async t => {
40914091
const tree = await buildIdeal(path)
40924092
t.matchSnapshot(String(tree.meta))
40934093
})
4094+
4095+
t.test(
4096+
'extraneous dependency not buildable on current platform does not throw',
4097+
async (t) => {
4098+
const path = resolve(fixtures, 'extraneous-platform')
4099+
createRegistry(t, true)
4100+
const tree = await buildIdeal(path, { prune: false })
4101+
console.log(tree)
4102+
4103+
// t.equal(tree.children.get('platform-specifying-test-package').package.version, '1.0.0', 'added the optional dep to the ideal tree')
4104+
}
4105+
)

workspaces/arborist/test/fixtures/extraneous-platform/package-lock.json

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "extraneous-platform-test",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"author": "",
10+
"license": "ISC",
11+
"dependencies": {
12+
"shrinkwrapped-package-with-optional-platform-dependancies": "^1.0.0"
13+
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "dependency-with-optional-platform-dependancies",
3+
"dist-tags": {
4+
"latest": "1.0.0"
5+
},
6+
"versions": {
7+
"1.0.0": {
8+
"name": "dependency-with-optional-platform-dependancies",
9+
"version": "0.1.0",
10+
"optionalDependencies": {
11+
"platform-specifying-test-package": "^1.0.0"
12+
},
13+
"dist": {
14+
"shasum": "977166c896cbeaa1b56e593096244ff184adafb0",
15+
"tarball": "https://registry.npmjs.org/shrinkwrapped-package-with-optional-platform-dependancies/-/shrinkwrapped-package-with-optional-platform-dependancies-0.1.0.tgz"
16+
}
17+
}
18+
},
19+
"modified": "2025-05-22T00:25:09.206Z"
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "shrinkwrapped-package-with-optional-platform-dependancies",
3+
"dist-tags": {
4+
"latest": "1.0.0"
5+
},
6+
"versions": {
7+
"1.0.0": {
8+
"name": "shrinkwrapped-package-with-optional-platform-dependancies",
9+
"version": "0.1.0",
10+
"devDependencies": {
11+
"dependency-with-optional-platform-dependancies": "^1.0.0"
12+
}
13+
}
14+
},
15+
"modified": "2025-05-22T00:25:09.206Z"
16+
}

0 commit comments

Comments
 (0)