Skip to content

Reject automatic filesystem mocks in tests - #8866

Draft
dmerand wants to merge 4 commits into
mainfrom
donald/lint-fs-automocks-20261011
Draft

dmerand wants to merge 4 commits into
mainfrom
donald/lint-fs-automocks-20261011

Conversation

@dmerand

@dmerand dmerand commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

Automatic filesystem mocks hide file and directory behavior. Filesystem tests must use real temporary files so they can detect incorrect I/O.

WHAT is this pull request doing?

Enable @shopify/cli/no-filesystem-auto-mocks as an error and replace the seven existing automatic filesystem mocks with temporary files or call-observation spies on real implementations. Dev-session tests also wait for event processing to finish before they check results.

The rule covers automatic mocks only. Factory and partial mocks remain outside its scope. It also adds a rule pointer to the filesystem section of the testing guide.

No changeset is needed: this changes internal lint tooling and tests, not CLI behavior.

How to manually test your changes?

In any test file, add vi.mock('@shopify/cli-kit/node/fs') and run ESLint on that file. The rule reports the automatic mock. A factory mock, such as vi.mock('@shopify/cli-kit/node/fs', async () => ({...})), is not reported.

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've considered analytics changes to measure impact
  • The change is user-facing — I've identified the correct bump type (patch for bug fixes · minor for new features · major for breaking changes) and added a changeset with pnpm changeset add

@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 Oct 11, 2026

This branch has not been deployed

No deployments
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