{"id":11098,"library":"is-ci","title":"Detect CI Environment","description":"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.","status":"active","version":"4.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/watson/is-ci","tags":["javascript","ci","continuous","integration","test","detect","typescript"],"install":[{"cmd":"npm install is-ci","lang":"bash","label":"npm"},{"cmd":"yarn add is-ci","lang":"bash","label":"yarn"},{"cmd":"pnpm add is-ci","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core 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.","package":"ci-info","optional":false}],"imports":[{"note":"The `is-ci` package exports a boolean value directly as its default export. Named import is incorrect.","wrong":"import { isCI } from 'is-ci';","symbol":"isCI","correct":"import isCI from 'is-ci';"},{"note":"Standard CommonJS import pattern. The `package.json` specifies `\"type\": \"commonjs\"`.","symbol":"isCI","correct":"const isCI = require('is-ci');"},{"note":"Since v4.1.0, types are exported. The boolean value `isCI` will be correctly inferred as `boolean`.","symbol":"isCI (TypeScript)","correct":"import isCI from 'is-ci';"}],"quickstart":{"code":"import isCI from 'is-ci';\n\nconsole.log(`Checking CI status (ESM):`);\nif (isCI) {\n  console.log('  This code is running on a CI server.');\n} else {\n  console.log('  This code is NOT running on a CI server.');\n}\n\n// For CommonJS environments:\n/*\nconst isCI_cjs = require('is-ci');\nconsole.log(`\\nChecking CI status (CJS):`);\nif (isCI_cjs) {\n  console.log('  This CJS code is running on a CI server.');\n} else {\n  console.log('  This CJS code is NOT running on a CI server.');\n}\n*/\n\n// Example of conditional logic based on CI detection\nif (isCI && process.env.NODE_ENV === 'production') {\n  console.log('\\nRunning production build steps on CI...');\n} else if (!isCI && process.env.NODE_ENV === 'development') {\n  console.log('\\nRunning local development tasks...');\n}","lang":"typescript","description":"Demonstrates how to import and use `is-ci` in both ESM and CJS contexts to conditionally execute code based on CI environment detection."},"warnings":[{"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.","message":"Version 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.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Always use `isCI` directly as a boolean expression, e.g., `if (isCI) { ... }`.","message":"The `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.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Use `isCI` directly as a boolean. Correct: `if (isCI) { ... }`. Incorrect: `if (isCI()) { ... }`.","cause":"Attempting to invoke the `isCI` boolean as if it were a function.","error":"TypeError: isCI is not a function"},{"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.","cause":"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.","error":"ReferenceError: require is not defined in ES module scope"}],"ecosystem":"npm"}