Skip to content

Commit 1ceb3b6

Browse files
bmeurerDevtools-frontend LUCI CQ
authored and
Devtools-frontend LUCI CQ
committed
[chai] Use assert global provided by karma-chai.
This removes the pattern ```js const {assert} = chai; ``` from our unit test suite, which is fundamentally incompatible with TypeScript `asserts`, which we intend to put onto Chai assert functions. And this is also unnecessary, since `karma-chai` (and also `karma-chai-sinon`) already provide `assert` as a global (with the proper types). Bug: 333520272 Change-Id: Id5dfd65903b5b116414709782c7923fc5523e480 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5439575 Commit-Queue: Benedikt Meurer <[email protected]> Auto-Submit: Benedikt Meurer <[email protected]> Reviewed-by: Philip Pfaffe <[email protected]>
1 parent afd1d2f commit 1ceb3b6

File tree

420 files changed

+407
-1157
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

420 files changed

+407
-1157
lines changed

front_end/core/common/Base64.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
const {assert} = chai;
6-
75
import * as Common from './common.js';
86

97
describe('Base64 decoder', () => {

front_end/core/common/CharacterIdMap.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
const {assert} = chai;
6-
75
import * as Common from './common.js';
86

97
const CharacterIdMap = Common.CharacterIdMap.CharacterIdMap;

front_end/core/common/Color.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
const {assert} = chai;
6-
75
import * as Common from './common.js';
86

97
const Color = Common.Color;

front_end/core/common/ColorConverter.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
const {assert} = chai;
6-
75
import * as Common from './common.js';
86

97
function assertAlmostEqual(array1: number[], array2: number[], delta = 0.01) {

front_end/core/common/ColorUtils.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
const {assert} = chai;
6-
75
import * as Common from './common.js';
86

97
describe('ColorUtils', () => {

front_end/core/common/Console.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
const {assert} = chai;
6-
75
import * as Common from './common.js';
86

97
const Console = Common.Console.Console;

front_end/core/common/Debouncer.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
const {assert} = chai;
6-
75
import * as Common from './common.js';
86

97
describe('Debouncer', () => {

front_end/core/common/Lazy.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
const {assert} = chai;
6-
75
import * as Common from './common.js';
86

97
const lazy = Common.Lazy.lazy;

front_end/core/common/Mutex.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
const {assert} = chai;
6-
75
import * as Common from './common.js';
86

97
describe('Mutex', () => {

front_end/core/common/Object.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
const {assert} = chai;
6-
75
import * as Common from './common.js';
86

97
describe('ObjectWrapper', () => {

front_end/core/common/ParsedURL.test.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
const {assert} = chai;
5+
import type * as Platform from '../platform/platform.js';
66

77
import * as Common from './common.js';
8-
import type * as Platform from '../platform/platform.js';
98

109
const ParsedURL = Common.ParsedURL.ParsedURL;
1110

front_end/core/common/Progress.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
const {assert} = chai;
6-
75
import * as Common from './common.js';
86

97
const CompositeProgress = Common.Progress.CompositeProgress;

front_end/core/common/ResolverBase.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
const {assert} = chai;
6-
75
import * as Common from './common.js';
86

97
class TestClass {}

front_end/core/common/ResourceType.test.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
const {assert} = chai;
6-
7-
import * as Common from './common.js';
5+
import {describeWithEnvironment} from '../../testing/EnvironmentHelpers.js';
86
import type * as Platform from '../platform/platform.js';
97

10-
import {describeWithEnvironment} from '../../testing/EnvironmentHelpers.js';
8+
import * as Common from './common.js';
119

1210
const ResourceType = Common.ResourceType.ResourceType;
1311
const ResourceCategory = Common.ResourceType.ResourceCategory;

front_end/core/common/Revealer.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
const {assert} = chai;
6-
75
import * as Common from './common.js';
86

97
describe('Revealer', () => {

front_end/core/common/SegmentedRange.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
const {assert} = chai;
6-
75
import * as Common from './common.js';
86

97
const Segment = Common.SegmentedRange.Segment;

front_end/core/common/SettingRegistration.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import * as i18n from '../i18n/i18n.js';
1111

1212
import * as Common from './common.js';
1313

14-
const {assert} = chai;
15-
1614
const settingName = 'mock-setting';
1715
const settingTitle = 'Mock setting';
1816
const enableTitle = 'Enable mock setting';

front_end/core/common/Settings.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
const {assert} = chai;
6-
75
import * as Common from './common.js';
86

97
const SettingsStorage = Common.Settings.SettingsStorage;

front_end/core/common/SimpleHistoryManager.test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import * as Common from './common.js';
66

7-
const {assert} = chai;
87
const SimpleHistoryManager = Common.SimpleHistoryManager.SimpleHistoryManager;
98

109
class Entry implements Common.SimpleHistoryManager.HistoryEntry {

front_end/core/common/StringOutputStream.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
const {assert} = chai;
6-
75
import * as Common from './common.js';
86

97
const StringOutputStream = Common.StringOutputStream.StringOutputStream;

front_end/core/common/TextDictionary.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
const {assert} = chai;
6-
75
import * as Common from './common.js';
86

97
const TextDictionary = Common.TextDictionary.TextDictionary;

front_end/core/common/Throttler.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
const {assert} = chai;
6-
75
import * as Common from './common.js';
86

97
const Throttler = Common.Throttler.Throttler;

front_end/core/common/Trie.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
const {assert} = chai;
6-
75
import * as Common from './common.js';
86

97
const Trie = Common.Trie.Trie;

front_end/core/common/WasmDisassembly.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
const {assert} = chai;
6-
75
import * as Common from './common.js';
86

97
const WasmDisassembly = Common.WasmDisassembly.WasmDisassembly;

front_end/core/dom_extension/DOMExtension.test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
const {assert} = chai;
65
import './dom_extension.js';
76

87
declare global {

front_end/core/host/AidaClient.test.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
import * as Host from './host.js';
65
import * as Root from '../root/root.js';
76

8-
const {assert} = chai;
7+
import * as Host from './host.js';
98

109
const TEST_MODEL_ID = 'testModelId';
1110

front_end/core/i18n/DevToolsLocale.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
const {assert} = chai;
6-
75
import * as i18n from './i18n.js';
86

97
describe('DevToolsLocale', () => {

front_end/core/i18n/i18n.test.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
const {assert} = chai;
6-
7-
import * as i18n from './i18n.js';
5+
import {assertElement} from '../../testing/DOMHelpers.js';
86
import * as i18nRaw from '../../third_party/i18n/i18n.js';
97

10-
import {assertElement} from '../../testing/DOMHelpers.js';
8+
import * as i18n from './i18n.js';
119

1210
describe('serializeUIString', () => {
1311
it('serializes strings without placeholders', () => {

front_end/core/i18n/time-utilities.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
const {assert} = chai;
6-
75
import * as i18n from './i18n.js';
86

97
describe('preciseMillisToString', () => {

front_end/core/platform/ArrayUtilities.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
import * as Platform from './platform.js';
66

7-
const {assert} = chai;
8-
97
function comparator(a: number, b: number): number {
108
return a < b ? -1 : (a > b ? 1 : 0);
119
}

front_end/core/platform/DOMUtilities.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import {renderElementIntoDOM} from '../../testing/DOMHelpers.js';
66

77
import * as Platform from './platform.js';
88

9-
const {assert} = chai;
10-
119
describe('DOMUtilities', () => {
1210
describe('deepActiveElement', () => {
1311
it('returns the active element if there is no shadow root', () => {

front_end/core/platform/DateUtilities.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
import * as Platform from './platform.js';
66

7-
const {assert} = chai;
8-
97
describe('DateUtilities', () => {
108
describe('isValid', () => {
119
it('returns true for a valid date', () => {

front_end/core/platform/KeyboardUtilities.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
import * as Platform from './platform.js';
66

7-
const {assert} = chai;
8-
97
describe('KeyboardUtilities', () => {
108
describe('#keyIsArrowKey', () => {
119
it('returns true for ArrowUp, ArrowDown, ArrowLeft and ArrowRight', () => {

front_end/core/platform/MapUtilities.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
import * as Platform from './platform.js';
66

7-
const {assert} = chai;
8-
97
describe('MapUtilities', () => {
108
describe('inverse', () => {
119
it('inverts the map returning a multimap with the map\'s values as keys and the map\'s keys as values', () => {

front_end/core/platform/NumberUtilities.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
import * as Platform from './platform.js';
66

7-
const {assert} = chai;
8-
97
describe('NumberUtilities', () => {
108
describe('clamp', () => {
119
it('takes the lower bound if the number is smaller', () => {

front_end/core/platform/SetUtilities.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
import * as Plaform from './platform.js';
66

7-
const {assert} = chai;
8-
97
describe('SetUtilities', () => {
108
describe('addAll', () => {
119
it('adds all items in the iterable to the set', () => {

front_end/core/platform/StringUtilities.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
import * as Platform from './platform.js';
66

7-
const {assert} = chai;
8-
97
describe('StringUtilities', () => {
108
describe('escapeCharacters', () => {
119
it('escapes the given characters', () => {

front_end/core/platform/TypedArrayUtilities.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
import * as Platform from './platform.js';
66

7-
const {assert} = chai;
8-
97
describe('TypedArrayUtilities', () => {
108
describe('BigUint32Array', () => {
119
it('can be expandable', () => {

front_end/core/protocol_client/NodeURL.test.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
const {assert} = chai;
5+
import * as Host from '../host/host.js';
66

77
import * as ProtocolClient from './protocol_client.js';
8-
import * as Host from '../host/host.js';
98

109
describe('NodeURL', () => {
1110
describe('platform detection for paths', () => {

front_end/core/root/Runtime.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
import * as Root from './root.js';
66

7-
const {assert} = chai;
8-
97
describe('Runtime', () => {
108
beforeEach(() => {
119
Root.Runtime.experiments.clearForTest();

front_end/core/sdk/AccessibilityModel.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ import {describeWithMockConnection} from '../../testing/MockConnection.js';
77

88
import * as SDK from './sdk.js';
99

10-
const {assert} = chai;
11-
1210
describeWithMockConnection('AccessibilityModel', () => {
1311
it('can be instantiated', () => {
1412
assert.doesNotThrow(() => {

front_end/core/sdk/AutofillModel.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import {describeWithMockConnection} from '../../testing/MockConnection.js';
88

99
import * as SDK from './sdk.js';
1010

11-
const {assert} = chai;
12-
1311
describeWithMockConnection('AutofillModel', () => {
1412
it('can enable and disable the Autofill CDP domain', () => {
1513
const target = createTarget();

0 commit comments

Comments
 (0)