Skip to content

Chrome DevTools for coding agents

test: use assert.strictEqual for equality checks (#3300)

Nikolay Vitkov3da5985b34b9
diff --git a/tests/McpResponse.test.ts b/tests/McpResponse.test.ts
index d234f389..d4299278 100644
--- a/tests/McpResponse.test.ts
+++ b/tests/McpResponse.test.ts
@@ -1692,8 +1692,8 @@ describe('McpResponse heap snapshot formatting', () => {
const largeIndex = text.indexOf('LargeNode');
const mediumIndex = text.indexOf('MediumNode');
- assert.ok(largeIndex !== -1, 'LargeNode should be present');
- assert.ok(mediumIndex !== -1, 'MediumNode should be present');
+ assert.notStrictEqual(largeIndex, -1, 'LargeNode should be present');
+ assert.notStrictEqual(mediumIndex, -1, 'MediumNode should be present');
assert.ok(
largeIndex < mediumIndex,
'LargeNode should precede MediumNode due to descending retainedSize sorting',
diff --git a/tests/telemetry/ClearcutLogger.test.ts b/tests/telemetry/ClearcutLogger.test.ts
index 1f1cb5bf..115ce92f 100644
--- a/tests/telemetry/ClearcutLogger.test.ts
+++ b/tests/telemetry/ClearcutLogger.test.ts
@@ -260,7 +260,10 @@ describe('ClearcutLogger', () => {
const msg = mockWatchdogClient.send.firstCall.args[0];
assert.strictEqual(msg.type, WatchdogMessageType.LOG_EVENT);
assert.ok(msg.payload.daily_active);
- assert.ok(msg.payload.daily_active.days_since_last_active !== undefined);
+ assert.notStrictEqual(
+ msg.payload.daily_active.days_since_last_active,
+ undefined,
+ );
sinon.assert.called(mockPersistence.saveState);
});
diff --git a/tests/tools/pages.test.ts b/tests/tools/pages.test.ts
index 80259d18..90b276e6 100644
--- a/tests/tools/pages.test.ts
+++ b/tests/tools/pages.test.ts
@@ -1974,7 +1974,7 @@ describe('pages', () => {
await withMcpContext(async (response, context, args) => {
const page = context.getSelectedMcpPage().pptrPage;
// @ts-expect-error _tabId is internal.
- assert.ok(typeof page._tabId === 'string');
+ assert.strictEqual(typeof page._tabId, 'string');
// @ts-expect-error _tabId is internal.
page._tabId = 'test-tab-id';
await getTabId(args).handler(
diff --git a/tests/utils.ts b/tests/utils.ts
index 4bdf3351..55bc7ec7 100644
--- a/tests/utils.ts
+++ b/tests/utils.ts
@@ -54,7 +54,7 @@ export function assertNoServiceWorkerReported(
const target = targets.find(target => {
return target.url().includes(id) && target.type() === 'service_worker';
});
- assert(target === undefined);
+ assert.strictEqual(target, undefined);
}
export function getTextContent(
diff --git a/tests/utils/WaitForHelper.test.ts b/tests/utils/WaitForHelper.test.ts
index 1078a8e0..b0a9b7d4 100644
--- a/tests/utils/WaitForHelper.test.ts
+++ b/tests/utils/WaitForHelper.test.ts
@@ -81,10 +81,11 @@ describe('WaitForHelper', () => {
),
]);
- assert(
- result !== 'stalled',
- 'stalled because a dialog was shown; would time out with ProtocolError',
- );
+ if (result === 'stalled') {
+ assert.fail(
+ 'stalled because a dialog was shown; would time out with ProtocolError',
+ );
+ }
// The dialog was detected but not handled (no handleDialog was passed).
assert.strictEqual(result.dialogHandled, false);
// The dialog is still open and recorded, so the next blockedByDialog tool