[Tests] Refactor replay tests to use real filesystem#7431
[Tests] Refactor replay tests to use real filesystem#7431gonzaloriestra wants to merge 1 commit intomainfrom
Conversation
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Refactored replay.test.ts to use inTemporaryDirectory and real filesystem operations instead of mocks. Eliminated shared state by replacing beforeAll with a setup helper. Made-with: Cursor
25815d2 to
76bc6f1
Compare
WHY are these changes introduced?
packages/app/src/cli/services/function/replay.test.tsmocked the filesystem (vi.mock('fs')andvi.mock('@shopify/cli-kit/node/fs')) and shared mutable state across tests viabeforeAll. Filesystem mocks drift from the real implementation, and shared state makes tests order-dependent and harder to reason about. The CLI testing strategy prefers real files in temporary directories with isolated state per test.WHAT is this pull request doing?
fsand@shopify/cli-kit/node/fsmocks.runTesthelper that usesinTemporaryDirectoryto give every test its own isolated workspace, function extension, and logs directory.beforeAllsetup with the per-test helper, eliminating shared mutable state.How to test your changes?
CI
Checklist
patchfor bug fixes ·minorfor new features ·majorfor breaking changes) and added a changeset withpnpm changeset add