Skip to content

Instantly share code, notes, and snippets.

@amitgupta15
Last active April 30, 2020 20:51
Show Gist options
  • Save amitgupta15/c326ec43e5fff2a598ec93fcbb6c88f1 to your computer and use it in GitHub Desktop.
Save amitgupta15/c326ec43e5fff2a598ec93fcbb6c88f1 to your computer and use it in GitHub Desktop.
it-test-function
(function(){
'use strict';
/**
* test function
* @param {string} desc
* @param {function} fn
*/
function it(desc, fn) {
try {
fn();
console.log('\x1b[32m%s\x1b[0m', '\u2714 ' + desc);
} catch (error) {
console.log('\n');
console.log('\x1b[31m%s\x1b[0m', '\u2718 ' + desc);
console.error(error);
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment