Closed roshan-cinq closed 6 years ago
I don't quite understand what your issue is, probably because I've never used that specific debug package. Are you just looking for an easier way to set the DEBUG
environment variable?
The visionmedia/debug package enables console logging selectively based on the value of the environment variable DEBUG
. Its very useful while dev/test to set the variable to see only the logs you want to.
The generator already provides a convenient option to set the DEBUG
or any env variable here. And the gulp task env:all
sets it from this file. So I am assuming the authors meant for this package to be used if need be.
But the task does not behave as expected. The debug package is initialized on first load, where it checks the env variable. But while running the gulp test
task, the top level node modules are loaded (by babel I think) before the task itself executes. So effectively the env variable has not been set when the module loads and no logs basically.
I came up with a workaround. Added debug.enable(localConfig.DEBUG);
at the end of env:all
gulp task.
Can this be closed?
I have an issue with using the
visionmedia/debug
library. While running tests, the gulp task sets the environment variables fromlocal.env.js
. It does not work if I set sayapp:*
, but works if I set it to*
. It also works fine if I set it manually byset DEBUG=app:*
before running the task.Some digging through the
debug
module showed that it was only working for node modules which had their own nesteddebug
. It doesn't work for the main app or any node module which uses the top leveldebug
. Some more digging leads me to believe that babel loads the top leveldebug
before the gulp task runs.Is there a workaround for this apart from manually setting env?