Last active
April 4, 2021 16:36
-
-
Save anupam-io/ecf8f0caa1897dd88cff747be02b7885 to your computer and use it in GitHub Desktop.
Mimicking `mocha`'s it utitlity.
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"); | |
async function it(name, fun) { | |
await fun() | |
.then(() => { | |
console.log(name, ": passed."); | |
}) | |
.catch((err) => { | |
console.log(name, ": failed."); | |
console.log("Error: ", err); | |
}); | |
} | |
it("MyTest", async () => { | |
assert(true); | |
}); | |
it("MyTest", async () => { | |
assert(false); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output: