Created
June 7, 2021 01:03
-
-
Save codexico/9d156a9606491ebacb0c80a095dfe774 to your computer and use it in GitHub Desktop.
just a simple test runner
This file contains hidden or 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
function logError(description, result, expectation) { | |
console.error('✖ ', description) | |
console.log('expected: ', expectation) | |
console.log('got: ', result) | |
} | |
function test(description, assertion, expectation) { | |
const result = assertion(); | |
result === expectation | |
? console.log('✔ ', description) | |
: (() => { | |
logError(description, result, expectation); | |
console.trace(); | |
})(); | |
} | |
exports.test = test; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment