e68e36f26b
is-in-ci feeds the `interactive` default (render.ts:503) and shouldSynchronize (write-synchronized.ts:9). vue pinned ^1.0.0 vs Ink's ^2.0.0, whose CI-detection formula differs: v1 scans for any `CI_*`-prefixed var and gates the whole expression on CI not being falsy; v2 independently checks `CI` and `CONTINUOUS_INTEGRATION` and drops the prefix scan. The common cases (local CI=false, GitHub CI=true) are identical on both, so the suite and CI are unaffected; only edge env configs diverge. Bumping to ^2.0.0 makes vue's CI detection byte-identical to Ink's. Locked by a test (CI=false + CONTINUOUS_INTEGRATION=true → true, which v1 would report false). Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
30 lines
1.5 KiB
TypeScript
30 lines
1.5 KiB
TypeScript
// SEQUENTIAL: mutates process.env (vi.stubEnv) + vi.resetModules to re-evaluate the
|
|
// import-time `is-in-ci` module — both are process-global, so this must not run
|
|
// concurrently with other tests that read env or the module cache.
|
|
import { afterEach, expect, test, vi } from "vite-plus/test";
|
|
|
|
afterEach(() => {
|
|
vi.unstubAllEnvs();
|
|
vi.resetModules();
|
|
});
|
|
|
|
// vue-tui pins is-in-ci to ^2.0.0 to match Ink (Ink package.json), aligning the
|
|
// CI-detection formula that feeds the `interactive` default (render.ts:503) and
|
|
// shouldSynchronize (write-synchronized.ts:9). v1 and v2 diverge on edge env configs;
|
|
// this locks that we resolve v2's formula.
|
|
//
|
|
// v2: `check(k) = k in env && env[k] !== '0' && env[k] !== 'false'`, then
|
|
// `isInCi = check('CI') || check('CONTINUOUS_INTEGRATION')` — the two checks are
|
|
// INDEPENDENT (and there is no `CI_*`-prefix scan, which v1 had).
|
|
// v1: gated the WHOLE expression on `env.CI !== '0' && env.CI !== 'false'`, so a
|
|
// falsy CI short-circuited the CONTINUOUS_INTEGRATION branch too.
|
|
test("is-in-ci resolves Ink's v2 formula: CI=false + CONTINUOUS_INTEGRATION=true → true", async () => {
|
|
vi.resetModules();
|
|
vi.stubEnv("CI", "false");
|
|
vi.stubEnv("CONTINUOUS_INTEGRATION", "true");
|
|
const { default: isInCi } = await import("is-in-ci");
|
|
// v2: check('CI') is false (CI==='false'), check('CONTINUOUS_INTEGRATION') is true → true.
|
|
// v1 would be FALSE here — its `env.CI !== 'false'` guard short-circuits the whole thing.
|
|
expect(isInCi).toBe(true);
|
|
});
|