Registry / devops / is-ci
library4.1.0jsnpmunverified

The `is-ci` package provides a minimalist, direct method for determining whether the current process is executing within a Continuous Integration (CI) environment. It exposes a simple boolean value (`true` if running in CI, `false` otherwise), abstracting away the complexities of checking various environment variables across different CI providers. The current stable version is `4.1.0`. The library typically sees updates in conjunction with its underlying dependency, `ci-info`, which is responsible for the core detection logic, leading to an irregular but feature-driven release cadence. Its primary differentiator is its singular focus on providing a simple boolean answer, making it ideal for conditional logic in build scripts, test runners, or deployment pipelines where CI context is crucial. It supports a wide array of CI services by leveraging `ci-info`'s comprehensive detection capabilities.

npm install is-ci
INSTALL
IMPORT
SIG · IS-CI
I
is-ci
devopsjavascriptv4.1.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

isCI
import isCI from 'is-ci';
import { isCI } from 'is-ci';
The `is-ci` package exports a boolean value directly as its default export. Named import is incorrect.
isCI
const isCI = require('is-ci');
Standard CommonJS import pattern. The `package.json` specifies `"type": "commonjs"`.
isCI (TypeScript)
import isCI from 'is-ci';
Since v4.1.0, types are exported. The boolean value `isCI` will be correctly inferred as `boolean`.

Demonstrates how to import and use `is-ci` in both ESM and CJS contexts to conditionally execute code based on CI environment detection.

import isCI from 'is-ci'; console.log(`Checking CI status (ESM):`); if (isCI) { console.log(' This code is running on a CI server.'); } else { console.log(' This code is NOT running on a CI server.'); } // For CommonJS environments: /* const isCI_cjs = require('is-ci'); console.log(`\nChecking CI status (CJS):`); if (isCI_cjs) { console.log(' This CJS code is running on a CI server.'); } else { console.log(' This CJS code is NOT running on a CI server.'); } */ // Example of conditional logic based on CI detection if (isCI && process.env.NODE_ENV === 'production') { console.log('\nRunning production build steps on CI...'); } else if (!isCI && process.env.NODE_ENV === 'development') { console.log('\nRunning local development tasks...'); }
Debug
Known issues
breakingVersion 4.0.0 of `is-ci` updated its underlying `ci-info` dependency to v4.0.0, which introduced breaking changes by removing support for certain CI services. Specifically, detection for 'Shippable CI' and 'Solano CI' (formerly 'TDDium') was removed.
fix
If your workflows rely on detecting Shippable CI or Solano CI, `is-ci` will no longer identify them. You may need to update your CI configuration or use alternative detection methods for these specific platforms, or consider migrating to a currently supported CI service.
affects: >=4.0.0
gotchaThe `is-ci` package exports a simple boolean value, not a function or an object with properties. Attempting to call it as a function (`isCI()`) or access properties on it (`isCI.value`) will result in errors.
fix
Always use `isCI` directly as a boolean expression, e.g., `if (isCI) { ... }`.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: isCI is not a function
Attempting to invoke the `isCI` boolean as if it were a function.
fix
Use `isCI` directly as a boolean. Correct: `if (isCI) { ... }`. Incorrect: `if (isCI()) { ... }`.
ReferenceError: require is not defined in ES module scope
Using `require('is-ci')` in an ES Module context (e.g., in a `.mjs` file or a project with `"type": "module"` in `package.json`) without proper transpilation.
fix
For ES Modules, use `import isCI from 'is-ci';`. If you must use CommonJS modules, ensure your file is `.js` and your `package.json` does not specify `"type": "module"`, or use a bundler/transpiler configured for CommonJS.
Upgrade
Version history
4.1.0latest on npm
Audit
Dependencies
ci-inforequiredCore dependency providing the underlying CI detection logic and information. Changes in `ci-info` directly impact `is-ci`'s behavior, including breaking changes in detected CI platforms.
Agent activity
7 hits · last 30 days
node
6
Amazon
1
Resources
is-ci — npm install is-ci · libregistry