Skip to content

Commit

Permalink
feat: env/isTest (#10)
Browse files Browse the repository at this point in the history
Adds check to tell if runtime is part of tests

License: MIT
Signed-off-by: Marcin Rataj <lidel@lidel.org>
  • Loading branch information
lidel authored and hugomrdias committed Sep 6, 2019
1 parent ad1a7a9 commit 481aab1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ const IS_ELECTRON_RENDERER = IS_ELECTRON && IS_ENV_WITH_DOM
const IS_NODE = typeof require === 'function' && typeof process !== 'undefined' && typeof process.release !== 'undefined' && process.release.name === 'node' && !IS_ELECTRON
// eslint-disable-next-line no-undef
const IS_WEBWORKER = typeof importScripts === 'function' && typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope
const IS_TEST = typeof process !== 'undefined' && typeof process.env !== 'undefined' && process.env.NODE_ENV === 'test'

module.exports = {
isTest: IS_TEST,
isElectron: IS_ELECTRON,
isElectronRenderer: IS_ELECTRON_RENDERER,
isNode: IS_NODE,
Expand Down

0 comments on commit 481aab1

Please sign in to comment.