Repository: fgnass/node-dev (js)

Issue:
Don't set NODE_ENV
Hey @fgnass (and contributors), great ongoing work. We've been using node-dev for several years now and it's been awesome.

We just updated after a long time, and we hit the same issue with node-dev now setting `NODE_ENV` that @gasi did in https://github.com/fgnass/node-dev/issues/62#issuecomment-131992922.

It sounded like you agreed that node-dev should just not set `NODE_ENV` at all, since the caller who's calling `node-dev` can always set any environment variable they want. (Put another way, `NODE_ENV=development` doesn't tell you you're running in node-dev, so it's not serving that purpose. Instead, it's just assuming that code wants to set `NODE_ENV` by default, and to `development`.)

If that's still the case, I wanted to open this issue to capture this request. Would be great to have node-dev no longer set `NODE_ENV`! Thanks for your consideration. =)


Pull request description:
Do not set NODE_ENV to development when it is unset
Fixes #133

Patch:
diff --git a/lib/wrap.js b/lib/wrap.js
index 7a7ed91..e54c7a0 100755
--- a/lib/wrap.js
+++ b/lib/wrap.js
@@ -14,9 +14,6 @@ var main = resolveMain(process.argv[1]);
 
 var cfg = require('./cfg')(main);
 
-// Set NODE_ENV to 'development' unless already set
-if (!process.env.NODE_ENV) process.env.NODE_ENV = 'development';
-
 if (process.env.NODE_DEV_PRELOAD) {
   require(process.env.NODE_DEV_PRELOAD);
 }


Test patch:
diff --git a/test/spawn.js b/test/spawn.js
index 600b51a..7f75c7f 100644
--- a/test/spawn.js
+++ b/test/spawn.js
@@ -117,9 +117,9 @@ tap.test('should kill the forked processes', function (t) {
   });
 });
 
-tap.test('should set NODE_ENV', function (t) {
+tap.test('should *not* set NODE_ENV', function (t) {
   spawn('env.js', function (out) {
-    t.like(out, /development/);
+    t.notLike(out, /development/);
     return { exit: t.end.bind(t) };
   });
 });