Skip to content

Commit c5eb8a5

Browse files
authored
Merge pull request #6409 from Shopify/09-17-attempt_at_fixing_loader_flaky_tests
Attempt at fixing loader flaky tests
2 parents bc73a26 + c76626c commit c5eb8a5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/app/src/cli/models/app/loader.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@ import {zod} from '@shopify/cli-kit/node/schema'
3939
import colors from '@shopify/cli-kit/node/colors'
4040
import {showMultipleCLIWarningIfNeeded} from '@shopify/cli-kit/node/multiple-installation-warning'
4141
import {AbortError} from '@shopify/cli-kit/node/error'
42+
import {captureOutput} from '@shopify/cli-kit/node/system'
4243

4344
vi.mock('../../services/local-storage.js')
45+
// Mock captureOutput to prevent executing `npm prefix` inside getPackageManager
46+
vi.mock('@shopify/cli-kit/node/system')
4447
vi.mock('../../services/app/config/use.js')
4548
vi.mock('@shopify/cli-kit/node/is-global')
4649
vi.mock('@shopify/cli-kit/node/node-package-manager', async () => ({
@@ -267,6 +270,7 @@ wrong = "property"
267270
test('defaults to npm as the package manager when the configuration is valid', async () => {
268271
// Given
269272
await writeConfig(appConfiguration)
273+
vi.mocked(captureOutput).mockResolvedValue(tmpDir)
270274

271275
// When
272276
const app = await loadTestingApp()
@@ -280,6 +284,7 @@ wrong = "property"
280284
await writeConfig(appConfiguration)
281285
const yarnLockPath = joinPath(tmpDir, yarnLockfile)
282286
await writeFile(yarnLockPath, '')
287+
vi.mocked(captureOutput).mockResolvedValue(tmpDir)
283288

284289
// When
285290
const app = await loadTestingApp()

0 commit comments

Comments
 (0)