Created
October 7, 2020 17:13
-
-
Save fhpriamo/a2831048aae714fc4bc4e136545c97d6 to your computer and use it in GitHub Desktop.
Ultra minimalistic testing utility for JS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const assert = require("assert"); | |
function red(text) { | |
return `\x1b[30m\x1b[101m${text}\x1b[0m`; | |
} | |
function green(text) { | |
return `\x1b[30m\x1b[102m${text}\x1b[0m`; | |
} | |
function test(description, fn) { | |
try { | |
fn(assert); | |
console.log(green(' PASS '), description); | |
} catch (err) { | |
console.log(red(' FAIL '), description, '\n', err); | |
} | |
} | |
module.exports = test; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment