Skip to content

Commit c76391c

Browse files
committed
Adds tests for global resolutions (relative paths)
1 parent f1a5cec commit c76391c

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

data/test-expectations.json

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,4 +308,71 @@
308308
"importer": "/path/to/project/not-a-workspace/",
309309
"expected": "test"
310310
}]
311+
}, {
312+
"manifest": {
313+
"__info": [
314+
"This file is automatically generated. Do not touch it, or risk",
315+
"your modifications being lost."
316+
],
317+
"dependencyTreeRoots": [{
318+
"name": "root",
319+
"reference": "workspace:."
320+
}],
321+
"enableTopLevelFallback": true,
322+
"ignorePatternData": null,
323+
"fallbackExclusionList": [],
324+
"fallbackPool": [],
325+
"packageRegistryData": [
326+
[null, [
327+
[null, {
328+
"packageLocation": "./",
329+
"packageDependencies": [
330+
["root", "workspace:."],
331+
["pad-left", "npm:2.1.0"]
332+
],
333+
"linkType": "SOFT"
334+
}]
335+
]],
336+
["my-project", [
337+
["workspace:.", {
338+
"packageLocation": "./",
339+
"packageDependencies": [
340+
["root", "workspace:."],
341+
["pad-left", "npm:2.1.0"]
342+
],
343+
"linkType": "SOFT"
344+
}]
345+
]],
346+
["pad-left", [
347+
["npm:2.1.0", {
348+
"packageLocation": "../yarn/global/cache/pad-left-npm-2.1.0-ffe13d2d40-10c0.zip/node_modules/pad-left/",
349+
"packageDependencies": [
350+
["pad-left", "npm:2.1.0"],
351+
["repeat-string", "npm:1.6.1"]
352+
],
353+
"linkType": "HARD"
354+
}]
355+
]],
356+
["repeat-string", [
357+
["npm:1.6.1", {
358+
"packageLocation": "../yarn/global/cache/repeat-string-npm-1.6.1-bc8e388655-10c0.zip/node_modules/repeat-string/",
359+
"packageDependencies": [
360+
["repeat-string", "npm:1.6.1"]
361+
],
362+
"linkType": "HARD"
363+
}]
364+
]]
365+
]
366+
},
367+
"tests": [{
368+
"it": "should resolve global packages",
369+
"imported": "pad-left",
370+
"importer": "/path/to/project/",
371+
"expected": "/path/to/yarn/global/cache/pad-left-npm-2.1.0-ffe13d2d40-10c0.zip/node_modules/pad-left/"
372+
}, {
373+
"it": "should resolve global packages from third-party dependencies",
374+
"imported": "repeat-string",
375+
"importer": "/path/to/yarn/global/cache/pad-left-npm-2.1.0-ffe13d2d40-10c0.zip/node_modules/pad-left/",
376+
"expected": "/path/to/yarn/global/cache/repeat-string-npm-1.6.1-bc8e388655-10c0.zip/node_modules/repeat-string/"
377+
}]
311378
}]

src/lib_tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ mod tests {
150150
}
151151
}
152152

153+
153154
#[test]
154155
fn test_parse_single_package_name() {
155156
let parsed = parse_bare_identifier("pkg");

0 commit comments

Comments
 (0)