-
Notifications
You must be signed in to change notification settings - Fork 1
fix(cli): handle pnpm build approvals #125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| /* SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. */ | ||
| /* SPDX-License-Identifier: Apache-2.0 */ | ||
|
|
||
| nve-select select[multiple] option { | ||
| pointer-events: none !important; | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -162,5 +162,68 @@ describe('internal/node', () => { | |||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(result).toEqual([]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| it('should ignore PATH entries that are not regular files', async () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| const { existsSync, statSync } = await import('node:fs'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| vi.mocked(existsSync).mockReturnValue(true); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| vi.mocked(statSync).mockReturnValue({ isFile: () => false } as ReturnType<typeof statSync>); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| const { findExecutablesOnPath } = await import('./node.js'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| const result = findExecutablesOnPath('nve', { envPath: '/a' }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(result).toEqual([]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| it('should expand the command with explicit PATHEXT extensions on win32', async () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| const { existsSync, statSync, realpathSync } = await import('node:fs'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| vi.mocked(existsSync).mockReturnValue(true); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| vi.mocked(statSync).mockReturnValue({ isFile: () => true } as ReturnType<typeof statSync>); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| vi.mocked(realpathSync).mockImplementation(path => path.toString()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| const { findExecutablesOnPath } = await import('./node.js'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| const result = findExecutablesOnPath('nve', { envPath: 'C:/bin', platform: 'win32', pathExt: '.EXE;.CMD' }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(result.some(commandPath => commandPath.toLowerCase().endsWith('nve.exe'))).toBe(true); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(result.some(commandPath => commandPath.toLowerCase().endsWith('nve.cmd'))).toBe(true); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| it('should fall back to the PATHEXT environment variable on win32', async () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| const { existsSync, statSync, realpathSync } = await import('node:fs'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| vi.mocked(existsSync).mockReturnValue(true); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| vi.mocked(statSync).mockReturnValue({ isFile: () => true } as ReturnType<typeof statSync>); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| vi.mocked(realpathSync).mockImplementation(path => path.toString()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| vi.stubEnv('PATHEXT', '.BAT'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| const { findExecutablesOnPath } = await import('./node.js'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| const result = findExecutablesOnPath('nve', { envPath: 'C:/bin', platform: 'win32' }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(result.some(commandPath => commandPath.toLowerCase().endsWith('nve.bat'))).toBe(true); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| vi.unstubAllEnvs(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| it('should treat any matching file as executable on win32 without an access check', async () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| const { accessSync, existsSync, statSync, realpathSync } = await import('node:fs'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| vi.mocked(existsSync).mockReturnValue(true); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| vi.mocked(statSync).mockReturnValue({ isFile: () => true } as ReturnType<typeof statSync>); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| vi.mocked(realpathSync).mockImplementation(path => path.toString()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| const { findExecutablesOnPath } = await import('./node.js'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| const result = findExecutablesOnPath('nve', { envPath: 'C:/bin', platform: 'win32', pathExt: '.EXE' }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(result.length).toBeGreaterThan(0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(accessSync).not.toHaveBeenCalled(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| it('should default to process PATH and platform when options are omitted', async () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| const { existsSync } = await import('node:fs'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| vi.mocked(existsSync).mockReturnValue(false); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| vi.stubEnv('PATH', '/usr/bin:/bin'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| const { findExecutablesOnPath } = await import('./node.js'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| const result = findExecutablesOnPath('definitely-not-a-real-command'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(result).toEqual([]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| vi.unstubAllEnvs(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+217
to
+227
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider moving environment cleanup to ensure it always executes. The inline 🧪 Recommended pattern for guaranteed cleanupUse a it('should default to process PATH and platform when options are omitted', async () => {
const { existsSync } = await import('node:fs');
vi.mocked(existsSync).mockReturnValue(false);
vi.stubEnv('PATH', '/usr/bin:/bin');
- const { findExecutablesOnPath } = await import('./node.js');
- const result = findExecutablesOnPath('definitely-not-a-real-command');
-
- expect(result).toEqual([]);
- vi.unstubAllEnvs();
+ try {
+ const { findExecutablesOnPath } = await import('./node.js');
+ const result = findExecutablesOnPath('definitely-not-a-real-command');
+
+ expect(result).toEqual([]);
+ } finally {
+ vi.unstubAllEnvs();
+ }
});📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider moving environment cleanup to ensure it always executes.
The inline
vi.unstubAllEnvs()call at line 201 won't execute if the assertion at line 200 fails, potentially leaving environment pollution for subsequent tests.🧪 Recommended pattern for guaranteed cleanup
Move the cleanup to a
try-finallyblock or use Vitest'safterEach:Option 1: try-finally pattern
it('should fall back to the PATHEXT environment variable on win32', async () => { const { existsSync, statSync, realpathSync } = await import('node:fs'); vi.mocked(existsSync).mockReturnValue(true); vi.mocked(statSync).mockReturnValue({ isFile: () => true } as ReturnType<typeof statSync>); vi.mocked(realpathSync).mockImplementation(path => path.toString()); vi.stubEnv('PATHEXT', '.BAT'); - const { findExecutablesOnPath } = await import('./node.js'); - const result = findExecutablesOnPath('nve', { envPath: 'C:/bin', platform: 'win32' }); - - expect(result.some(commandPath => commandPath.toLowerCase().endsWith('nve.bat'))).toBe(true); - vi.unstubAllEnvs(); + try { + const { findExecutablesOnPath } = await import('./node.js'); + const result = findExecutablesOnPath('nve', { envPath: 'C:/bin', platform: 'win32' }); + + expect(result.some(commandPath => commandPath.toLowerCase().endsWith('nve.bat'))).toBe(true); + } finally { + vi.unstubAllEnvs(); + } });Option 2: Scoped afterEach (if multiple tests need the same cleanup)
📝 Committable suggestion
🤖 Prompt for AI Agents