Search code examples
javascriptnode.jsnightmare

How to check if Nightmare JS is running in debug mode


Is there a way to determine if my Nightmare script is running with debugging output?

For example, to launch Nightmare with debug output, I'd use:

DEBUG=nightmare node myscript.js; otherwise, I'd use node myscript.js

Within myscript.js, how can I determine if the script is running with DEBUG=nightmare?


Solution

  • You can use process.env.DEBUG to get DEBUG's value.