From 41cba2e77be27d1f7aaf3941e92b1a8cf317e6b8 Mon Sep 17 00:00:00 2001 From: Sebastian Markbage Date: Wed, 30 Sep 2015 17:43:06 -0700 Subject: [PATCH] Enforce NODE_ENV=test You could make the argument that this should be optional, but it doesn't work without it so we might as well just enforce it. Makes `jest` work by default. --- package.json | 2 +- scripts/jest/preprocessor.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index bbbbf7d670..1cf55fb991 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "linc": "git diff --name-only --diff-filter=ACMRTUB `git merge-base HEAD master` | grep '\\.js$' | xargs eslint --", "lint": "grunt lint", "postinstall": "node node_modules/fbjs-scripts/node/check-dev-engines.js package.json", - "test": "NODE_ENV=test jest" + "test": "jest" }, "jest": { "modulePathIgnorePatterns": [ diff --git a/scripts/jest/preprocessor.js b/scripts/jest/preprocessor.js index eb99ebea80..7c77922e56 100644 --- a/scripts/jest/preprocessor.js +++ b/scripts/jest/preprocessor.js @@ -1,5 +1,9 @@ 'use strict'; +// React's test can only work in NODE_ENV=test because of how things +// are set up. So we might as well enforce it. +process.env.NODE_ENV = 'test'; + var path = require('path'); var assign = require('object-assign');