diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-03-19 10:58:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-19 10:58:12 +0100 |
commit | b0b27c43100bf4a7303174b9765c853d2f76f207 (patch) | |
tree | f992aad22e4ca38221bad100d4dae52737ea98a3 /cli/js/testing.ts | |
parent | 54d1f299dc774c695056f04cfe1013287b53b86a (diff) |
refactor: rename Deno.TestDefinition.skip to ignore (#4400)
Diffstat (limited to 'cli/js/testing.ts')
-rw-r--r-- | cli/js/testing.ts | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/cli/js/testing.ts b/cli/js/testing.ts index 0d21962c0..08bb2db87 100644 --- a/cli/js/testing.ts +++ b/cli/js/testing.ts @@ -10,7 +10,7 @@ import { assert } from "./util.ts"; const RED_FAILED = red("FAILED"); const GREEN_OK = green("ok"); -const YELLOW_SKIPPED = yellow("SKIPPED"); +const YELLOW_IGNORED = yellow("ignored"); const disabledConsole = new Console((_x: string, _isErr?: boolean): void => {}); function formatDuration(time = 0): string { @@ -68,7 +68,7 @@ export type TestFunction = () => void | Promise<void>; export interface TestDefinition { fn: TestFunction; name: string; - skip?: boolean; + ignore?: boolean; disableOpSanitizer?: boolean; disableResourceSanitizer?: boolean; } @@ -93,12 +93,12 @@ export function test( if (!t) { throw new TypeError("The test name can't be empty"); } - testDef = { fn: fn as TestFunction, name: t, skip: false }; + testDef = { fn: fn as TestFunction, name: t, ignore: false }; } else if (typeof t === "function") { if (!t.name) { throw new TypeError("The test function can't be anonymous"); } - testDef = { fn: t, name: t.name, skip: false }; + testDef = { fn: t, name: t.name, ignore: false }; } else { if (!t.fn) { throw new TypeError("Missing test function"); @@ -106,8 +106,7 @@ export function test( if (!t.name) { throw new TypeError("The test name can't be empty"); } - - testDef = { ...t, skip: Boolean(t.skip) }; + testDef = { ...t, ignore: Boolean(t.ignore) }; } if (testDef.disableOpSanitizer !== true) { @@ -141,7 +140,7 @@ export interface RunTestsOptions { enum TestStatus { Passed = "passed", Failed = "failed", - Skipped = "skipped" + Ignored = "ignored" } interface TestResult { @@ -211,11 +210,11 @@ class TestApi { const results: TestResult[] = []; const suiteStart = +new Date(); - for (const { name, fn, skip } of this.testsToRun) { + for (const { name, fn, ignore } of this.testsToRun) { const result: Partial<TestResult> = { name, duration: 0 }; yield { kind: TestEvent.TestStart, name }; - if (skip) { - result.status = TestStatus.Skipped; + if (ignore) { + result.status = TestStatus.Ignored; this.stats.ignored++; } else { const start = +new Date(); @@ -321,8 +320,8 @@ export class ConsoleTestReporter implements TestReporter { case TestStatus.Failed: this.log(`${RED_FAILED} ${formatDuration(result.duration)}`); break; - case TestStatus.Skipped: - this.log(`${YELLOW_SKIPPED} ${formatDuration(result.duration)}`); + case TestStatus.Ignored: + this.log(`${YELLOW_IGNORED} ${formatDuration(result.duration)}`); break; } } |