-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5017 from Shopify/fix-not-found-in-check-command-…
…safety-stable [stable] Fix dev for Ruby apps
- Loading branch information
Showing
3 changed files
with
49 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@shopify/cli-kit': patch | ||
--- | ||
|
||
Fix dev for Ruby apps by avoiding the command safety check to raise an error when not found |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import * as system from './system.js' | ||
import {execa} from 'execa' | ||
import {describe, expect, test, vi} from 'vitest' | ||
import which from 'which' | ||
|
||
vi.mock('which') | ||
vi.mock('execa') | ||
|
||
describe('captureOutput', () => { | ||
test('runs the command when it is not found in the current directory', async () => { | ||
// Given | ||
vi.mocked(which.sync).mockReturnValueOnce('/system/command') | ||
vi.mocked(execa).mockResolvedValueOnce({stdout: undefined} as any) | ||
|
||
// When | ||
const got = await system.captureOutput('command', [], {cwd: '/currentDirectory'}) | ||
|
||
// Then | ||
expect(got).toEqual(undefined) | ||
}) | ||
|
||
test('raises an error if the command to run is found in the current directory', async () => { | ||
// Given | ||
vi.mocked(which.sync).mockReturnValueOnce('/currentDirectory/command') | ||
|
||
// When | ||
const got = system.captureOutput('command', [], {cwd: '/currentDirectory'}) | ||
|
||
// Then | ||
await expect(got).rejects.toThrowError('Skipped run of unsecure binary command found in the current directory.') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters