From 7973e7cea16b707f432eabbe7cbdcd9176fa2ecd Mon Sep 17 00:00:00 2001 From: Alex Rudenko Date: Wed, 18 Feb 2026 16:06:00 +0100 Subject: [PATCH] test: fix missing sinon.restore --- tests/DevtoolsUtils.test.ts | 6 +++++- tests/McpContext.test.ts | 6 +++++- tests/PageCollector.test.ts | 6 +++++- tests/formatters/IssueFormatter.test.ts | 2 +- tests/tools/extensions.test.ts | 6 +++++- tests/tools/pages.test.ts | 6 +++++- 6 files changed, 26 insertions(+), 6 deletions(-) diff --git a/tests/DevtoolsUtils.test.ts b/tests/DevtoolsUtils.test.ts index a6f5d113c..a5e43009c 100644 --- a/tests/DevtoolsUtils.test.ts +++ b/tests/DevtoolsUtils.test.ts @@ -5,7 +5,7 @@ */ import assert from 'node:assert'; -import {describe, it} from 'node:test'; +import {afterEach, describe, it} from 'node:test'; import sinon from 'sinon'; @@ -95,6 +95,10 @@ describe('urlsEqual', () => { }); describe('UniverseManager', () => { + afterEach(() => { + sinon.restore(); + }); + it('calls the factory for existing pages', async () => { const browser = getMockBrowser(); const factory = sinon.stub().resolves({}); diff --git a/tests/McpContext.test.ts b/tests/McpContext.test.ts index e3683152d..3783f55f6 100644 --- a/tests/McpContext.test.ts +++ b/tests/McpContext.test.ts @@ -5,7 +5,7 @@ */ import assert from 'node:assert'; -import {describe, it} from 'node:test'; +import {afterEach, describe, it} from 'node:test'; import sinon from 'sinon'; @@ -16,6 +16,10 @@ import type {TraceResult} from '../src/trace-processing/parse.js'; import {getMockRequest, html, withMcpContext} from './utils.js'; describe('McpContext', () => { + afterEach(() => { + sinon.restore(); + }); + it('list pages', async () => { await withMcpContext(async (_response, context) => { const page = context.getSelectedPage(); diff --git a/tests/PageCollector.test.ts b/tests/PageCollector.test.ts index 48e60cf36..6a8155fcc 100644 --- a/tests/PageCollector.test.ts +++ b/tests/PageCollector.test.ts @@ -5,7 +5,7 @@ */ import assert from 'node:assert'; -import {beforeEach, describe, it} from 'node:test'; +import {afterEach, beforeEach, describe, it} from 'node:test'; import type {Frame, HTTPRequest, Target, Protocol} from 'puppeteer-core'; import sinon from 'sinon'; @@ -302,6 +302,10 @@ describe('ConsoleCollector', () => { }; }); + afterEach(() => { + sinon.restore(); + }); + it('emits issues on page', async () => { const browser = getMockBrowser(); const page = (await browser.pages())[0]; diff --git a/tests/formatters/IssueFormatter.test.ts b/tests/formatters/IssueFormatter.test.ts index c46fbb6fa..de1764857 100644 --- a/tests/formatters/IssueFormatter.test.ts +++ b/tests/formatters/IssueFormatter.test.ts @@ -21,7 +21,7 @@ describe('IssueFormatter', () => { }); afterEach(() => { - getIssueDescriptionStub.restore(); + sinon.restore(); }); it('formats an issue message', t => { diff --git a/tests/tools/extensions.test.ts b/tests/tools/extensions.test.ts index 65f645ab4..c8bbce683 100644 --- a/tests/tools/extensions.test.ts +++ b/tests/tools/extensions.test.ts @@ -6,7 +6,7 @@ import assert from 'node:assert'; import path from 'node:path'; -import {describe, it} from 'node:test'; +import {afterEach, describe, it} from 'node:test'; import sinon from 'sinon'; @@ -34,6 +34,10 @@ function extractId(response: McpResponse) { } describe('extension', () => { + afterEach(() => { + sinon.restore(); + }); + it('installs and uninstalls an extension and verifies it in chrome://extensions', async () => { await withMcpContext(async (response, context) => { // Install the extension diff --git a/tests/tools/pages.test.ts b/tests/tools/pages.test.ts index 2d4110f8b..cf75af222 100644 --- a/tests/tools/pages.test.ts +++ b/tests/tools/pages.test.ts @@ -5,7 +5,7 @@ */ import assert from 'node:assert'; -import {describe, it} from 'node:test'; +import {afterEach, describe, it} from 'node:test'; import type {Dialog} from 'puppeteer-core'; import sinon from 'sinon'; @@ -23,6 +23,10 @@ import { import {html, withMcpContext} from '../utils.js'; describe('pages', () => { + afterEach(() => { + sinon.restore(); + }); + describe('list_pages', () => { it('list pages', async () => { await withMcpContext(async (response, context) => {