Skip to content

Instantly share code, notes, and snippets.

@codexico
Created June 7, 2021 01:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codexico/9d156a9606491ebacb0c80a095dfe774 to your computer and use it in GitHub Desktop.
Save codexico/9d156a9606491ebacb0c80a095dfe774 to your computer and use it in GitHub Desktop.
just a simple test runner
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