Skip to content

Commit 7d147e8

Browse files
committed
Add nested dirs to test
1 parent 5789c20 commit 7d147e8

File tree

3 files changed

+66
-3
lines changed

3 files changed

+66
-3
lines changed

componentDetection.test.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,18 @@ describe('normalizeDependencyGraphPaths with real output.json', () => {
198198
const dependencyGraphs = output.dependencyGraphs;
199199
// Use the same filePath as the action default (".")
200200
const normalized = ComponentDetection.normalizeDependencyGraphPaths(dependencyGraphs, 'test');
201-
// Root level manifests should not have leading slashes
201+
202+
// Should contain root level manifests without leading slashes
202203
expect(Object.keys(normalized)).toContain('package.json');
203204
expect(Object.keys(normalized)).toContain('package-lock.json');
204-
// All keys should now be relative to the repo root (cwd) and start with '/'
205+
206+
// Should contain nested manifests with relative paths (no leading slashes)
207+
expect(Object.keys(normalized)).toContain('nested/package.json');
208+
expect(Object.keys(normalized)).toContain('nested/package-lock.json');
209+
210+
// All keys should be relative paths without leading slashes
205211
for (const key of Object.keys(normalized)) {
206-
expect(key.startsWith('/')).toBe(true);
212+
expect(key.startsWith('/')).toBe(false); // No leading slashes
207213
expect(key).not.toMatch(/^\w:\\|^\/\/|^\.{1,2}\//); // Not windows absolute, not network, not relative
208214
}
209215
});

test/nested/package-lock.json

Lines changed: 45 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/nested/package.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "nested-test-package",
3+
"version": "1.0.0",
4+
"description": "A nested test package for component detection testing",
5+
"main": "index.js",
6+
"dependencies": {
7+
"lodash": "^4.17.21"
8+
},
9+
"devDependencies": {
10+
"jest": "^29.0.0"
11+
}
12+
}

0 commit comments

Comments
 (0)