diff options
Diffstat (limited to 'testing')
-rw-r--r-- | testing/README.md | 16 | ||||
-rw-r--r-- | testing/asserts.ts | 10 | ||||
-rw-r--r-- | testing/format.ts | 10 | ||||
-rw-r--r-- | testing/mod.ts | 38 | ||||
-rwxr-xr-x | testing/runner.ts | 20 | ||||
-rw-r--r-- | testing/test.ts | 20 |
6 files changed, 46 insertions, 68 deletions
diff --git a/testing/README.md b/testing/README.md index 3db9f58e2..88923c1c9 100644 --- a/testing/README.md +++ b/testing/README.md @@ -89,11 +89,9 @@ Using `assertThrows()`: ```ts test(function doesThrow(): void { - assertThrows( - (): void => { - throw new TypeError("hello world!"); - } - ); + assertThrows((): void => { + throw new TypeError("hello world!"); + }); assertThrows((): void => { throw new TypeError("hello world!"); }, TypeError); @@ -108,11 +106,9 @@ test(function doesThrow(): void { // This test will not pass test(function fails(): void { - assertThrows( - (): void => { - console.log("Hello world"); - } - ); + assertThrows((): void => { + console.log("Hello world"); + }); }); ``` diff --git a/testing/asserts.ts b/testing/asserts.ts index adf77f3a7..28dfa7911 100644 --- a/testing/asserts.ts +++ b/testing/asserts.ts @@ -56,12 +56,10 @@ function buildMessage(diffResult: ReadonlyArray<DiffResult<string>>): string[] { ); messages.push(""); messages.push(""); - diffResult.forEach( - (result: DiffResult<string>): void => { - const c = createColor(result.type); - messages.push(c(`${createSign(result.type)}${result.value}`)); - } - ); + diffResult.forEach((result: DiffResult<string>): void => { + const c = createColor(result.type); + messages.push(c(`${createSign(result.type)}${result.value}`)); + }); messages.push(""); return messages; diff --git a/testing/format.ts b/testing/format.ts index 7a0d8c173..06c1b6818 100644 --- a/testing/format.ts +++ b/testing/format.ts @@ -360,13 +360,11 @@ const getKeysOfEnumerableProperties = (object: {}): Array<string | symbol> => { const keys: Array<string | symbol> = Object.keys(object).sort(); if (Object.getOwnPropertySymbols) { - Object.getOwnPropertySymbols(object).forEach( - (symbol): void => { - if (Object.getOwnPropertyDescriptor(object, symbol)!.enumerable) { - keys.push(symbol); - } + Object.getOwnPropertySymbols(object).forEach((symbol): void => { + if (Object.getOwnPropertyDescriptor(object, symbol)!.enumerable) { + keys.push(symbol); } - ); + }); } return keys; diff --git a/testing/mod.ts b/testing/mod.ts index c68528fbd..c8577770b 100644 --- a/testing/mod.ts +++ b/testing/mod.ts @@ -203,14 +203,12 @@ function report(result: TestResult): void { } function printFailedSummary(results: TestResults): void { - results.cases.forEach( - (v): void => { - if (!v.ok) { - console.error(`${RED_BG_FAIL} ${red(v.name)}`); - console.error(v.error); - } + results.cases.forEach((v): void => { + if (!v.ok) { + console.error(`${RED_BG_FAIL} ${red(v.name)}`); + console.error(v.error); } - ); + }); } function printResults( @@ -322,14 +320,12 @@ async function runTestsSerial( print( GREEN_OK + " " + name + " " + promptTestTime(end - start, true) ); - results.cases.forEach( - (v): void => { - if (v.name === name) { - v.ok = true; - v.printed = true; - } + results.cases.forEach((v): void => { + if (v.name === name) { + v.ok = true; + v.printed = true; } - ); + }); } catch (err) { if (disableLog) { print(CLEAR_LINE, false); @@ -337,15 +333,13 @@ async function runTestsSerial( print(`${RED_FAILED} ${name}`); print(err.stack); stats.failed++; - results.cases.forEach( - (v): void => { - if (v.name === name) { - v.error = err; - v.ok = false; - v.printed = true; - } + results.cases.forEach((v): void => { + if (v.name === name) { + v.error = err; + v.ok = false; + v.printed = true; } - ); + }); if (exitOnFail) { break; } diff --git a/testing/runner.ts b/testing/runner.ts index e0a06fee1..414fb1f56 100755 --- a/testing/runner.ts +++ b/testing/runner.ts @@ -85,13 +85,11 @@ export async function getMatchingUrls( ); const matchingRemoteUrls = includeRemote.filter( (candidateUrl: string): boolean => { - return !excludeRemotePatterns.some( - (pattern: RegExp): boolean => { - const r = pattern.test(candidateUrl); - pattern.lastIndex = 0; - return r; - } - ); + return !excludeRemotePatterns.some((pattern: RegExp): boolean => { + const r = pattern.test(candidateUrl); + pattern.lastIndex = 0; + return r; + }); } ); @@ -135,11 +133,9 @@ export async function main(root: string = cwd()): Promise<void> { if (parsedArgs._.length) { includeFiles = (parsedArgs._ as string[]) - .map( - (fileGlob: string): string[] => { - return fileGlob.split(","); - } - ) + .map((fileGlob: string): string[] => { + return fileGlob.split(","); + }) .flat(); } else { includeFiles = DEFAULT_GLOBS; diff --git a/testing/test.ts b/testing/test.ts index 93233f7cc..dd6d772f6 100644 --- a/testing/test.ts +++ b/testing/test.ts @@ -51,12 +51,10 @@ test(function testingAssertNotStrictEqual(): void { test(function testingDoesThrow(): void { let count = 0; - assertThrows( - (): void => { - count++; - throw new Error(); - } - ); + assertThrows((): void => { + count++; + throw new Error(); + }); assert(count === 1); }); @@ -64,12 +62,10 @@ test(function testingDoesNotThrow(): void { let count = 0; let didThrow = false; try { - assertThrows( - (): void => { - count++; - console.log("Hello world"); - } - ); + assertThrows((): void => { + count++; + console.log("Hello world"); + }); } catch (e) { assert(e.message === "Expected function to throw."); didThrow = true; |