Repository navigation
test: remove manual Sinon restores - #3298
Merged
Merged
Conversation
tests/setup.ts runs `sinon.restore()` after every test, so: - Remove the `afterEach` hooks in `ClearcutSender.test.ts` and `DevToolsCommentBridge.test.ts` that restored stubs and fake timers created on the default sandbox. - In `ToolHandler.test.ts` and `input.test.ts`, restore only the stub that has to be reset in the middle of the test instead of calling `sinon.restore()`. - Rename `TestServer.restore()` to `reset()`. It clears the registered routes, and a `restore()` call in `afterEach` reads like a Sinon restore. This matches the DevTools `no-manual-sinon-restore` ESLint rule. The rule would still need to exempt tests/setup.ts.
OrKoN
approved these changes
Oct 22, 2026
MankhongGarden
pushed a commit
to MankhongGarden/chrome-devtools-mcp
that referenced
this pull request
Oct 22, 2026
Stacked on ChromeDevTools#3298. `assert.equal` from `node:assert` compares with `==`, so for example `assert.equal(1, '1')` passes. Replaces its 153 uses in 13 test files with `assert.strictEqual`. Three of the files import `node:assert/strict`, where the two are the same; the rename keeps the files consistent. No test relied on the loose comparison. This matches the DevTools [`no-assert-equal`](https://source.chromium.org/chromium/chromium/src/+/main:third_party/devtools-frontend/src/scripts/eslint_rules/lib/no-assert-equal.ts) ESLint rule. Its autofix is not used because it rewrites comparisons against object and array literals to `assert.deepEqual`, which is also loose in `node:assert`. ## User-visible changes None. Tests only. ## Testing - `npm run format` - `npm run test`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #3297.
tests/setup.tsrunssinon.restore()after every test, so:afterEachhooks inClearcutSender.test.tsandDevToolsCommentBridge.test.tsthat restored stubs and fake timers created on the default sandbox.ToolHandler.test.tsandinput.test.ts, restores only the stub that has to be reset in the middle of the test instead of callingsinon.restore().TestServer.restore()toreset(), including the caller inscripts/eval_gemini.ts. It clears the registered routes, and arestore()call inafterEachreads like a Sinon restore.This matches the DevTools
no-manual-sinon-restoreESLint rule. When the rule is added, it needs to exempttests/setup.ts, as DevTools does for its own test harness setup files.User-visible changes
None. Tests and the eval script only.
Testing
npm run formatnpm run test