[Tests] Replace mocks with behavior-based testing in fs.test.ts#7497
[Tests] Replace mocks with behavior-based testing in fs.test.ts#7497gonzaloriestra merged 2 commits intomainfrom
Conversation
Refactored `packages/cli-kit/src/public/node/fs.test.ts` to remove brittle implementation-focused mocks and replace them with robust, behavior-based tests using real temporary directories. - Removed global mocks for `fast-glob`, `os`, and `array`. - Refactored `glob` tests to verify actual file discovery. - Refactored `generateRandomNameForSubdirectory` reroll logic tests using `vi.spyOn`. - Simplified `detectEOL` assertions. - Removed redundant `vi.doMock` for `fast-glob`.
|
👋 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. |
byrichardpowell
left a comment
There was a problem hiding this comment.
Approving with 1 comment. That way you don't need a second review.
Totally open to the idea the comment I left is not worth addressing.
WHY are these changes introduced?
The current test suite in
packages/cli-kit/src/public/node/fs.test.tsrelies heavily on mocking internal libraries likefast-globandos, which leads to tests that assert on implementation details (e.g., "was this function called with these arguments") rather than actual behavior (e.g., "did the function find the correct files").WHAT is this pull request doing?
fast-glob,os, andarrayinpackages/cli-kit/src/public/node/fs.test.ts.globtests to create real files in a temporary directory and verify the results.generateRandomNameForSubdirectorytests to usevi.spyOnfor targeted mocking of the reroll logic.detectEOLtests to use realos.EOLvalues.vi.doMockcalls.How to test your changes?
CI
Checklist
PR created automatically by Jules for task 4717222672129663433 started by @gonzaloriestra