Skip to content

Commit 330032d

Browse files
Replace chai.assert with node:assert/strict (#3252)
Also switched all existing node:assert to node:assert/strict
1 parent aeafffb commit 330032d

95 files changed

Lines changed: 251 additions & 283 deletions

File tree

Some content is hidden

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

.oxlintrc.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@
3939
"eslint/no-restricted-imports": [
4040
"warn",
4141
{
42+
"paths": [
43+
{
44+
"name": "node:assert",
45+
"message": "Use node:assert/strict instead"
46+
}
47+
],
4248
"patterns": [
4349
{
4450
"group": ["../*/src", "../*/src/*", "../../*/src", "../../*/src/*"],
@@ -77,6 +83,7 @@
7783
"typescript/restrict-template-expressions": "off",
7884
"typescript/unbound-method": "off",
7985
"unicorn/prefer-module": "warn",
86+
"unicorn/prefer-node-protocol": "warn",
8087
"unicorn/throw-new-error": "warn"
8188
},
8289
"overrides": [

packages/app-vscode/src/createVscodeIde.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as crypto from "crypto";
1+
import * as crypto from "node:crypto";
22
import * as os from "node:os";
33
import * as path from "node:path";
44
import type { ExtensionContext } from "vscode";

packages/app-vscode/src/ide/vscode/textLine.vscode.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as assert from "assert";
1+
import * as assert from "node:assert/strict";
22
import { getReusableEditor } from "@cursorless/lib-vscode-common";
33
import VscodeTextLine from "./VscodeTextLine";
44

packages/app-vscode/src/keyboard/buildSuffixTrie.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import assert from "node:assert";
1+
import * as assert from "node:assert/strict";
22
import type { KeyValuePair } from "./buildSuffixTrie";
33
import { buildSuffixTrie } from "./buildSuffixTrie";
44
import { isEqual, sortBy, uniq, uniqWith } from "lodash-es";
@@ -130,8 +130,8 @@ suite("buildSuffixTrie", () => {
130130
sortEntries(chars.flatMap((char) => trie.search(char))),
131131
isEqual,
132132
).map(({ key, value }) => ({ key, value }));
133-
assert.deepStrictEqual(actual, sortEntries(expected));
134-
assert.deepStrictEqual(
133+
assert.deepEqual(actual, sortEntries(expected));
134+
assert.deepEqual(
135135
sortBy(conflicts.map(sortEntries), (conflict) =>
136136
JSON.stringify(conflict),
137137
),

packages/app-vscode/src/keyboard/grammar/getAcceptableTokenTypes.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import assert from "assert";
1+
import * as assert from "node:assert/strict";
22
import nearley from "nearley";
33
import type { KeyDescriptor } from "../TokenTypeHelpers";
44
import grammar from "./generated/grammar";
@@ -153,7 +153,7 @@ suite("keyboard.getAcceptableTokenTypes", () => {
153153
arg: value.partialArg,
154154
},
155155
};
156-
assert(
156+
assert.ok(
157157
candidates.some((result) => isEqual(result, fullValue)),
158158
"Relevant candidates (note that symbols will be missing):\n" +
159159
JSON.stringify(candidates, null, 2),

packages/app-vscode/src/keyboard/grammar/grammar.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import nearley from "nearley";
22
import grammar from "./generated/grammar";
3-
import assert from "assert";
3+
import * as assert from "node:assert/strict";
44
import type { KeyDescriptor } from "../TokenTypeHelpers";
55
import type { KeyboardCommandHandler } from "../KeyboardCommandHandler";
66
import type { KeyboardCommand } from "../KeyboardCommandTypeHelpers";
@@ -189,7 +189,7 @@ suite("keyboard grammar", () => {
189189
parser.feed(tokens);
190190

191191
assert.equal(parser.results.length, 1);
192-
assert.deepStrictEqual(parser.results[0], expected);
192+
assert.deepEqual(parser.results[0], expected);
193193
});
194194
});
195195
});

packages/app-vscode/src/scripts/initLaunchSandbox.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* developing the Cursorless VSCode extension locally.
55
*/
66
import { extensionDependencies } from "@cursorless/lib-common";
7-
import * as cp from "child_process";
7+
import * as cp from "node:child_process";
88

99
const vsCodeToolName: string = "code";
1010
const validCliToolParams: Array<string> = ["--code", "--codium"];

packages/app-vscode/src/scripts/populateDist/runCommand.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { exec } from "child_process";
2-
import { promisify } from "util";
1+
import { exec } from "node:child_process";
2+
import { promisify } from "node:util";
33

44
const execAsync = promisify(exec);
55

packages/app-web-docs/docusaurus.config.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { Config } from "@docusaurus/types";
22
import type { Root } from "mdast";
33
import { createRequire } from "node:module";
44
import { fileURLToPath } from "node:url";
5-
import { dirname, extname, relative, resolve } from "path";
5+
import { dirname, extname, relative, resolve } from "node:path";
66
import { themes } from "prism-react-renderer";
77
import type { Transformer } from "unified";
88
import { visit } from "unist-util-visit";

packages/app-web-docs/src/docs/components/flattenHighlights.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { BorderStyle, Range } from "@cursorless/lib-common";
2-
import * as assert from "node:assert";
2+
import * as assert from "node:assert/strict";
33
import { flattenHighlights } from "./flattenHighlights";
44
import type { Highlight, Scope } from "./types";
55

0 commit comments

Comments
 (0)