First of all, thanks for the work! The package helps me a lot!
I'm building a website with Node.js and have recently come across the "issue" that when I run mocha tests, alerts fire on top of the code editor which is rather annoying. I'm using alerts to express errors in the user registration process, which I test quite thoroughly, and, as a result, get a bunch of alerts from it that I have to manually close.
I've fixed the issue for myself with my own little wrapper:
const alert = require('alert');
var generateAlert = module.exports = function(msg) {
if (process.env.NODE_ENV == "development") {
alert(msg);
}
}
When testing, I set NODE_ENV
to test
which suppresses the alert.
So I was thinking of building a feature where a user can pass options to alert()
to determine in which environments alert should or should not fire. thingToUse
could also be an option, and not setting the options
parameter would of course not change anything.
Something like:
alert("Username already in use", { thingToUse: "yad", env: ["development", "production"]})
It would then read from process.env.NODE_ENV
to find the value set by the user.
Wondering if this is of interest or if it just adds unnecessary size to the package. If it is, I'll get on it right away!
Cheers!