[Tests] Remove filesystem mocks in docs generate.test.ts#7737
[Tests] Remove filesystem mocks in docs generate.test.ts#7737gonzaloriestra wants to merge 2 commits into
Conversation
Refactored `packages/cli/src/cli/commands/docs/generate.test.ts` to avoid mocking the filesystem, using `inTemporaryDirectory` and `readFile` instead. Updated `packages/cli/src/cli/commands/docs/generate.ts` to use a dynamic `docsPath()` function to support `cwd()` mocking in tests. Improved path construction using `joinPath`.
|
👋 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. |
- Fixed flaky stream tests in `packages/cli-kit/src/public/node/fs.test.ts` by wrapping them in Promises. - Refactored `packages/cli/src/cli/commands/docs/generate.ts` to use a dynamic `docsPath()` function, enabling `cwd()` mocking. - Refactored `packages/cli/src/cli/commands/docs/generate.test.ts` to use `inTemporaryDirectory` and real filesystem operations instead of mocking `fs`. - Improved path construction in `generate.ts` using `joinPath`.
WHY are these changes introduced?
Following the project's testing guidelines to avoid mocking the filesystem. This ensures tests are more reliable and test actual behavior on disk.
WHAT is this pull request doing?
packages/cli/src/cli/commands/docs/generate.test.tsto remove the@shopify/cli-kit/node/fsmock.inTemporaryDirectoryand verify file contents usingreadFile.packages/cli/src/cli/commands/docs/generate.tsto use a dynamicdocsPath()function, enabling runtime mocking ofcwd().generate.tsby usingjoinPathinstead of string interpolation.How to test your changes?
CI
Checklist
patchfor bug fixes ·minorfor new features ·majorfor breaking changes) and added a changeset withpnpm changeset addPR created automatically by Jules for task 5765245998093498961 started by @gonzaloriestra