From 3d74e50bfa4d0c29618f95f8cb49a295dd7b122c Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 24 Aug 2026 06:18:24 +0000 Subject: [PATCH] chore(lint): cover valid package.json paths in library-dependencies rule Adds filename-aware valid cases so checkPeerDependencies success paths are exercised, raising line coverage from 96.15% to 100% and branch coverage from 87.09% to 100%. No behavior change. Signed-off-by: Cursor Agent --- ...no-unexpected-library-dependencies.test.ts | 48 +++++++++++++++---- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/projects/lint/src/eslint/rules/no-unexpected-library-dependencies.test.ts b/projects/lint/src/eslint/rules/no-unexpected-library-dependencies.test.ts index 54136434dd..1b3a3ccd10 100644 --- a/projects/lint/src/eslint/rules/no-unexpected-library-dependencies.test.ts +++ b/projects/lint/src/eslint/rules/no-unexpected-library-dependencies.test.ts @@ -36,7 +36,18 @@ describe('noUnexpectedLibraryDependencies', () => { it('should allow owned dependencies', () => { tester.run('should allow owned dependencies', rule, { - valid: [`{ "name": "@nvidia-elements/core" }`, `{ "name": "@nvidia-elements/lint" }`], + valid: [ + { filename: 'package.json', code: `{ "name": "@nvidia-elements/core" }` }, + { filename: 'package.json', code: `{ "name": "@nvidia-elements/lint" }` }, + { + filename: 'package.json', + code: `{ "name": "@nvidia-elements/core", "exports": ["./index.js"] }` + }, + { + filename: 'README.md', + code: `{ "exports": ["./index.js"], "dependencies": { "@nvidia-elements/core": "0.0.0" } }` + } + ], invalid: [] }); }); @@ -44,10 +55,22 @@ describe('noUnexpectedLibraryDependencies', () => { it('should allow application dependencies', () => { tester.run('should allow application dependencies', rule, { valid: [ - `{ "dependencies": { "@nvidia-elements/core": "0.0.0" } }`, - `{ "name": "my-app", "dependencies": { "@nvidia-elements/core": "0.0.0" } }`, - `{ "name": "my-app", "dependencies": { "@nvidia-elements/core": "workspace:*" } }`, - `{ "name": "my-app", "dependencies": { "@nvidia-elements/core": "catalog:" } }` + { + filename: 'package.json', + code: `{ "dependencies": { "@nvidia-elements/core": "0.0.0" } }` + }, + { + filename: 'package.json', + code: `{ "name": "my-app", "dependencies": { "@nvidia-elements/core": "0.0.0" } }` + }, + { + filename: 'package.json', + code: `{ "name": "my-app", "dependencies": { "@nvidia-elements/core": "workspace:*" } }` + }, + { + filename: 'package.json', + code: `{ "name": "my-app", "dependencies": { "@nvidia-elements/core": "catalog:" } }` + } ], invalid: [] }); @@ -56,9 +79,18 @@ describe('noUnexpectedLibraryDependencies', () => { it('should allow library peer dependencies', () => { tester.run('should allow library peer dependencies', rule, { valid: [ - `{ "name": "my-library", "exports": ["./index.js"], "peerDependencies": { "@nvidia-elements/core": "^0.0.0" } }`, - `{ "name": "my-library", "exports": ["./index.js"], "peerDependencies": { "@nvidia-elements/core": "workspace:*" } }`, - `{ "name": "my-library", "exports": ["./index.js"], "peerDependencies": { "@nvidia-elements/core": "catalog:" } }` + { + filename: 'package.json', + code: `{ "name": "my-library", "exports": ["./index.js"], "peerDependencies": { "@nvidia-elements/core": "^0.0.0" } }` + }, + { + filename: 'package.json', + code: `{ "name": "my-library", "exports": ["./index.js"], "peerDependencies": { "@nvidia-elements/core": "workspace:*" } }` + }, + { + filename: 'package.json', + code: `{ "name": "my-library", "exports": ["./index.js"], "peerDependencies": { "@nvidia-elements/core": "catalog:" } }` + } ], invalid: [] });