Skip to content

[Tests] Remove filesystem mocks in bundle-size.test.ts#7548

Draft
gonzaloriestra wants to merge 1 commit into
mainfrom
remove-fs-mocks-bundle-size-6938643062223810454
Draft

[Tests] Remove filesystem mocks in bundle-size.test.ts#7548
gonzaloriestra wants to merge 1 commit into
mainfrom
remove-fs-mocks-bundle-size-6938643062223810454

Conversation

@gonzaloriestra
Copy link
Copy Markdown
Contributor

Description

This PR refactors packages/app/src/cli/services/build/bundle-size.test.ts to replace global filesystem mocks (vi.mock('@shopify/cli-kit/node/fs')) with real filesystem operations using inTemporaryDirectory and writeFile. This makes the tests more reliable and realistic by testing against the actual disk.

Changes

  • Removed vi.mock('@shopify/cli-kit/node/fs').
  • Wrapped test cases in inTemporaryDirectory.
  • Used writeFile to create test files on disk.
  • Updated assertions to use the actual file paths in the temporary directory.
  • Cleaned up unused imports (vi, readFile).

Duplicate check

  • Ran git log --grep="\[Tests\]" --oneline -n 100 and git log --grep="Jules" --oneline -n 100.
  • Closest prior PR: [Tests] Remove filesystem mocks in execute-bulk-operation.test.ts.
  • Why this is different: This PR targets a different service (bundle-size.test.ts) and addresses a different set of test cases related to bundle size calculation.

Verification

  • Ran pnpm --filter @shopify/app vitest run src/cli/services/build/bundle-size.test.ts (all passed).
  • Ran pnpm --filter @shopify/app lint (passed).
  • Ran pnpm knip --workspace packages/app (passed).
  • Ran pnpm --filter @shopify/app type-check (passed).
  • Ran pnpm --filter @shopify/app vitest run (all 2188 tests passed).

PR created automatically by Jules for task 6938643062223810454 started by @gonzaloriestra

Refactor bundle-size.test.ts to use real filesystem operations in temporary directories instead of mocking the fs module.
@google-labs-jules
Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@github-actions github-actions Bot added the no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. label May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant