summaryrefslogtreecommitdiff
path: root/std/testing
diff options
context:
space:
mode:
Diffstat (limited to 'std/testing')
-rw-r--r--std/testing/README.md4
-rw-r--r--std/testing/asserts.ts2
-rw-r--r--std/testing/asserts_test.ts28
-rw-r--r--std/testing/bench.ts6
-rw-r--r--std/testing/bench_example.ts2
-rw-r--r--std/testing/bench_test.ts6
-rw-r--r--std/testing/diff.ts15
-rw-r--r--std/testing/diff_test.ts32
-rw-r--r--std/testing/format.ts12
-rw-r--r--std/testing/format_test.ts184
-rwxr-xr-xstd/testing/runner.ts16
11 files changed, 154 insertions, 153 deletions
diff --git a/std/testing/README.md b/std/testing/README.md
index a3640e728..c7c614103 100644
--- a/std/testing/README.md
+++ b/std/testing/README.md
@@ -44,7 +44,7 @@ Deno.test({
fn(): void {
assertEquals("world", "world");
assertEquals({ hello: "world" }, { hello: "world" });
- }
+ },
});
await Deno.runTests();
@@ -165,7 +165,7 @@ bench({
b.start();
for (let i = 0; i < 1e6; i++);
b.stop();
- }
+ },
});
```
diff --git a/std/testing/asserts.ts b/std/testing/asserts.ts
index 44c311204..19be68763 100644
--- a/std/testing/asserts.ts
+++ b/std/testing/asserts.ts
@@ -66,7 +66,7 @@ function buildMessage(diffResult: ReadonlyArray<DiffResult<string>>): string[] {
}
function isKeyedCollection(x: unknown): x is Set<unknown> {
- return [Symbol.iterator, "size"].every(k => k in (x as Set<unknown>));
+ return [Symbol.iterator, "size"].every((k) => k in (x as Set<unknown>));
}
export function equal(c: unknown, d: unknown): boolean {
diff --git a/std/testing/asserts_test.ts b/std/testing/asserts_test.ts
index 558ce1578..62e199298 100644
--- a/std/testing/asserts_test.ts
+++ b/std/testing/asserts_test.ts
@@ -12,7 +12,7 @@ import {
equal,
fail,
unimplemented,
- unreachable
+ unreachable,
} from "./asserts.ts";
import { red, green, white, gray, bold } from "../fmt/colors.ts";
const { test } = Deno;
@@ -53,11 +53,11 @@ test(function testingEqual(): void {
equal(
new Map([
["foo", "bar"],
- ["baz", "baz"]
+ ["baz", "baz"],
]),
new Map([
["foo", "bar"],
- ["baz", "baz"]
+ ["baz", "baz"],
])
)
);
@@ -77,11 +77,11 @@ test(function testingEqual(): void {
equal(
new Map([
["foo", "bar"],
- ["baz", "qux"]
+ ["baz", "qux"],
]),
new Map([
["baz", "qux"],
- ["foo", "bar"]
+ ["foo", "bar"],
])
)
);
@@ -92,7 +92,7 @@ test(function testingEqual(): void {
new Map([["foo", "bar"]]),
new Map([
["foo", "bar"],
- ["bar", "baz"]
+ ["bar", "baz"],
])
)
);
@@ -253,7 +253,7 @@ const createHeader = (): string[] => [
"",
` ${gray(bold("[Diff]"))} ${red(bold("Left"))} / ${green(bold("Right"))}`,
"",
- ""
+ "",
];
const added: (s: string) => string = (s: string): string => green(bold(s));
@@ -267,7 +267,7 @@ test({
assertEquals(10, 10);
assertEquals("abc", "abc");
assertEquals({ a: 10, b: { c: "1" } }, { a: 10, b: { c: "1" } });
- }
+ },
});
test({
@@ -278,7 +278,7 @@ test({
AssertionError,
[...createHeader(), removed(`- 1`), added(`+ 2`), ""].join("\n")
);
- }
+ },
});
test({
@@ -289,7 +289,7 @@ test({
AssertionError,
[...createHeader(), removed(`- 1`), added(`+ "1"`)].join("\n")
);
- }
+ },
});
test({
@@ -306,10 +306,10 @@ test({
white(' "2",'),
white(" 3,"),
white(" ]"),
- ""
+ "",
].join("\n")
);
- }
+ },
});
test({
@@ -329,8 +329,8 @@ test({
removed(`- "b": "2",`),
removed(`- "c": 3,`),
white(" }"),
- ""
+ "",
].join("\n")
);
- }
+ },
});
diff --git a/std/testing/bench.ts b/std/testing/bench.ts
index 1c4b01c0b..cd7b89e8c 100644
--- a/std/testing/bench.ts
+++ b/std/testing/bench.ts
@@ -65,7 +65,7 @@ function createBenchmarkTimer(clock: BenchmarkClock): BenchmarkTimer {
},
stop(): void {
clock.stop = performance.now();
- }
+ },
};
}
@@ -84,7 +84,7 @@ export function bench(
candidates.push({
name: benchmark.name,
runs: verifyOr1Run(benchmark.runs),
- func: benchmark.func
+ func: benchmark.func,
});
}
}
@@ -92,7 +92,7 @@ export function bench(
/** Runs all registered and non-skipped benchmarks serially. */
export async function runBenchmarks({
only = /[^\s]/,
- skip = /^\s*$/
+ skip = /^\s*$/,
}: BenchmarkRunOptions = {}): Promise<void> {
// Filtering candidates by the "only" and "skip" constraint
const benchmarks: BenchmarkDefinition[] = candidates.filter(
diff --git a/std/testing/bench_example.ts b/std/testing/bench_example.ts
index d27fb97e8..401516cca 100644
--- a/std/testing/bench_example.ts
+++ b/std/testing/bench_example.ts
@@ -16,7 +16,7 @@ bench({
b.start();
for (let i = 0; i < 1e6; i++);
b.stop();
- }
+ },
});
// Itsabug
diff --git a/std/testing/bench_test.ts b/std/testing/bench_test.ts
index 904ee2a8c..6dfc18b10 100644
--- a/std/testing/bench_test.ts
+++ b/std/testing/bench_test.ts
@@ -6,7 +6,7 @@ import "./bench_example.ts";
test({
name: "benching",
- fn: async function(): Promise<void> {
+ fn: async function (): Promise<void> {
bench(function forIncrementX1e9(b): void {
b.start();
for (let i = 0; i < 1e9; i++);
@@ -49,7 +49,7 @@ test({
b.start();
for (let i = 0; i < 1e6; i++);
b.stop();
- }
+ },
});
bench(function throwing(b): void {
@@ -58,5 +58,5 @@ test({
});
await runBenchmarks({ skip: /throw/ });
- }
+ },
});
diff --git a/std/testing/diff.ts b/std/testing/diff.ts
index 5cedb402a..97baa089f 100644
--- a/std/testing/diff.ts
+++ b/std/testing/diff.ts
@@ -7,7 +7,7 @@ interface FarthestPoint {
export enum DiffType {
removed = "removed",
common = "common",
- added = "added"
+ added = "added",
}
export interface DiffResult<T> {
@@ -60,12 +60,12 @@ export default function diff<T>(A: T[], B: T[]): Array<DiffResult<T>> {
...A.map(
(a): DiffResult<typeof a> => ({
type: swapped ? DiffType.added : DiffType.removed,
- value: a
+ value: a,
})
),
...suffixCommon.map(
(c): DiffResult<typeof c> => ({ type: DiffType.common, value: c })
- )
+ ),
];
}
const offset = N;
@@ -107,13 +107,13 @@ export default function diff<T>(A: T[], B: T[]): Array<DiffResult<T>> {
if (type === REMOVED) {
result.unshift({
type: swapped ? DiffType.removed : DiffType.added,
- value: B[b]
+ value: B[b],
});
b -= 1;
} else if (type === ADDED) {
result.unshift({
type: swapped ? DiffType.added : DiffType.removed,
- value: A[a]
+ value: A[a],
});
a -= 1;
} else {
@@ -133,8 +133,9 @@ export default function diff<T>(A: T[], B: T[]): Array<DiffResult<T>> {
k: number,
M: number
): FarthestPoint {
- if (slide && slide.y === -1 && down && down.y === -1)
+ if (slide && slide.y === -1 && down && down.y === -1) {
return { y: 0, id: 0 };
+ }
if (
(down && down.y === -1) ||
k === M ||
@@ -215,6 +216,6 @@ export default function diff<T>(A: T[], B: T[]): Array<DiffResult<T>> {
...backTrace(A, B, fp[delta + offset], swapped),
...suffixCommon.map(
(c): DiffResult<typeof c> => ({ type: DiffType.common, value: c })
- )
+ ),
];
}
diff --git a/std/testing/diff_test.ts b/std/testing/diff_test.ts
index 0e8416274..317dc0db8 100644
--- a/std/testing/diff_test.ts
+++ b/std/testing/diff_test.ts
@@ -6,7 +6,7 @@ test({
name: "empty",
fn(): void {
assertEquals(diff([], []), []);
- }
+ },
});
test({
@@ -14,30 +14,30 @@ test({
fn(): void {
assertEquals(diff(["a"], ["b"]), [
{ type: "removed", value: "a" },
- { type: "added", value: "b" }
+ { type: "added", value: "b" },
]);
- }
+ },
});
test({
name: '"a" vs "a"',
fn(): void {
assertEquals(diff(["a"], ["a"]), [{ type: "common", value: "a" }]);
- }
+ },
});
test({
name: '"a" vs ""',
fn(): void {
assertEquals(diff(["a"], []), [{ type: "removed", value: "a" }]);
- }
+ },
});
test({
name: '"" vs "a"',
fn(): void {
assertEquals(diff([], ["a"]), [{ type: "added", value: "a" }]);
- }
+ },
});
test({
@@ -45,9 +45,9 @@ test({
fn(): void {
assertEquals(diff(["a"], ["a", "b"]), [
{ type: "common", value: "a" },
- { type: "added", value: "b" }
+ { type: "added", value: "b" },
]);
- }
+ },
});
test({
@@ -62,9 +62,9 @@ test({
{ type: "common", value: "n" },
{ type: "common", value: "g" },
{ type: "removed", value: "t" },
- { type: "removed", value: "h" }
+ { type: "removed", value: "h" },
]);
- }
+ },
});
test({
@@ -78,9 +78,9 @@ test({
{ type: "removed", value: "n" },
{ type: "removed", value: "g" },
{ type: "removed", value: "t" },
- { type: "removed", value: "h" }
+ { type: "removed", value: "h" },
]);
- }
+ },
});
test({
@@ -94,9 +94,9 @@ test({
{ type: "added", value: "n" },
{ type: "added", value: "g" },
{ type: "added", value: "t" },
- { type: "added", value: "h" }
+ { type: "added", value: "h" },
]);
- }
+ },
});
test({
@@ -105,7 +105,7 @@ test({
assertEquals(diff(["abc", "c"], ["abc", "bcd", "c"]), [
{ type: "common", value: "abc" },
{ type: "added", value: "bcd" },
- { type: "common", value: "c" }
+ { type: "common", value: "c" },
]);
- }
+ },
});
diff --git a/std/testing/format.ts b/std/testing/format.ts
index 62fdde5eb..ee291dc23 100644
--- a/std/testing/format.ts
+++ b/std/testing/format.ts
@@ -56,7 +56,7 @@ const DEFAULT_OPTIONS: Options = {
indent: 2,
maxDepth: Infinity,
min: false,
- printFunctionName: true
+ printFunctionName: true,
};
interface BasicValueOptions {
@@ -358,8 +358,8 @@ function printIteratorValues(
return result;
}
-const getKeysOfEnumerableProperties = (object: {}): Array<string | symbol> => {
- const keys: Array<string | symbol> = Object.keys(object).sort();
+function getKeysOfEnumerableProperties<T>(object: T): Array<keyof T | symbol> {
+ const keys = Object.keys(object).sort() as Array<keyof T | symbol>;
if (Object.getOwnPropertySymbols) {
Object.getOwnPropertySymbols(object).forEach((symbol): void => {
@@ -372,7 +372,7 @@ const getKeysOfEnumerableProperties = (object: {}): Array<string | symbol> => {
}
return keys;
-};
+}
/**
* Return properties of an object
@@ -519,7 +519,7 @@ const getConfig = (options: Options): Config => ({
...options,
indent: options.min ? "" : createIndent(options.indent),
spacingInner: options.min ? " " : "\n",
- spacingOuter: options.min ? "" : "\n"
+ spacingOuter: options.min ? "" : "\n",
});
/**
@@ -531,7 +531,7 @@ const getConfig = (options: Options): Config => ({
export function format(val: any, options: Optional<Options> = {}): string {
const opts: Options = {
...DEFAULT_OPTIONS,
- ...options
+ ...options,
};
const basicResult = printBasicValue(val, opts);
if (basicResult !== null) {
diff --git a/std/testing/format_test.ts b/std/testing/format_test.ts
index 14f84f3c2..eac5b7d84 100644
--- a/std/testing/format_test.ts
+++ b/std/testing/format_test.ts
@@ -29,12 +29,12 @@ const createVal = () => [
{
id: "8658c1d0-9eda-4a90-95e1-8001e8eb6036",
text: "Add alternative serialize API for pretty-format plugins",
- type: "ADD_TODO"
+ type: "ADD_TODO",
},
{
id: "8658c1d0-9eda-4a90-95e1-8001e8eb6036",
- type: "TOGGLE_TODO"
- }
+ type: "TOGGLE_TODO",
+ },
];
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
@@ -50,7 +50,7 @@ const createExpected = () =>
' "id": "8658c1d0-9eda-4a90-95e1-8001e8eb6036",',
' "type": "TOGGLE_TODO",',
" },",
- "]"
+ "]",
].join("\n");
test({
@@ -58,7 +58,7 @@ test({
fn(): void {
const val = returnArguments();
assertEquals(format(val), "Arguments []");
- }
+ },
});
test({
@@ -66,7 +66,7 @@ test({
fn(): void {
const val: unknown[] = [];
assertEquals(format(val), "Array []");
- }
+ },
});
test({
@@ -74,7 +74,7 @@ test({
fn(): void {
const val = [1, 2, 3];
assertEquals(format(val), "Array [\n 1,\n 2,\n 3,\n]");
- }
+ },
});
test({
@@ -82,7 +82,7 @@ test({
fn(): void {
const val = new Uint32Array(0);
assertEquals(format(val), "Uint32Array []");
- }
+ },
});
test({
@@ -90,7 +90,7 @@ test({
fn(): void {
const val = new Uint32Array(3);
assertEquals(format(val), "Uint32Array [\n 0,\n 0,\n 0,\n]");
- }
+ },
});
test({
@@ -98,7 +98,7 @@ test({
fn(): void {
const val = new ArrayBuffer(3);
assertEquals(format(val), "ArrayBuffer []");
- }
+ },
});
test({
@@ -109,7 +109,7 @@ test({
format(val),
"Array [\n Array [\n 1,\n 2,\n 3,\n ],\n]"
);
- }
+ },
});
test({
@@ -117,7 +117,7 @@ test({
fn(): void {
const val = true;
assertEquals(format(val), "true");
- }
+ },
});
test({
@@ -125,7 +125,7 @@ test({
fn(): void {
const val = false;
assertEquals(format(val), "false");
- }
+ },
});
test({
@@ -133,7 +133,7 @@ test({
fn(): void {
const val = new Error();
assertEquals(format(val), "[Error]");
- }
+ },
});
test({
@@ -141,7 +141,7 @@ test({
fn(): void {
const val = new TypeError("message");
assertEquals(format(val), "[TypeError: message]");
- }
+ },
});
test({
@@ -150,7 +150,7 @@ test({
// tslint:disable-next-line:function-constructor
const val = new Function();
assertEquals(format(val), "[Function anonymous]");
- }
+ },
});
test({
@@ -163,7 +163,7 @@ test({
// tslint:disable-next-line:no-empty
f((): void => {});
assertEquals(format(val), "[Function anonymous]");
- }
+ },
});
test({
@@ -176,7 +176,7 @@ test({
formatted === "[Function anonymous]" || formatted === "[Function val]",
true
);
- }
+ },
});
test({
@@ -185,7 +185,7 @@ test({
// tslint:disable-next-line:no-empty
const val = function named(): void {};
assertEquals(format(val), "[Function named]");
- }
+ },
});
test({
@@ -197,7 +197,7 @@ test({
yield 3;
};
assertEquals(format(val), "[Function generate]");
- }
+ },
});
test({
@@ -207,11 +207,11 @@ test({
const val = function named(): void {};
assertEquals(
format(val, {
- printFunctionName: false
+ printFunctionName: false,
}),
"[Function]"
);
- }
+ },
});
test({
@@ -219,7 +219,7 @@ test({
fn(): void {
const val = Infinity;
assertEquals(format(val), "Infinity");
- }
+ },
});
test({
@@ -227,7 +227,7 @@ test({
fn(): void {
const val = -Infinity;
assertEquals(format(val), "-Infinity");
- }
+ },
});
test({
@@ -235,7 +235,7 @@ test({
fn(): void {
const val = new Map();
assertEquals(format(val), "Map {}");
- }
+ },
});
test({
@@ -248,7 +248,7 @@ test({
format(val),
'Map {\n "prop1" => "value1",\n "prop2" => "value2",\n}'
);
- }
+ },
});
test({
@@ -267,7 +267,7 @@ test({
[Symbol("description"), "symbol"],
["Symbol(description)", "string"],
[["array", "key"], "array"],
- [{ key: "value" }, "object"]
+ [{ key: "value" }, "object"],
]);
const expected = [
"Map {",
@@ -288,10 +288,10 @@ test({
" Object {",
' "key": "value",',
' } => "object",',
- "}"
+ "}",
].join("\n");
assertEquals(format(val), expected);
- }
+ },
});
test({
@@ -299,7 +299,7 @@ test({
fn(): void {
const val = NaN;
assertEquals(format(val), "NaN");
- }
+ },
});
test({
@@ -307,7 +307,7 @@ test({
fn(): void {
const val = null;
assertEquals(format(val), "null");
- }
+ },
});
test({
@@ -315,7 +315,7 @@ test({
fn(): void {
const val = 123;
assertEquals(format(val), "123");
- }
+ },
});
test({
@@ -323,7 +323,7 @@ test({
fn(): void {
const val = -123;
assertEquals(format(val), "-123");
- }
+ },
});
test({
@@ -331,7 +331,7 @@ test({
fn(): void {
const val = 0;
assertEquals(format(val), "0");
- }
+ },
});
test({
@@ -339,7 +339,7 @@ test({
fn(): void {
const val = -0;
assertEquals(format(val), "-0");
- }
+ },
});
test({
@@ -347,7 +347,7 @@ test({
fn(): void {
const val = new Date(10e11);
assertEquals(format(val), "2001-09-09T01:46:40.000Z");
- }
+ },
});
test({
@@ -355,7 +355,7 @@ test({
fn(): void {
const val = new Date(Infinity);
assertEquals(format(val), "Date { NaN }");
- }
+ },
});
test({
@@ -363,7 +363,7 @@ test({
fn(): void {
const val = {};
assertEquals(format(val), "Object {}");
- }
+ },
});
test({
@@ -374,7 +374,7 @@ test({
format(val),
'Object {\n "prop1": "value1",\n "prop2": "value2",\n}'
);
- }
+ },
});
test({
@@ -390,7 +390,7 @@ test({
'Object {\n "prop": "value1",\n Symbol(symbol1): "value2",\n ' +
'Symbol(symbol2): "value3",\n}'
);
- }
+ },
});
test({
@@ -398,15 +398,15 @@ test({
"prints an object without non-enumerable properties which have string key",
fn(): void {
const val = {
- enumerable: true
+ enumerable: true,
};
const key = "non-enumerable";
Object.defineProperty(val, key, {
enumerable: false,
- value: false
+ value: false,
});
assertEquals(format(val), 'Object {\n "enumerable": true,\n}');
- }
+ },
});
test({
@@ -414,15 +414,15 @@ test({
"prints an object without non-enumerable properties which have symbol key",
fn(): void {
const val = {
- enumerable: true
+ enumerable: true,
};
const key = Symbol("non-enumerable");
Object.defineProperty(val, key, {
enumerable: false,
- value: false
+ value: false,
});
assertEquals(format(val), 'Object {\n "enumerable": true,\n}');
- }
+ },
});
test({
@@ -430,7 +430,7 @@ test({
fn(): void {
const val = { b: 1, a: 2 };
assertEquals(format(val), 'Object {\n "a": 2,\n "b": 1,\n}');
- }
+ },
});
test({
@@ -438,7 +438,7 @@ test({
fn(): void {
const val = new RegExp("regexp");
assertEquals(format(val), "/regexp/");
- }
+ },
});
test({
@@ -446,7 +446,7 @@ test({
fn(): void {
const val = /regexp/gi;
assertEquals(format(val), "/regexp/gi");
- }
+ },
});
test({
@@ -454,7 +454,7 @@ test({
fn(): void {
const val = /regexp\d/gi;
assertEquals(format(val), "/regexp\\d/gi");
- }
+ },
});
test({
@@ -462,7 +462,7 @@ test({
fn(): void {
const val = /regexp\d/gi;
assertEquals(format(val, { escapeRegex: true }), "/regexp\\\\d/gi");
- }
+ },
});
test({
@@ -473,7 +473,7 @@ test({
format(obj, { escapeRegex: true }),
'Object {\n "test": /regexp\\\\d/gi,\n}'
);
- }
+ },
});
test({
@@ -481,7 +481,7 @@ test({
fn(): void {
const val = new Set();
assertEquals(format(val), "Set {}");
- }
+ },
});
test({
@@ -491,7 +491,7 @@ test({
val.add("value1");
val.add("value2");
assertEquals(format(val), 'Set {\n "value1",\n "value2",\n}');
- }
+ },
});
test({
@@ -499,7 +499,7 @@ test({
fn(): void {
const val = "string";
assertEquals(format(val), '"string"');
- }
+ },
});
test({
@@ -507,7 +507,7 @@ test({
fn(): void {
const val = "\"'\\";
assertEquals(format(val), '"\\"\'\\\\"');
- }
+ },
});
test({
@@ -515,7 +515,7 @@ test({
fn(): void {
const val = "\"'\\n";
assertEquals(format(val, { escapeString: false }), '""\'\\n"');
- }
+ },
});
test({
@@ -523,7 +523,7 @@ test({
fn(): void {
assertEquals(format('"-"'), '"\\"-\\""');
assertEquals(format("\\ \\\\"), '"\\\\ \\\\\\\\"');
- }
+ },
});
test({
@@ -531,7 +531,7 @@ test({
fn(): void {
const val = ["line 1", "line 2", "line 3"].join("\n");
assertEquals(format(val), '"' + val + '"');
- }
+ },
});
test({
@@ -540,15 +540,15 @@ test({
const polyline = {
props: {
id: "J",
- points: ["0.5,0.460", "0.5,0.875", "0.25,0.875"].join("\n")
+ points: ["0.5,0.460", "0.5,0.875", "0.25,0.875"].join("\n"),
},
- type: "polyline"
+ type: "polyline",
};
const val = {
props: {
- children: polyline
+ children: polyline,
},
- type: "svg"
+ type: "svg",
};
assertEquals(
format(val),
@@ -566,10 +566,10 @@ test({
" },",
" },",
' "type": "svg",',
- "}"
+ "}",
].join("\n")
);
- }
+ },
});
test({
@@ -577,7 +577,7 @@ test({
fn(): void {
const val = Symbol("symbol");
assertEquals(format(val), "Symbol(symbol)");
- }
+ },
});
test({
@@ -585,7 +585,7 @@ test({
fn(): void {
const val = undefined;
assertEquals(format(val), "undefined");
- }
+ },
});
test({
@@ -593,7 +593,7 @@ test({
fn(): void {
const val = new WeakMap();
assertEquals(format(val), "WeakMap {}");
- }
+ },
});
test({
@@ -601,7 +601,7 @@ test({
fn(): void {
const val = new WeakSet();
assertEquals(format(val), "WeakSet {}");
- }
+ },
});
test({
@@ -613,7 +613,7 @@ test({
'Object {\n "prop": Object {\n "prop": Object {\n "prop": ' +
'"value",\n },\n },\n}'
);
- }
+ },
});
test({
@@ -623,7 +623,7 @@ test({
const val: any = {};
val.prop = val;
assertEquals(format(val), 'Object {\n "prop": [Circular],\n}');
- }
+ },
});
test({
@@ -635,21 +635,21 @@ test({
format(val),
'Object {\n "prop1": Object {},\n "prop2": Object {},\n}'
);
- }
+ },
});
test({
name: "default implicit: 2 spaces",
fn(): void {
assertEquals(format(createVal()), createExpected());
- }
+ },
});
test({
name: "default explicit: 2 spaces",
fn(): void {
assertEquals(format(createVal(), { indent: 2 }), createExpected());
- }
+ },
});
// Tests assume that no strings in val contain multiple adjacent spaces!
@@ -661,7 +661,7 @@ test({
format(createVal(), { indent }),
createExpected().replace(/ {2}/g, " ".repeat(indent))
);
- }
+ },
});
test({
@@ -672,7 +672,7 @@ test({
format(createVal(), { indent }),
createExpected().replace(/ {2}/g, " ".repeat(indent))
);
- }
+ },
});
test({
@@ -693,8 +693,8 @@ test({
"object with constructor": new MyObject("value"),
"object without constructor": Object.create(null),
"set empty": new Set(),
- "set non-empty": new Set(["value"])
- }
+ "set non-empty": new Set(["value"]),
+ },
];
assertEquals(
format(v, { maxDepth: 2 }),
@@ -715,17 +715,17 @@ test({
' "set empty": [Set],',
' "set non-empty": [Set],',
" },",
- "]"
+ "]",
].join("\n")
);
- }
+ },
});
test({
name: "prints objects with no constructor",
fn(): void {
assertEquals(format(Object.create(null)), "Object {}");
- }
+ },
});
test({
@@ -736,10 +736,10 @@ test({
const expected = [
"Object {", // Object instead of undefined
' "constructor": "constructor",',
- "}"
+ "}",
].join("\n");
assertEquals(format(obj), expected);
- }
+ },
});
test({
@@ -748,11 +748,11 @@ test({
assertEquals(
format({
toJSON: (): unknown => ({ value: false }),
- value: true
+ value: true,
}),
'Object {\n "value": false,\n}'
);
- }
+ },
});
test({
@@ -761,11 +761,11 @@ test({
assertEquals(
format({
toJSON: (): string => "[Internal Object]",
- value: true
+ value: true,
}),
'"[Internal Object]"'
);
- }
+ },
});
test({
@@ -774,11 +774,11 @@ test({
assertEquals(
format({
toJSON: false,
- value: true
+ value: true,
}),
'Object {\n "toJSON": false,\n "value": true,\n}'
);
- }
+ },
});
test({
@@ -787,11 +787,11 @@ test({
assertEquals(
format({
toJSON: (): unknown => ({ toJSON: (): unknown => ({ value: true }) }),
- value: false
+ value: false,
}),
'Object {\n "toJSON": [Function toJSON],\n}'
);
- }
+ },
});
test({
@@ -801,5 +801,5 @@ test({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(set as any).toJSON = (): string => "map";
assertEquals(format(set), '"map"');
- }
+ },
});
diff --git a/std/testing/runner.ts b/std/testing/runner.ts
index 9aa31cb4a..0abc6012b 100755
--- a/std/testing/runner.ts
+++ b/std/testing/runner.ts
@@ -75,7 +75,7 @@ export async function* findTestModules(
exclude: excludePaths,
includeDirs: true,
extended: true,
- globstar: true
+ globstar: true,
};
async function* expandDirectory(d: string): AsyncIterableIterator<string> {
@@ -83,7 +83,7 @@ export async function* findTestModules(
for await (const walkInfo of expandGlob(dirGlob, {
...expandGlobOpts,
root: d,
- includeDirs: false
+ includeDirs: false,
})) {
yield filePathToUrl(walkInfo.filename);
}
@@ -170,7 +170,7 @@ export async function runTestModules({
exitOnFail = false,
only = /[^\s]/,
skip = /^\s*$/,
- disableLog = false
+ disableLog = false,
}: RunTestModulesOptions = {}): Promise<void> {
let moduleCount = 0;
const testModules = [];
@@ -235,7 +235,7 @@ export async function runTestModules({
exitOnFail,
only,
skip,
- disableLog
+ disableLog,
});
}
@@ -247,14 +247,14 @@ async function main(): Promise<void> {
exclude: ["e"],
failfast: ["f"],
help: ["h"],
- quiet: ["q"]
+ quiet: ["q"],
},
default: {
"allow-none": false,
failfast: false,
help: false,
- quiet: false
- }
+ quiet: false,
+ },
});
if (parsedArgs.help) {
return showHelp();
@@ -277,7 +277,7 @@ async function main(): Promise<void> {
exclude,
allowNone,
disableLog,
- exitOnFail: true
+ exitOnFail: true,
});
} catch (error) {
if (!disableLog) {