Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 481aab1

Browse files
lidelhugomrdias
authored andcommitted
feat: env/isTest (#10)
Adds check to tell if runtime is part of tests License: MIT Signed-off-by: Marcin Rataj <[email protected]>
1 parent ad1a7a9 commit 481aab1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/env.js

+2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ const IS_ELECTRON_RENDERER = IS_ELECTRON && IS_ENV_WITH_DOM
88
const IS_NODE = typeof require === 'function' && typeof process !== 'undefined' && typeof process.release !== 'undefined' && process.release.name === 'node' && !IS_ELECTRON
99
// eslint-disable-next-line no-undef
1010
const IS_WEBWORKER = typeof importScripts === 'function' && typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope
11+
const IS_TEST = typeof process !== 'undefined' && typeof process.env !== 'undefined' && process.env.NODE_ENV === 'test'
1112

1213
module.exports = {
14+
isTest: IS_TEST,
1315
isElectron: IS_ELECTRON,
1416
isElectronRenderer: IS_ELECTRON_RENDERER,
1517
isNode: IS_NODE,

0 commit comments

Comments
 (0)