summaryrefslogtreecommitdiff
path: root/testing/mod.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2019-05-30 14:59:30 +0200
committerRyan Dahl <ry@tinyclouds.org>2019-05-30 08:59:30 -0400
commit50a79584cb12129b3db1ef3e0eb9d0c8b9f20b62 (patch)
treeee9a90a8b8018c03b1e1a6ace07abdaa494ea90d /testing/mod.ts
parent80b3c486f6222f65b52eb2eca903b67312e8ce0c (diff)
chore: Implement strict mode (denoland/deno_std#453)
Original: https://github.com/denoland/deno_std/commit/be24677d15494e83eea2e99bfc5ccfdde31cb892
Diffstat (limited to 'testing/mod.ts')
-rw-r--r--testing/mod.ts10
1 files changed, 5 insertions, 5 deletions
diff --git a/testing/mod.ts b/testing/mod.ts
index fab8145e8..4ec241c20 100644
--- a/testing/mod.ts
+++ b/testing/mod.ts
@@ -54,7 +54,7 @@ interface TestStats {
interface TestResult {
name: string;
- error: Error;
+ error?: Error;
ok: boolean;
printed: boolean;
}
@@ -68,7 +68,7 @@ function createTestResults(tests: TestDefinition[]): TestResults {
return tests.reduce(
(acc: TestResults, { name }: TestDefinition, i: number): TestResults => {
acc.keys.set(name, i);
- acc.cases.set(i, { name, printed: false, ok: false, error: null });
+ acc.cases.set(i, { name, printed: false, ok: false, error: undefined });
return acc;
},
{ cases: new Map(), keys: new Map() }
@@ -114,11 +114,11 @@ function printResults(
}
function previousPrinted(name: string, results: TestResults): boolean {
- const curIndex: number = results.keys.get(name);
+ const curIndex: number = results.keys.get(name)!;
if (curIndex === 0) {
return true;
}
- return results.cases.get(curIndex - 1).printed;
+ return results.cases.get(curIndex - 1)!.printed;
}
async function createTestCase(
@@ -127,7 +127,7 @@ async function createTestCase(
exitOnFail: boolean,
{ fn, name }: TestDefinition
): Promise<void> {
- const result: TestResult = results.cases.get(results.keys.get(name));
+ const result: TestResult = results.cases.get(results.keys.get(name)!)!;
try {
await fn();
stats.passed++;