Skip to content

Commit 8cb768e

Browse files
authored
chore: update strip-ansi (#9158)
1 parent 4cbf972 commit 8cb768e

File tree

11 files changed

+129
-115
lines changed

11 files changed

+129
-115
lines changed

e2e/runJest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import * as fs from 'fs';
1111
import {Writable} from 'stream';
1212
import execa = require('execa');
1313
import {FormattedTestResults} from '@jest/test-result';
14-
import stripAnsi from 'strip-ansi';
14+
import stripAnsi = require('strip-ansi');
1515
import {normalizeIcons} from './Utils';
1616

1717
const JEST_PATH = path.resolve(__dirname, '../packages/jest-cli/bin/jest.js');

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"lerna": "3.18.3",
2+
"lerna": "3.18.4",
33
"version": "24.9.0",
44
"npmClient": "yarn",
55
"packages": [

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"karma-chrome-launcher": "^3.0.0",
5656
"karma-mocha": "^1.3.0",
5757
"karma-webpack": "^4.0.2",
58-
"lerna": "3.18.3",
58+
"lerna": "3.18.4",
5959
"micromatch": "^4.0.2",
6060
"mkdirp": "^0.5.1",
6161
"mocha": "^6.0.2",
@@ -70,7 +70,7 @@
7070
"rimraf": "^3.0.0",
7171
"slash": "^3.0.0",
7272
"string-length": "^3.1.0",
73-
"strip-ansi": "^5.0.0",
73+
"strip-ansi": "^6.0.0",
7474
"typescript": "^3.7.2",
7575
"webpack": "^4.28.4",
7676
"which": "^2.0.1"

packages/jest-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"realpath-native": "^1.1.0",
3333
"rimraf": "^3.0.0",
3434
"slash": "^3.0.0",
35-
"strip-ansi": "^5.0.0"
35+
"strip-ansi": "^6.0.0"
3636
},
3737
"devDependencies": {
3838
"@jest/test-sequencer": "^24.9.0",

packages/jest-core/src/collectHandles.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import {Config} from '@jest/types';
99
import {formatExecError} from 'jest-message-util';
1010
import {ErrorWithStack} from 'jest-util';
11-
import stripAnsi from 'strip-ansi';
11+
import stripAnsi = require('strip-ansi');
1212

1313
type AsyncHook = import('async_hooks').AsyncHook;
1414

packages/jest-diff/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"pretty-format": "^24.9.0"
1717
},
1818
"devDependencies": {
19-
"strip-ansi": "^5.0.0"
19+
"strip-ansi": "^6.0.0"
2020
},
2121
"engines": {
2222
"node": ">= 8"

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

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

88
import chalk = require('chalk');
9-
import stripAnsi from 'strip-ansi';
9+
import stripAnsi = require('strip-ansi');
1010
import {alignedAnsiStyleSerializer} from '@jest/test-utils';
1111

1212
import diff from '../';

packages/jest-reporters/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"@types/istanbul-lib-source-maps": "^1.2.1",
3838
"@types/istanbul-reports": "^1.1.0",
3939
"@types/node-notifier": "^5.4.0",
40-
"strip-ansi": "^5.0.0"
40+
"strip-ansi": "^6.0.0"
4141
},
4242
"optionalDependencies": {
4343
"node-notifier": "^6.0.0"

packages/jest-reporters/src/__tests__/utils.test.js renamed to packages/jest-reporters/src/__tests__/utils.test.ts

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
import path from 'path';
9-
import chalk from 'chalk';
10-
import stripAnsi from 'strip-ansi';
8+
import * as path from 'path';
9+
import chalk = require('chalk');
10+
import stripAnsi = require('strip-ansi');
1111
import {printDisplayName, trimAndFormatPath, wrapAnsiString} from '../utils';
12+
import {makeProjectConfig} from '../../../../TestUtils';
1213

1314
describe('wrapAnsiString()', () => {
1415
it('wraps a long string containing ansi chars', () => {
@@ -37,7 +38,7 @@ describe('trimAndFormatPath()', () => {
3738
const columns = 25;
3839
const result = trimAndFormatPath(
3940
pad,
40-
{rootDir: ''},
41+
makeProjectConfig({cwd: '', rootDir: ''}),
4142
path.join(dirname, basename),
4243
columns,
4344
);
@@ -53,7 +54,7 @@ describe('trimAndFormatPath()', () => {
5354
const columns = 30;
5455
const result = trimAndFormatPath(
5556
pad,
56-
{rootDir: ''},
57+
makeProjectConfig({cwd: '', rootDir: ''}),
5758
path.join(dirname, basename),
5859
columns,
5960
);
@@ -69,7 +70,7 @@ describe('trimAndFormatPath()', () => {
6970
const columns = 15;
7071
const result = trimAndFormatPath(
7172
pad,
72-
{rootDir: ''},
73+
makeProjectConfig({cwd: '', rootDir: ''}),
7374
path.join(dirname, basename),
7475
columns,
7576
);
@@ -86,7 +87,7 @@ describe('trimAndFormatPath()', () => {
8687
const totalLength = basename.length + path.sep.length + dirname.length;
8788
const result = trimAndFormatPath(
8889
pad,
89-
{rootDir: ''},
90+
makeProjectConfig({cwd: '', rootDir: ''}),
9091
path.join(dirname, basename),
9192
columns,
9293
);
@@ -102,7 +103,7 @@ describe('trimAndFormatPath()', () => {
102103
const columns = 16;
103104
const result = trimAndFormatPath(
104105
pad,
105-
{rootDir: ''},
106+
makeProjectConfig({cwd: '', rootDir: ''}),
106107
path.join(dirname, basename),
107108
columns,
108109
);
@@ -114,32 +115,38 @@ describe('trimAndFormatPath()', () => {
114115

115116
describe('printDisplayName', () => {
116117
it('should default displayName color to white when displayName is a string', () => {
117-
const config = {
118-
displayName: 'hello',
119-
};
120-
121-
expect(printDisplayName(config)).toMatchSnapshot();
118+
expect(
119+
printDisplayName(
120+
makeProjectConfig({
121+
displayName: 'hello',
122+
}),
123+
),
124+
).toMatchSnapshot();
122125
});
123126

124127
it('should default displayName color to white when color is not a valid value', () => {
125-
const config = {
126-
displayName: {
127-
color: 'rubbish',
128-
name: 'hello',
129-
},
130-
};
131-
132-
expect(printDisplayName(config)).toMatchSnapshot();
128+
expect(
129+
printDisplayName(
130+
makeProjectConfig({
131+
displayName: {
132+
color: 'rubbish' as any,
133+
name: 'hello',
134+
},
135+
}),
136+
),
137+
).toMatchSnapshot();
133138
});
134139

135140
it('should correctly print the displayName when color and name are valid values', () => {
136-
const config = {
137-
displayName: {
138-
color: 'green',
139-
name: 'hello',
140-
},
141-
};
142-
143-
expect(printDisplayName(config)).toMatchSnapshot();
141+
expect(
142+
printDisplayName(
143+
makeProjectConfig({
144+
displayName: {
145+
color: 'green',
146+
name: 'hello',
147+
},
148+
}),
149+
),
150+
).toMatchSnapshot();
144151
});
145152
});

0 commit comments

Comments
 (0)