From 3254075a5aa8f3ff82674dc7cbbcd1523923498b Mon Sep 17 00:00:00 2001 From: Shivam Singla <38393640+singla-shivam@users.noreply.github.com> Date: Mon, 4 Jul 2022 15:36:12 +0000 Subject: [PATCH] feat: remove Example ran successful message --- examples/add.ts | 2 -- examples/and.ts | 2 -- examples/both.ts | 2 -- examples/either.ts | 2 -- examples/flip.ts | 2 -- examples/not.ts | 2 -- run-utils/examples.ts | 8 ++++---- 7 files changed, 4 insertions(+), 16 deletions(-) diff --git a/examples/add.ts b/examples/add.ts index 322cfcb..b00e1ef 100644 --- a/examples/add.ts +++ b/examples/add.ts @@ -8,5 +8,3 @@ const plus5 = Fae.add(5) console.assert(plus5(3) === 8) console.assert(plus5(-7) === -2) console.assert(plus5(0) === 5) - -console.log('Example ran successfully') diff --git a/examples/and.ts b/examples/and.ts index d36db04..1241143 100644 --- a/examples/and.ts +++ b/examples/and.ts @@ -20,5 +20,3 @@ const andWithTruthyValue = Fae.and(2) console.assert(andWithTruthyValue(true) === true) console.assert(andWithTruthyValue('ab') === true) console.assert(andWithTruthyValue(2) === true) - -console.log('Example ran successfully') diff --git a/examples/both.ts b/examples/both.ts index f82b978..88affde 100644 --- a/examples/both.ts +++ b/examples/both.ts @@ -12,5 +12,3 @@ const oddGreaterThan5 = Fae.both(isOdd, isGreaterThan5) console.assert(isBetween5And13(12) === true) console.assert(oddLessThan1(3) === false) console.assert(oddGreaterThan5(21) === true) - -console.log('Example ran successfully') diff --git a/examples/either.ts b/examples/either.ts index be9c743..9a61e10 100644 --- a/examples/either.ts +++ b/examples/either.ts @@ -15,5 +15,3 @@ const oddOrLessThan1 = Fae.either(isOdd, isLessThan1) console.assert(is5OrLessThan13(12) === true) console.assert(isOddOrEquals5(4) === false) console.assert(oddOrLessThan1(21) === true) - -console.log('Example ran successfully') diff --git a/examples/flip.ts b/examples/flip.ts index bcce032..223f203 100644 --- a/examples/flip.ts +++ b/examples/flip.ts @@ -2,5 +2,3 @@ import * as Fae from 'https://deno.land/x/fae/mod.ts' // TODO console.assert(1 === 1) - -console.log('Example ran successfully') diff --git a/examples/not.ts b/examples/not.ts index 95b70c9..d63f0c5 100644 --- a/examples/not.ts +++ b/examples/not.ts @@ -12,5 +12,3 @@ console.assert(Fae.not(true) === false) console.assert(Fae.not('ab') === false) console.assert(Fae.not([1, 2]) === false) console.assert(Fae.not({ a: 1, b: 3 }) === false) - -console.log('Example ran successfully') diff --git a/run-utils/examples.ts b/run-utils/examples.ts index a30718e..2c3209c 100644 --- a/run-utils/examples.ts +++ b/run-utils/examples.ts @@ -3,6 +3,7 @@ import { italic, red, yellow, + underline, } from 'https://deno.land/std@0.145.0/fmt/colors.ts' const examples: Deno.DirEntry[] = [] @@ -54,10 +55,11 @@ if (nonZeroExamples.length) { const name = functionNameForLog(e.name) const errorCode = red(e.status.code.toString()) - return `${name}- ${errorCode}` + return `${name} ${errorCode}` }) .join('\n') + console.error(underline(red('Some or all examples failed with status codes-\n'))) console.error(statusInfo) Deno.exit(1) } @@ -79,9 +81,7 @@ const outputs = await Promise.all( ) const nonEmptyOutputExamples = outputs.filter( - ({ output, error }) => - output.trim() !== 'Example ran successfully' || - error.includes('Assertion failed'), + ({ error }) => error.includes('Assertion failed'), ) if (nonEmptyOutputExamples.length) {