mirror of
https://github.com/ChromeDevTools/chrome-devtools-mcp.git
synced 2026-11-04 15:00:11 +00:00
`tests/setup.ts` now registers a root-level `afterEach` hook that calls `sinon.restore()`. Node's test runner inherits `afterEach` hooks in every nested test, so one hook restores all Sinon fakes after each test in every file. Changes: - Remove `afterEach(() => sinon.restore())` and the `sinon.restore()` statement inside multi-statement hooks from 46 test files. Remove `sinon` and `afterEach` imports that became unused. - Add the ESLint rule `@local/no-sinon-restore-in-hooks` (`scripts/eslint_rules/no-sinon-restore-in-hooks-rule.js`), enabled for `**/*.test.ts`. It reports `sinon.restore()` inside `before`, `beforeEach`, `after`, and `afterEach`. The autofix removes the statement, or the whole hook when `sinon.restore()` is its only statement. `sinon.restore()` inside a test body is still allowed (two tests restore mid-test on purpose). - Update the "Clean up stubs" rule in `AGENTS.md`. Verification: `npm run format` is clean and `npm run test` passes locally.