Skip to content

Commit ebef25a

Browse files
bmeurerDevtools-frontend LUCI CQ
authored and
Devtools-frontend LUCI CQ
committed
[eslint] Prefer explicit assert.strictEqual / assert.notStrictEqual.
This yields much more actionable error messages than using generic assertions with strict equality/inequality operators. Also update the `prefer-assert-is-ok` rule to automatically fix negated conditions, simplifying `assert.isOk(!e)` to `assert.isNotOk(e)` which is easier on the eyes and more explicit. Bug: 397260638 Change-Id: I24f7863c1c02923574776f55efdf42423d5cd6a1 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6450700 Auto-Submit: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Nikolay Vitkov <nvitkov@chromium.org> Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
1 parent 3545c85 commit ebef25a

40 files changed

+689
-92
lines changed

eslint.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,7 @@ export default [
699699
'rulesdir/prefer-assert-instance-of': 'error',
700700
'rulesdir/prefer-assert-is-ok': 'error',
701701
'rulesdir/prefer-assert-length-of': 'error',
702+
'rulesdir/prefer-assert-strict-equal': 'error',
702703
'rulesdir/prefer-sinon-assert': 'error',
703704
'rulesdir/prefer-url-string': 'error',
704705
'rulesdir/trace-engine-test-timeouts': 'error',

front_end/core/platform/StringUtilities.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,9 @@ describe('StringUtilities', () => {
269269
const stringA = ' '.repeat(10000);
270270
const stringB = stringA + ' ';
271271
const hashA = Platform.StringUtilities.hashCode(stringA);
272-
assert.isTrue(hashA !== Platform.StringUtilities.hashCode(stringB));
272+
assert.notStrictEqual(hashA, Platform.StringUtilities.hashCode(stringB));
273273
assert.isTrue(isFinite(hashA));
274-
assert.isTrue(hashA + 1 !== hashA);
274+
assert.notStrictEqual(hashA + 1, hashA);
275275
});
276276
});
277277

front_end/core/sdk/NetworkManager.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -432,14 +432,14 @@ describeWithMockConnection('MultitargetNetworkManager', () => {
432432
{requestId, loaderId: '', request: {url: 'example.com'}} as Protocol.Network.RequestWillBeSentEvent);
433433

434434
const {request} = await requestPromise;
435-
assert.isOk(SDK.NetworkManager.NetworkManager.forRequest(request) === initialNetworkManager);
435+
assert.strictEqual(SDK.NetworkManager.NetworkManager.forRequest(request), initialNetworkManager);
436436
assert.isOk(multiTargetNetworkManager.inflightMainResourceRequests.has(requestId));
437437

438438
const workerNetworkManager = workerTarget.model(SDK.NetworkManager.NetworkManager)!;
439439
workerNetworkManager.dispatcher.loadingFinished({requestId} as Protocol.Network.LoadingFinishedEvent);
440440

441-
assert.isOk(SDK.NetworkManager.NetworkManager.forRequest(request) === workerNetworkManager);
442-
assert.isOk(!multiTargetNetworkManager.inflightMainResourceRequests.has(requestId));
441+
assert.strictEqual(SDK.NetworkManager.NetworkManager.forRequest(request), workerNetworkManager);
442+
assert.isNotOk(multiTargetNetworkManager.inflightMainResourceRequests.has(requestId));
443443
});
444444

445445
it('uses main frame to get certificate', () => {

front_end/core/sdk/OverlayPersistentHighlighter.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ describeWithEnvironment('OverlayPersistentHighlighter', () => {
113113
highlighter.hideFlexInOverlay(EXISTING_NODE_ID);
114114
assert.deepEqual(
115115
stubbedCallbacks.onFlexOverlayStateChanged.secondCall.args, [{nodeId: EXISTING_NODE_ID, enabled: false}]);
116-
assert(!highlighter.isFlexHighlighted(EXISTING_NODE_ID));
116+
assert.isNotOk(highlighter.isFlexHighlighted(EXISTING_NODE_ID));
117117
assertSavedSettingState([]);
118118
});
119119

@@ -131,7 +131,7 @@ describeWithEnvironment('OverlayPersistentHighlighter', () => {
131131
highlighter.hideGridInOverlay(EXISTING_NODE_ID);
132132
assert.deepEqual(
133133
stubbedCallbacks.onGridOverlayStateChanged.secondCall.args, [{nodeId: EXISTING_NODE_ID, enabled: false}]);
134-
assert(!highlighter.isGridHighlighted(EXISTING_NODE_ID));
134+
assert.isNotOk(highlighter.isGridHighlighted(EXISTING_NODE_ID));
135135
assertSavedSettingState([]);
136136
});
137137

@@ -147,7 +147,7 @@ describeWithEnvironment('OverlayPersistentHighlighter', () => {
147147
}]);
148148

149149
highlighter.hideScrollSnapInOverlay(EXISTING_NODE_ID);
150-
assert(!highlighter.isScrollSnapHighlighted(EXISTING_NODE_ID));
150+
assert.isNotOk(highlighter.isScrollSnapHighlighted(EXISTING_NODE_ID));
151151
assert.deepEqual(
152152
stubbedCallbacks.onScrollSnapOverlayStateChanged.secondCall.args, [{nodeId: EXISTING_NODE_ID, enabled: false}]);
153153
assertSavedSettingState([]);
@@ -166,7 +166,7 @@ describeWithEnvironment('OverlayPersistentHighlighter', () => {
166166
}]);
167167

168168
highlighter.hideContainerQueryInOverlay(EXISTING_NODE_ID);
169-
assert(!highlighter.isContainerQueryHighlighted(EXISTING_NODE_ID));
169+
assert.isNotOk(highlighter.isContainerQueryHighlighted(EXISTING_NODE_ID));
170170
assert.deepEqual(
171171
stubbedCallbacks.onContainerQueryOverlayStateChanged.secondCall.args,
172172
[{nodeId: EXISTING_NODE_ID, enabled: false}]);
@@ -183,7 +183,7 @@ describeWithEnvironment('OverlayPersistentHighlighter', () => {
183183
}]);
184184

185185
highlighter.hideIsolatedElementInOverlay(EXISTING_NODE_ID);
186-
assert(!highlighter.isIsolatedElementHighlighted(EXISTING_NODE_ID));
186+
assert.isNotOk(highlighter.isIsolatedElementHighlighted(EXISTING_NODE_ID));
187187
assertSavedSettingState([]);
188188
});
189189

front_end/core/sdk/StorageBucketsModel.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ describeWithMockConnection('StorageBucketsModel', () => {
159159
storageBucketsModel.enable();
160160

161161
await listener.waitForBucketEvents(BucketEvents.BUCKET_ADDED, bucketsForStorageKeyCount);
162-
assert.isTrue(listener.eventCount(BucketEvents.BUCKET_ADDED) === bucketsForStorageKeyCount);
162+
assert.strictEqual(listener.eventCount(BucketEvents.BUCKET_ADDED), bucketsForStorageKeyCount);
163163
assert.deepEqual(getBucketsForStorageKeys(...storageKeys), listener.bucketInfos(BucketEvents.BUCKET_ADDED));
164164
});
165165
});
@@ -178,7 +178,7 @@ describeWithMockConnection('StorageBucketsModel', () => {
178178

179179
storageKeyManager.updateStorageKeys(new Set([storageKey]));
180180
storageKeyManager.updateStorageKeys(new Set([]));
181-
assert.isTrue(setStorageBucketTrackingSpy.callCount === 2);
181+
sinon.assert.callCount(setStorageBucketTrackingSpy, 2);
182182
assert.isTrue(setStorageBucketTrackingSpy.secondCall.calledWithExactly({storageKey, enable: false}));
183183
});
184184

@@ -194,7 +194,7 @@ describeWithMockConnection('StorageBucketsModel', () => {
194194
const removedStorageKey = storageKeys.pop() as string;
195195
storageKeyManager.updateStorageKeys(new Set(storageKeys));
196196
await listener.waitForBucketEvents(BucketEvents.BUCKET_REMOVED, 2);
197-
assert.isTrue(listener.eventCount(BucketEvents.BUCKET_REMOVED) === 2);
197+
assert.strictEqual(listener.eventCount(BucketEvents.BUCKET_REMOVED), 2);
198198
assert.deepEqual(getBucketsForStorageKeys(removedStorageKey), listener.bucketInfos(BucketEvents.BUCKET_REMOVED));
199199
});
200200
});
@@ -220,13 +220,13 @@ describeWithMockConnection('StorageBucketsModel', () => {
220220
storageKeyManager.updateStorageKeys(new Set(storageKeys));
221221

222222
await listener.waitForBucketEvents(BucketEvents.BUCKET_ADDED, 3);
223-
assert.isTrue(listener.eventCount(BucketEvents.BUCKET_ADDED) === 3);
223+
assert.strictEqual(listener.eventCount(BucketEvents.BUCKET_ADDED), 3);
224224
const expectedBuckets = getBucketsForStorageKeys(...storageKeys);
225225
assert.deepEqual(expectedBuckets, listener.bucketInfos(BucketEvents.BUCKET_ADDED));
226226

227227
storageBucketsModel.storageBucketCreatedOrUpdated({bucketInfo: STORAGE_BUCKET_INFO_TO_CREATE});
228228
await listener.waitForBucketEvents(BucketEvents.BUCKET_ADDED, 4);
229-
assert.isTrue(listener.eventCount(BucketEvents.BUCKET_ADDED) === 4);
229+
assert.strictEqual(listener.eventCount(BucketEvents.BUCKET_ADDED), 4);
230230
expectedBuckets.push(STORAGE_BUCKET_INFO_TO_CREATE);
231231
assert.deepEqual(expectedBuckets, listener.bucketInfos(BucketEvents.BUCKET_ADDED));
232232
});
@@ -241,11 +241,11 @@ describeWithMockConnection('StorageBucketsModel', () => {
241241
storageKeyManager.updateStorageKeys(new Set(storageKeys));
242242

243243
await listener.waitForBucketEvents(BucketEvents.BUCKET_ADDED, 3);
244-
assert.isTrue(listener.eventCount(BucketEvents.BUCKET_CHANGED) === 0);
244+
assert.strictEqual(listener.eventCount(BucketEvents.BUCKET_CHANGED), 0);
245245

246246
storageBucketsModel.storageBucketCreatedOrUpdated({bucketInfo: STORAGE_BUCKET_INFO_UPDATED});
247247
await listener.waitForBucketEvents(BucketEvents.BUCKET_CHANGED, 1);
248-
assert.isTrue(listener.eventCount(BucketEvents.BUCKET_CHANGED) === 1);
248+
assert.strictEqual(listener.eventCount(BucketEvents.BUCKET_CHANGED), 1);
249249
assert.deepEqual(listener.bucketInfos(BucketEvents.BUCKET_CHANGED)[0], STORAGE_BUCKET_INFO_UPDATED);
250250
});
251251

@@ -259,11 +259,11 @@ describeWithMockConnection('StorageBucketsModel', () => {
259259
storageKeyManager.updateStorageKeys(new Set(storageKeys));
260260

261261
await listener.waitForBucketEvents(BucketEvents.BUCKET_ADDED, 3);
262-
assert.isTrue(listener.eventCount(BucketEvents.BUCKET_REMOVED) === 0);
262+
assert.strictEqual(listener.eventCount(BucketEvents.BUCKET_REMOVED), 0);
263263

264264
storageBucketsModel.storageBucketDeleted({bucketId: STORAGE_BUCKET_INFO_REMOVED.id});
265265
await listener.waitForBucketEvents(BucketEvents.BUCKET_REMOVED, 1);
266-
assert.isTrue(listener.eventCount(BucketEvents.BUCKET_REMOVED) === 1);
266+
assert.strictEqual(listener.eventCount(BucketEvents.BUCKET_REMOVED), 1);
267267
assert.deepEqual(listener.bucketInfos(BucketEvents.BUCKET_REMOVED)[0], STORAGE_BUCKET_INFO_REMOVED);
268268
});
269269
});

front_end/models/ai_assistance/agents/StylingAgent.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ STOP`,
758758
const actionSteps = result.filter(step => {
759759
return step.type === AiAssistance.ResponseType.ACTION;
760760
});
761-
assert(actionSteps.length === 1, 'Found non or multiple action steps');
761+
assert.lengthOf(actionSteps, 1, 'Found non or multiple action steps');
762762
const actionStep = actionSteps.at(0)!;
763763
assert(actionStep.output!.includes('Error: Output exceeded the maximum allowed length.'));
764764
});

front_end/models/breakpoints/BreakpointManager.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ describeWithMockConnection('BreakpointManager', () => {
465465
assert.isNull(breakpoint.getLastResolvedState());
466466
const result = await update;
467467
// Make sure that no error occurred.
468-
assert.isTrue(result === Breakpoints.BreakpointManager.DebuggerUpdateResult.OK);
468+
assert.strictEqual(result, Breakpoints.BreakpointManager.DebuggerUpdateResult.OK);
469469
assert.strictEqual(breakpoint.getLastResolvedState()?.[0].lineNumber, 13);
470470
await breakpoint.remove(false);
471471
Workspace.Workspace.WorkspaceImpl.instance().removeProject(project);

front_end/models/text_utils/TextRange.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ describe('TextRange', () => {
402402
it('can be stringified', () => {
403403
const textRange =
404404
TextUtils.TextRange.TextRange.fromObject({startLine: 1, startColumn: 2, endLine: 3, endColumn: 4});
405-
assert.isTrue(typeof textRange.toString() === 'string', 'toString should return a string');
405+
assert.strictEqual(typeof textRange.toString(), 'string', 'toString should return a string');
406406
});
407407

408408
describe('intersection', () => {

front_end/models/trace/insights/DocumentLatency.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describeWithEnvironment('DocumentLatency', function() {
2727
const insight =
2828
getInsightOrError('DocumentLatency', insights, getFirstOrError(data.Meta.navigationsByNavigationId.values()));
2929
assert.strictEqual(insight.data?.serverResponseTime, 43);
30-
assert(insight.data?.checklist.serverResponseIsFast.value === true);
30+
assert.isTrue(insight.data?.checklist.serverResponseIsFast.value);
3131
assert.deepEqual(insight.metricSavings, {FCP: 0, LCP: 0} as Trace.Insights.Types.MetricSavings);
3232
});
3333

@@ -56,7 +56,7 @@ describeWithEnvironment('DocumentLatency', function() {
5656
const context = createContextForNavigation(data, navigation, data.Meta.mainFrameId);
5757
const insight = Trace.Insights.Models.DocumentLatency.generateInsight(data, context);
5858
assert.strictEqual(insight.data?.serverResponseTime, 1043);
59-
assert(insight.data?.checklist.serverResponseIsFast.value === false);
59+
assert.isFalse(insight.data?.checklist.serverResponseIsFast.value);
6060
assert.deepEqual(insight.metricSavings, {FCP: 943, LCP: 943} as Trace.Insights.Types.MetricSavings);
6161
});
6262

@@ -101,7 +101,7 @@ describeWithEnvironment('DocumentLatency', function() {
101101
assert.strictEqual(insight.data?.redirectDuration, 6059);
102102
assert.strictEqual(insight.data?.uncompressedResponseBytes, 111506);
103103
assert.strictEqual(insight.data?.serverResponseTime, 2008);
104-
assert(insight.data?.checklist.serverResponseIsFast.value === false);
104+
assert.isFalse(insight.data?.checklist.serverResponseIsFast.value);
105105
assert.deepEqual(insight.metricSavings, {FCP: 7967, LCP: 7967} as Trace.Insights.Types.MetricSavings);
106106
});
107107
});

front_end/models/trace/lantern/metrics/FirstContentfulPaint.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ describe('Metrics: Lantern FCP', function() {
4141

4242
it('should handle negative request networkEndTime', async () => {
4343
const data = await getComputationDataFromFixture({trace});
44+
// eslint-disable-next-line rulesdir/prefer-assert-strict-equal
4445
assert(data.graph.type === 'network');
4546
data.graph.request.networkEndTime = -1;
4647
const result = FirstContentfulPaint.compute(data);

front_end/models/trace/lantern/simulation/ConnectionPool.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,13 @@ describe('ConnectionPool', () => {
187187
requests.forEach(request => pool.acquire(request));
188188

189189
assert.lengthOf(pool.connectionsInUse(), 6);
190-
assert.isOk(!pool.acquire(requests[6]), 'had connection that is in use');
190+
assert.isNotOk(pool.acquire(requests[6]), 'had connection that is in use');
191191

192192
pool.release(requests[0]);
193193
assert.lengthOf(pool.connectionsInUse(), 5);
194194

195195
assert.isOk(pool.acquire(requests[6]), 'could not reissue released connection');
196-
assert.isOk(!pool.acquire(requests[0]), 'had connection that is in use');
196+
assert.isNotOk(pool.acquire(requests[0]), 'had connection that is in use');
197197
});
198198
});
199199
});

front_end/panels/animation/AnimationTimeline.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ describeWithMockConnection('AnimationTimeline', () => {
314314
assert.isFalse(gridHeader.classList.contains('scrubber-enabled'));
315315
assert.isTrue(scrubber.classList.contains('hidden'));
316316
assert.isTrue(controlButton.disabled);
317-
assert.isTrue(currentTime.textContent === '');
317+
assert.strictEqual(currentTime.textContent, '');
318318
});
319319

320320
it('should mark the animation node as removed in the NodeUI', async () => {
@@ -379,7 +379,7 @@ describeWithMockConnection('AnimationTimeline', () => {
379379

380380
const currentTime = view.element.shadowRoot!.querySelector('.animation-timeline-current-time');
381381
assert.exists(currentTime);
382-
assert.isTrue(currentTime.textContent === '');
382+
assert.strictEqual(currentTime.textContent, '');
383383
});
384384
});
385385
});

front_end/panels/application/ReportingApiView.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ describeWithMockConnection('ReportingApiView', () => {
6262

6363
networkManager.dispatchEventToListeners(
6464
SDK.NetworkManager.Events.ReportingApiEndpointsChangedForOrigin, {origin: 'dummy', endpoints: []});
65-
assert.isTrue(view.showMode() === UI.SplitWidget.ShowMode.BOTH);
65+
assert.strictEqual(view.showMode(), UI.SplitWidget.ShowMode.BOTH);
6666
assert.isNotNull(view.mainWidget());
6767
assert.instanceOf(view.mainWidget(), Application.ReportingApiReportsView.ReportingApiReportsView);
6868
assert.isNotNull(view.sidebarElement());
@@ -94,7 +94,7 @@ describeWithMockConnection('ReportingApiView', () => {
9494
};
9595

9696
networkManager.dispatchEventToListeners(SDK.NetworkManager.Events.ReportingApiReportAdded, report);
97-
assert.isTrue(view.showMode() === UI.SplitWidget.ShowMode.BOTH);
97+
assert.strictEqual(view.showMode(), UI.SplitWidget.ShowMode.BOTH);
9898
assert.isNotNull(view.mainWidget());
9999
assert.instanceOf(view.mainWidget(), Application.ReportingApiReportsView.ReportingApiReportsView);
100100
assert.isNotNull(view.sidebarElement());

front_end/panels/application/preloading/PreloadingView.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class NavigationEmulator {
8686
this.seq++;
8787
this.loaderId = `loaderId:${this.seq}` as Protocol.Network.LoaderId;
8888

89-
assert.isFalse(url === this.prerenderTarget?.targetInfo()?.url);
89+
assert.notStrictEqual(url, this.prerenderTarget?.targetInfo()?.url);
9090

9191
dispatchEvent(this.primaryTarget, 'Page.frameNavigated', {
9292
frame: {
@@ -107,7 +107,7 @@ class NavigationEmulator {
107107
const url = 'https://example.com/' + path;
108108

109109
assert.exists(this.prerenderTarget);
110-
assert.isTrue(url === this.prerenderTarget.targetInfo()?.url);
110+
assert.strictEqual(url, this.prerenderTarget.targetInfo()?.url);
111111
assert.exists(this.prerenderStatusUpdatedEvent);
112112

113113
this.seq++;

front_end/panels/elements/StylePropertyTreeElement.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -509,8 +509,8 @@ describeWithMockConnection('StylePropertyTreeElement', () => {
509509
['display', 'inline'],
510510
]));
511511
stylePropertyTreeElement.updateAuthoringHint();
512-
assert(
513-
!stylePropertyTreeElement.listItemElement.classList.contains('inactive-property'),
512+
assert.isNotOk(
513+
stylePropertyTreeElement.listItemElement.classList.contains('inactive-property'),
514514
'CSS hint was rendered unexpectedly.');
515515
});
516516
});

front_end/panels/elements/components/LayoutPane.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ describeWithMockConnection('LayoutPane', () => {
177177
assert.instanceOf(summary, HTMLElement);
178178
assert(details.open, 'The first details were not expanded by default');
179179
summary.dispatchEvent(new KeyboardEvent('keydown', {bubbles: true, cancelable: true, key: 'ArrowLeft'}));
180-
assert(!details.open, 'The details were not collapsed after sending ArrowLeft');
180+
assert.isNotOk(details.open, 'The details were not collapsed after sending ArrowLeft');
181181
summary.dispatchEvent(new KeyboardEvent('keydown', {bubbles: true, cancelable: true, key: 'ArrowRight'}));
182182
assert(details.open, 'The details were not expanded after sending ArrowRight');
183183
});

front_end/panels/explain/PromptBuilder.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,23 @@ const {urlString} = Platform.DevToolsPath;
2727
describeWithLocale('PromptBuilder', () => {
2828
describe('allowHeader', () => {
2929
it('disallows cookie headers', () => {
30-
assert(!Explain.allowHeader({name: 'Cookie', value: ''}));
31-
assert(!Explain.allowHeader({name: 'cookiE', value: ''}));
32-
assert(!Explain.allowHeader({name: 'cookie', value: ''}));
33-
assert(!Explain.allowHeader({name: 'set-cookie', value: ''}));
34-
assert(!Explain.allowHeader({name: 'Set-cOokie', value: ''}));
30+
assert.isNotOk(Explain.allowHeader({name: 'Cookie', value: ''}));
31+
assert.isNotOk(Explain.allowHeader({name: 'cookiE', value: ''}));
32+
assert.isNotOk(Explain.allowHeader({name: 'cookie', value: ''}));
33+
assert.isNotOk(Explain.allowHeader({name: 'set-cookie', value: ''}));
34+
assert.isNotOk(Explain.allowHeader({name: 'Set-cOokie', value: ''}));
3535
});
3636

3737
it('disallows authorization headers', () => {
38-
assert(!Explain.allowHeader({name: 'AuthoRization', value: ''}));
39-
assert(!Explain.allowHeader({name: 'authorization', value: ''}));
38+
assert.isNotOk(Explain.allowHeader({name: 'AuthoRization', value: ''}));
39+
assert.isNotOk(Explain.allowHeader({name: 'authorization', value: ''}));
4040
});
4141

4242
it('disallows custom headers', () => {
43-
assert(!Explain.allowHeader({name: 'X-smth', value: ''}));
44-
assert(!Explain.allowHeader({name: 'X-', value: ''}));
45-
assert(!Explain.allowHeader({name: 'x-smth', value: ''}));
46-
assert(!Explain.allowHeader({name: 'x-', value: ''}));
43+
assert.isNotOk(Explain.allowHeader({name: 'X-smth', value: ''}));
44+
assert.isNotOk(Explain.allowHeader({name: 'X-', value: ''}));
45+
assert.isNotOk(Explain.allowHeader({name: 'x-smth', value: ''}));
46+
assert.isNotOk(Explain.allowHeader({name: 'x-', value: ''}));
4747
});
4848
});
4949

front_end/panels/linear_memory_inspector/components/LinearMemoryHighlightChipList.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describeWithLocale('LinearMemoryInspectorHighlightChipList', () => {
4848
it('focuses a highlight chip button', async () => {
4949
const chip = component.shadowRoot!.querySelector(HIGHLIGHT_CHIP);
5050
assert.instanceOf(chip, HTMLDivElement);
51-
assert.isTrue(!chip.classList.contains('focused'));
51+
assert.isNotOk(chip.classList.contains('focused'));
5252

5353
const highlightedMemory = {
5454
startAddress: 10,

front_end/panels/protocol_monitor/JSONEditor.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1315,7 +1315,7 @@ describeWithEnvironment('JSONEditor', () => {
13151315
it('filters the commands by substring match', async () => {
13161316
assert(ProtocolMonitor.JSONEditor.suggestionFilter('Test', 'Tes'));
13171317
assert(ProtocolMonitor.JSONEditor.suggestionFilter('Test', 'est'));
1318-
assert(!ProtocolMonitor.JSONEditor.suggestionFilter('Test', 'dest'));
1318+
assert.isNotOk(ProtocolMonitor.JSONEditor.suggestionFilter('Test', 'dest'));
13191319
});
13201320
});
13211321
});

front_end/panels/recorder/models/RecorderSettings.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ describeWithEnvironment('RecorderSettings', () => {
1717
});
1818

1919
it('should have correct default values', async () => {
20-
assert.isTrue(recorderSettings.selectorAttribute === '');
21-
assert.isTrue(
22-
recorderSettings.speed === Models.RecordingPlayer.PlayRecordingSpeed.NORMAL,
20+
assert.strictEqual(recorderSettings.selectorAttribute, '');
21+
assert.strictEqual(
22+
recorderSettings.speed,
23+
Models.RecordingPlayer.PlayRecordingSpeed.NORMAL,
2324
);
2425
Object.values(Models.Schema.SelectorType).forEach(type => {
2526
assert.isTrue(recorderSettings.getSelectorByType(type));

front_end/panels/recorder/models/RecordingPlayer.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ describe('RecordingPlayer', () => {
4747

4848
await recordingPlayer.play();
4949

50-
assert.isTrue(stepEventHandlerStub.getCalls().length === 3);
50+
assert.lengthOf(stepEventHandlerStub.getCalls(), 3);
5151
});
5252

5353
describe('Step by step execution', () => {

0 commit comments

Comments
 (0)