Created
April 13, 2020 02:12
-
-
Save arabold/81ead1687423bb4ae86200ae3e779b82 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Returns `true` if running in a CI environment, e.g. during an automated build */ | |
static get isCI(): boolean { | |
if (!Logger.isNode) { | |
return false; | |
} | |
const { CI, CONTINUOUS_INTEGRATION, BUILD_NUMBER, RUN_ID } = process.env; | |
// Shamelessly stolen from https://github.com/watson/ci-info | |
return !!( | |
CI || // Travis CI, CircleCI, Cirrus CI, Gitlab CI, Appveyor, CodeShip, dsari | |
CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI | |
BUILD_NUMBER || // Jenkins, TeamCity | |
RUN_ID || // TaskCluster, dsari | |
false | |
); | |
} | |
/** Retruns `true` if running as part of a unit test */ | |
static get isUnitTest(): boolean { | |
if (!Logger.isNode) { | |
return false; | |
} | |
const { JEST_WORKER_ID } = process.env; | |
return !!(JEST_WORKER_ID || typeof global?.it === "function"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment