Skip to content
This repository has been archived by the owner on May 17, 2019. It is now read-only.

Commit

Permalink
Add __DEV__ to jest environment
Browse files Browse the repository at this point in the history
Fixes #90
  • Loading branch information
KevinGrandon committed Dec 23, 2017
1 parent 34c5064 commit 7fb3fba
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions build/jest-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module.exports = {
globals: {
__NODE__: process.env.JEST_ENV === 'node',
__BROWSER__: process.env.JEST_ENV === 'jsdom',
__DEV__: process.env.NODE_ENV !== 'production',
},
rootDir: process.cwd(),
setupFiles: [
Expand Down
11 changes: 11 additions & 0 deletions test/cli/test-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,14 @@ test('`fusion test-app` coverage', async t => {
t.ok(response.stdout.includes('Uncovered Lines'));
t.end();
});

test.only('`fusion test-app` environment variables', async t => {
const dir = path.resolve(__dirname, '../fixtures/test-jest-app');
const args = `test-app --dir=${dir} --configPath=../../../build/jest-config.js --coverage --match=environment-variables`;

const cmd = `require('${runnerPath}').run('${args}')`;
const response = await exec(`node -e "${cmd}"`);
t.equal(countTests(response.stderr), 2, 'ran 2 tests');

t.end();
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import {test} from 'fusion-test-utils';

test('__DEV__ environment variable is set', assert => {
assert.equal(__DEV__, true);
});

0 comments on commit 7fb3fba

Please sign in to comment.