Skip to content

Commit 7998905

Browse files
authored
refactor: use util.stripVTControlCharacters() instead of strip-ansi (#15627)
1 parent 4953d81 commit 7998905

File tree

13 files changed

+8
-23
lines changed

13 files changed

+8
-23
lines changed

e2e/__tests__/runProgrammaticallyMultipleProjects.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
import {resolve} from 'path';
9-
import stripAnsi = require('strip-ansi');
9+
import {stripVTControlCharacters as stripAnsi} from 'util';
1010
import {extractSummary, run} from '../Utils';
1111

1212
const dir = resolve(__dirname, '../run-programmatically-multiple-projects');

e2e/runJest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88

99
import * as path from 'path';
1010
import {Writable} from 'stream';
11+
import {stripVTControlCharacters as stripAnsi} from 'util';
1112
import dedent from 'dedent';
1213
import execa = require('execa');
1314
import * as fs from 'graceful-fs';
14-
import stripAnsi = require('strip-ansi');
1515
import {TestPathPatterns} from '@jest/pattern';
1616
import type {FormattedTestResults} from '@jest/test-result';
1717
import {normalizeIcons} from '@jest/test-utils';

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@
7474
"rimraf": "^5.0.10",
7575
"semver": "^7.7.2",
7676
"slash": "^3.0.0",
77-
"strip-ansi": "^6.0.1",
7877
"strip-json-comments": "^3.1.1",
7978
"tempy": "^1.0.1",
8079
"ts-node": "^10.5.0",

packages/jest-core/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@
4141
"jest-watcher": "workspace:*",
4242
"micromatch": "^4.0.8",
4343
"pretty-format": "workspace:*",
44-
"slash": "^3.0.0",
45-
"strip-ansi": "^6.0.1"
44+
"slash": "^3.0.0"
4645
},
4746
"devDependencies": {
4847
"@jest/test-sequencer": "workspace:*",

packages/jest-core/src/__tests__/watchFilenamePatternMode.test.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ jest.mock(
4848

4949
jest.doMock('chalk', () => new chalk.Instance({level: 0}));
5050

51-
jest.doMock('strip-ansi');
52-
require('strip-ansi').mockImplementation(str => str);
53-
5451
jest.doMock(
5552
'../runJest',
5653
() =>

packages/jest-core/src/__tests__/watchTestNamePatternMode.test.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ jest.mock(
2424

2525
jest.doMock('chalk', () => new chalk.Instance({level: 0}));
2626

27-
jest.doMock('strip-ansi');
28-
require('strip-ansi').mockImplementation(str => str);
29-
3027
jest.doMock(
3128
'../runJest',
3229
() =>

packages/jest-core/src/collectHandles.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66
*/
77

88
import * as asyncHooks from 'async_hooks';
9-
import {promisify} from 'util';
9+
import {promisify, stripVTControlCharacters as stripAnsi} from 'util';
1010
import * as v8 from 'v8';
1111
import * as vm from 'vm';
12-
import stripAnsi = require('strip-ansi');
1312
import type {Config} from '@jest/types';
1413
import {formatExecError} from 'jest-message-util';
1514
import {ErrorWithStack} from 'jest-util';

packages/jest-diff/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525
"pretty-format": "workspace:*"
2626
},
2727
"devDependencies": {
28-
"@jest/test-utils": "workspace:*",
29-
"strip-ansi": "^6.0.1"
28+
"@jest/test-utils": "workspace:*"
3029
},
3130
"engines": {
3231
"node": "^18.14.0 || ^20.0.0 || >=22.0.0"

packages/jest-diff/src/__tests__/diff.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8+
import {stripVTControlCharacters as stripAnsi} from 'util';
89
import chalk = require('chalk');
9-
import stripAnsi = require('strip-ansi');
1010
import {alignedAnsiStyleSerializer} from '@jest/test-utils';
1111
import {diff} from '../';
1212
import {NO_DIFF_MESSAGE} from '../constants';

packages/jest-reporters/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
"jest-worker": "workspace:*",
3737
"slash": "^3.0.0",
3838
"string-length": "^4.0.2",
39-
"strip-ansi": "^6.0.1",
4039
"v8-to-istanbul": "^9.0.1"
4140
},
4241
"devDependencies": {

0 commit comments

Comments
 (0)