Skip to content

Commit

Permalink
chore: remove is-ci in favor of ci-info (#11973)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrazauskas authored Oct 18, 2021
1 parent 9d737d7 commit e7edb75
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 39 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

### Chore & Maintenance

- `[jest-config, jest-util]` Use `ci-info` instead of `is-ci` to detect CI environment ([11973](https://github.com/facebook/jest/pull/11973))

### Performance

## 27.3.0
Expand Down
3 changes: 1 addition & 2 deletions packages/jest-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
"@jest/types": "^27.2.5",
"babel-jest": "^27.3.0",
"chalk": "^4.0.0",
"ci-info": "^3.2.0",
"deepmerge": "^4.2.2",
"glob": "^7.1.1",
"graceful-fs": "^4.2.4",
"is-ci": "^3.0.0",
"jest-circus": "^27.3.0",
"jest-environment-jsdom": "^27.3.0",
"jest-environment-node": "^27.3.0",
Expand All @@ -48,7 +48,6 @@
"@types/babel__core": "^7.0.4",
"@types/glob": "^7.1.1",
"@types/graceful-fs": "^4.1.3",
"@types/is-ci": "^3.0.0",
"@types/micromatch": "^4.0.1",
"jest-snapshot-serializer-raw": "^1.1.0",
"semver": "^7.3.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-config/src/Defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import {sep} from 'path';
import isCI = require('is-ci');
import {isCI} from 'ci-info';
import type {Config} from '@jest/types';
import {replacePathSepForRegex} from 'jest-regex-util';
import {NODE_MODULES} from './constants';
Expand Down
3 changes: 1 addition & 2 deletions packages/jest-util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@
"@jest/types": "^27.2.5",
"@types/node": "*",
"chalk": "^4.0.0",
"ci-info": "^3.2.0",
"graceful-fs": "^4.2.4",
"is-ci": "^3.0.0",
"picomatch": "^2.2.3"
},
"devDependencies": {
"@types/graceful-fs": "^4.1.2",
"@types/is-ci": "^3.0.0",
"@types/micromatch": "^4.0.1",
"@types/picomatch": "^2.2.2"
},
Expand Down
16 changes: 8 additions & 8 deletions packages/jest-util/src/__tests__/isInteractive.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ afterEach(() => {
});

it('Returns true when running on interactive environment', () => {
jest.doMock('is-ci', () => false);
jest.doMock('ci-info', () => ({isCI: false}));
process.stdout.isTTY = true;
process.env.TERM = 'xterm-256color';

Expand All @@ -32,32 +32,32 @@ it('Returns false when running on a non-interactive environment', () => {
let isInteractive;
const expectedResult = false;

// Test with is-ci being true and isTTY false
jest.doMock('is-ci', () => true);
// Test with isCI being true and isTTY false
jest.doMock('ci-info', () => ({isCI: true}));
process.stdout.isTTY = undefined;
process.env.TERM = 'xterm-256color';
isInteractive = require('../isInteractive').default;
expect(isInteractive).toBe(expectedResult);

// Test with is-ci being false and isTTY false
// Test with isCI being false and isTTY false
jest.resetModules();
jest.doMock('is-ci', () => false);
jest.doMock('ci-info', () => ({isCI: false}));
process.stdout.isTTY = undefined;
process.env.TERM = 'xterm-256color';
isInteractive = require('../isInteractive').default;
expect(isInteractive).toBe(expectedResult);

// Test with is-ci being true and isTTY true
// Test with isCI being true and isTTY true
jest.resetModules();
jest.doMock('is-ci', () => true);
jest.doMock('ci-info', () => ({isCI: true}));
process.stdout.isTTY = true;
process.env.TERM = 'xterm-256color';
isInteractive = require('../isInteractive').default;
expect(isInteractive).toBe(expectedResult);

// Test with dumb terminal
jest.resetModules();
jest.doMock('is-ci', () => false);
jest.doMock('ci-info', () => ({isCI: false}));
process.stdout.isTTY = undefined;
process.env.TERM = 'dumb';
isInteractive = require('../isInteractive').default;
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-util/src/isInteractive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

import isCI = require('is-ci');
import {isCI} from 'ci-info';

export default !!process.stdout.isTTY && process.env.TERM !== 'dumb' && !isCI;
28 changes: 3 additions & 25 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4552,15 +4552,6 @@ __metadata:
languageName: node
linkType: hard

"@types/is-ci@npm:^3.0.0":
version: 3.0.0
resolution: "@types/is-ci@npm:3.0.0"
dependencies:
ci-info: ^3.1.0
checksum: 661e9cc9ba61e1c283f3814fbb1355aca70b281b5d71def665348f8e17db1fbdf5e62db496b0c2ab7b913e49ad626faa28478c06b9fecf70f860f4386469973f
languageName: node
linkType: hard

"@types/istanbul-lib-coverage@npm:*, @types/istanbul-lib-coverage@npm:^2.0.0, @types/istanbul-lib-coverage@npm:^2.0.1":
version: 2.0.3
resolution: "@types/istanbul-lib-coverage@npm:2.0.3"
Expand Down Expand Up @@ -7089,7 +7080,7 @@ __metadata:
languageName: node
linkType: hard

"ci-info@npm:^3.0.0, ci-info@npm:^3.1.0, ci-info@npm:^3.1.1":
"ci-info@npm:^3.0.0, ci-info@npm:^3.2.0":
version: 3.2.0
resolution: "ci-info@npm:3.2.0"
checksum: d4a898d60111d00f2b7a06a349162971fe0603aefa208fe8d1343ce9e93c48e3d37311c47211d5c9040d25b43038c817588e5b7d8eab5d17b00aec49c7b5fade
Expand Down Expand Up @@ -11989,17 +11980,6 @@ fsevents@^1.2.7:
languageName: node
linkType: hard

"is-ci@npm:^3.0.0":
version: 3.0.0
resolution: "is-ci@npm:3.0.0"
dependencies:
ci-info: ^3.1.1
bin:
is-ci: bin.js
checksum: 1e26d3ba6634ebee83f9d22f260354c5d950eada4d609c30cc2642069f8ba52f3aeb4c9bbf8099aaf04a2f44a1ed7beef2a24485f988753c8c078a57e9b3a2fd
languageName: node
linkType: hard

"is-core-module@npm:^2.2.0, is-core-module@npm:^2.5.0, is-core-module@npm:^2.6.0":
version: 2.7.0
resolution: "is-core-module@npm:2.7.0"
Expand Down Expand Up @@ -12657,14 +12637,13 @@ fsevents@^1.2.7:
"@types/babel__core": ^7.0.4
"@types/glob": ^7.1.1
"@types/graceful-fs": ^4.1.3
"@types/is-ci": ^3.0.0
"@types/micromatch": ^4.0.1
babel-jest: ^27.3.0
chalk: ^4.0.0
ci-info: ^3.2.0
deepmerge: ^4.2.2
glob: ^7.1.1
graceful-fs: ^4.2.4
is-ci: ^3.0.0
jest-circus: ^27.3.0
jest-environment-jsdom: ^27.3.0
jest-environment-node: ^27.3.0
Expand Down Expand Up @@ -13199,13 +13178,12 @@ fsevents@^1.2.7:
dependencies:
"@jest/types": ^27.2.5
"@types/graceful-fs": ^4.1.2
"@types/is-ci": ^3.0.0
"@types/micromatch": ^4.0.1
"@types/node": "*"
"@types/picomatch": ^2.2.2
chalk: ^4.0.0
ci-info: ^3.2.0
graceful-fs: ^4.2.4
is-ci: ^3.0.0
picomatch: ^2.2.3
languageName: unknown
linkType: soft
Expand Down

0 comments on commit e7edb75

Please sign in to comment.