Skip to content

Commit

Permalink
chore: update strip-ansi (#9158)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Nov 10, 2019
1 parent 4cbf972 commit 8cb768e
Show file tree
Hide file tree
Showing 11 changed files with 129 additions and 115 deletions.
2 changes: 1 addition & 1 deletion e2e/runJest.ts
Expand Up @@ -11,7 +11,7 @@ import * as fs from 'fs';
import {Writable} from 'stream';
import execa = require('execa');
import {FormattedTestResults} from '@jest/test-result';
import stripAnsi from 'strip-ansi';
import stripAnsi = require('strip-ansi');
import {normalizeIcons} from './Utils';

const JEST_PATH = path.resolve(__dirname, '../packages/jest-cli/bin/jest.js');
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
@@ -1,5 +1,5 @@
{
"lerna": "3.18.3",
"lerna": "3.18.4",
"version": "24.9.0",
"npmClient": "yarn",
"packages": [
Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -55,7 +55,7 @@
"karma-chrome-launcher": "^3.0.0",
"karma-mocha": "^1.3.0",
"karma-webpack": "^4.0.2",
"lerna": "3.18.3",
"lerna": "3.18.4",
"micromatch": "^4.0.2",
"mkdirp": "^0.5.1",
"mocha": "^6.0.2",
Expand All @@ -70,7 +70,7 @@
"rimraf": "^3.0.0",
"slash": "^3.0.0",
"string-length": "^3.1.0",
"strip-ansi": "^5.0.0",
"strip-ansi": "^6.0.0",
"typescript": "^3.7.2",
"webpack": "^4.28.4",
"which": "^2.0.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-core/package.json
Expand Up @@ -32,7 +32,7 @@
"realpath-native": "^1.1.0",
"rimraf": "^3.0.0",
"slash": "^3.0.0",
"strip-ansi": "^5.0.0"
"strip-ansi": "^6.0.0"
},
"devDependencies": {
"@jest/test-sequencer": "^24.9.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-core/src/collectHandles.ts
Expand Up @@ -8,7 +8,7 @@
import {Config} from '@jest/types';
import {formatExecError} from 'jest-message-util';
import {ErrorWithStack} from 'jest-util';
import stripAnsi from 'strip-ansi';
import stripAnsi = require('strip-ansi');

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

Expand Down
2 changes: 1 addition & 1 deletion packages/jest-diff/package.json
Expand Up @@ -16,7 +16,7 @@
"pretty-format": "^24.9.0"
},
"devDependencies": {
"strip-ansi": "^5.0.0"
"strip-ansi": "^6.0.0"
},
"engines": {
"node": ">= 8"
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-diff/src/__tests__/diff.test.ts
Expand Up @@ -6,7 +6,7 @@
*/

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

import diff from '../';
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-reporters/package.json
Expand Up @@ -37,7 +37,7 @@
"@types/istanbul-lib-source-maps": "^1.2.1",
"@types/istanbul-reports": "^1.1.0",
"@types/node-notifier": "^5.4.0",
"strip-ansi": "^5.0.0"
"strip-ansi": "^6.0.0"
},
"optionalDependencies": {
"node-notifier": "^6.0.0"
Expand Down
Expand Up @@ -5,10 +5,11 @@
* LICENSE file in the root directory of this source tree.
*/

import path from 'path';
import chalk from 'chalk';
import stripAnsi from 'strip-ansi';
import * as path from 'path';
import chalk = require('chalk');
import stripAnsi = require('strip-ansi');
import {printDisplayName, trimAndFormatPath, wrapAnsiString} from '../utils';
import {makeProjectConfig} from '../../../../TestUtils';

describe('wrapAnsiString()', () => {
it('wraps a long string containing ansi chars', () => {
Expand Down Expand Up @@ -37,7 +38,7 @@ describe('trimAndFormatPath()', () => {
const columns = 25;
const result = trimAndFormatPath(
pad,
{rootDir: ''},
makeProjectConfig({cwd: '', rootDir: ''}),
path.join(dirname, basename),
columns,
);
Expand All @@ -53,7 +54,7 @@ describe('trimAndFormatPath()', () => {
const columns = 30;
const result = trimAndFormatPath(
pad,
{rootDir: ''},
makeProjectConfig({cwd: '', rootDir: ''}),
path.join(dirname, basename),
columns,
);
Expand All @@ -69,7 +70,7 @@ describe('trimAndFormatPath()', () => {
const columns = 15;
const result = trimAndFormatPath(
pad,
{rootDir: ''},
makeProjectConfig({cwd: '', rootDir: ''}),
path.join(dirname, basename),
columns,
);
Expand All @@ -86,7 +87,7 @@ describe('trimAndFormatPath()', () => {
const totalLength = basename.length + path.sep.length + dirname.length;
const result = trimAndFormatPath(
pad,
{rootDir: ''},
makeProjectConfig({cwd: '', rootDir: ''}),
path.join(dirname, basename),
columns,
);
Expand All @@ -102,7 +103,7 @@ describe('trimAndFormatPath()', () => {
const columns = 16;
const result = trimAndFormatPath(
pad,
{rootDir: ''},
makeProjectConfig({cwd: '', rootDir: ''}),
path.join(dirname, basename),
columns,
);
Expand All @@ -114,32 +115,38 @@ describe('trimAndFormatPath()', () => {

describe('printDisplayName', () => {
it('should default displayName color to white when displayName is a string', () => {
const config = {
displayName: 'hello',
};

expect(printDisplayName(config)).toMatchSnapshot();
expect(
printDisplayName(
makeProjectConfig({
displayName: 'hello',
}),
),
).toMatchSnapshot();
});

it('should default displayName color to white when color is not a valid value', () => {
const config = {
displayName: {
color: 'rubbish',
name: 'hello',
},
};

expect(printDisplayName(config)).toMatchSnapshot();
expect(
printDisplayName(
makeProjectConfig({
displayName: {
color: 'rubbish' as any,
name: 'hello',
},
}),
),
).toMatchSnapshot();
});

it('should correctly print the displayName when color and name are valid values', () => {
const config = {
displayName: {
color: 'green',
name: 'hello',
},
};

expect(printDisplayName(config)).toMatchSnapshot();
expect(
printDisplayName(
makeProjectConfig({
displayName: {
color: 'green',
name: 'hello',
},
}),
),
).toMatchSnapshot();
});
});

0 comments on commit 8cb768e

Please sign in to comment.