Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade chalk to v3 #9154

Merged
merged 4 commits into from Nov 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -24,7 +24,7 @@
"babel-plugin-replace-ts-export-assignment": "^0.0.2",
"babel-plugin-typescript-strip-namespaces": "^1.1.1",
"camelcase": "^5.0.0",
"chalk": "^2.0.1",
"chalk": "^3.0.0",
"codecov": "^3.0.0",
"debug": "^4.0.1",
"eslint": "^6.2.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-jest/package.json
Expand Up @@ -16,7 +16,7 @@
"@types/babel__core": "^7.1.0",
"babel-plugin-istanbul": "^5.1.0",
"babel-preset-jest": "^24.9.0",
"chalk": "^2.4.2",
"chalk": "^3.0.0",
"slash": "^3.0.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-jest/src/index.ts
Expand Up @@ -16,7 +16,7 @@ import {
transformSync as babelTransform,
loadPartialConfig,
} from '@babel/core';
import chalk from 'chalk';
import chalk = require('chalk');
import slash = require('slash');

const THIS_FILE = fs.readFileSync(__filename);
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-circus/package.json
Expand Up @@ -14,7 +14,7 @@
"@jest/environment": "^24.9.0",
"@jest/test-result": "^24.9.0",
"@jest/types": "^24.9.0",
"chalk": "^2.0.1",
"chalk": "^3.0.0",
"co": "^4.6.0",
"expect": "^24.9.0",
"is-generator-fn": "^2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-circus/src/formatNodeAssertErrors.ts
Expand Up @@ -13,7 +13,7 @@ import {
printExpected,
printReceived,
} from 'jest-matcher-utils';
import chalk from 'chalk';
import chalk = require('chalk');
import prettyFormat = require('pretty-format');

interface AssertionErrorWithStack extends AssertionError {
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-circus/src/index.ts
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import chalk from 'chalk';
import chalk = require('chalk');
import {bind as bindEach} from 'jest-each';
import {formatExecError} from 'jest-message-util';
import {ErrorWithStack, isPromise} from 'jest-util';
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-cli/package.json
Expand Up @@ -8,7 +8,7 @@
"@jest/core": "^24.9.0",
"@jest/test-result": "^24.9.0",
"@jest/types": "^24.9.0",
"chalk": "^2.0.1",
"chalk": "^3.0.0",
"exit": "^0.1.2",
"import-local": "^3.0.2",
"is-ci": "^2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-cli/src/cli/index.ts
Expand Up @@ -12,7 +12,7 @@ import {clearLine} from 'jest-util';
import {validateCLIOptions} from 'jest-validate';
import {deprecationEntries} from 'jest-config';
import {getVersion, runCLI} from '@jest/core';
import chalk from 'chalk';
import chalk = require('chalk');
import exit = require('exit');
import yargs = require('yargs');
import {sync as realpath} from 'realpath-native';
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-cli/src/init/index.ts
Expand Up @@ -7,7 +7,7 @@

import * as fs from 'fs';
import * as path from 'path';
import chalk from 'chalk';
import chalk = require('chalk');
import prompts = require('prompts');
import {sync as realpath} from 'realpath-native';
import defaultQuestions, {testScriptQuestion} from './questions';
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-config/package.json
Expand Up @@ -14,7 +14,7 @@
"@jest/test-sequencer": "^24.9.0",
"@jest/types": "^24.9.0",
"babel-jest": "^24.9.0",
"chalk": "^2.0.1",
"chalk": "^3.0.0",
"glob": "^7.1.1",
"jest-environment-jsdom": "^24.9.0",
"jest-environment-node": "^24.9.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-config/src/Deprecated.ts
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import chalk from 'chalk';
import chalk = require('chalk');
import prettyFormat = require('pretty-format');

const format = (value: unknown) => prettyFormat(value, {min: true});
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-config/src/ReporterValidationErrors.ts
Expand Up @@ -7,7 +7,7 @@

import {Config} from '@jest/types';
import {ValidationError} from 'jest-validate';
import chalk from 'chalk';
import chalk = require('chalk');
import getType = require('jest-get-type');
import {BULLET, DOCUMENTATION_NOTE} from './utils';

Expand Down
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Upgrade help logs a warning when \`scriptPreprocessor\` and/or \`preprocessorIgnorePatterns\` are used 1`] = `
"<yellow><bold><bold>●<bold> Deprecation Warning</>:</>
"<yellow><bold><bold>●</><bold> Deprecation Warning</>:</>
<yellow></>
<yellow> Option <bold>\\"preprocessorIgnorePatterns\\"</> was replaced by <bold>\\"transformIgnorePatterns\\"</>, which support multiple preprocessors.</>
<yellow></>
Expand All @@ -28,7 +28,7 @@ exports[`displayName generates a default color for the runner jest-runner-tslint
exports[`displayName generates a default color for the runner undefined 1`] = `"white"`;

exports[`displayName should throw an error when displayName is is an empty object 1`] = `
"<red><bold><bold>● <bold>Validation Error</>:</>
"<red><bold><bold>● </><bold>Validation Error</>:</>
<red></>
<red> Option \\"<bold>displayName</>\\" must be of type:</>
<red></>
Expand All @@ -44,7 +44,7 @@ exports[`displayName should throw an error when displayName is is an empty objec
`;

exports[`displayName should throw an error when displayName is missing color 1`] = `
"<red><bold><bold>● <bold>Validation Error</>:</>
"<red><bold><bold>● </><bold>Validation Error</>:</>
<red></>
<red> Option \\"<bold>displayName</>\\" must be of type:</>
<red></>
Expand All @@ -60,7 +60,7 @@ exports[`displayName should throw an error when displayName is missing color 1`]
`;

exports[`displayName should throw an error when displayName is missing name 1`] = `
"<red><bold><bold>● <bold>Validation Error</>:</>
"<red><bold><bold>● </><bold>Validation Error</>:</>
<red></>
<red> Option \\"<bold>displayName</>\\" must be of type:</>
<red></>
Expand All @@ -76,7 +76,7 @@ exports[`displayName should throw an error when displayName is missing name 1`]
`;

exports[`displayName should throw an error when displayName is using invalid values 1`] = `
"<red><bold><bold>● <bold>Validation Error</>:</>
"<red><bold><bold>● </><bold>Validation Error</>:</>
<red></>
<red> Option \\"<bold>displayName</>\\" must be of type:</>
<red></>
Expand All @@ -92,7 +92,7 @@ exports[`displayName should throw an error when displayName is using invalid val
`;

exports[`preset throws when module was found but no "jest-preset.js" or "jest-preset.json" files 1`] = `
"<red><bold><bold>● <bold>Validation Error</>:</>
"<red><bold><bold>● </><bold>Validation Error</>:</>
<red></>
<red> Module <bold>exist-but-no-jest-preset</> should have \\"jest-preset.js\\" or \\"jest-preset.json\\" file at the root.</>
<red></>
Expand All @@ -102,7 +102,7 @@ exports[`preset throws when module was found but no "jest-preset.js" or "jest-pr
`;

exports[`preset throws when preset not found 1`] = `
"<red><bold><bold>● <bold>Validation Error</>:</>
"<red><bold><bold>● </><bold>Validation Error</>:</>
<red></>
<red> Preset <bold>doesnt-exist</> not found.</>
<red></>
Expand All @@ -112,7 +112,7 @@ exports[`preset throws when preset not found 1`] = `
`;

exports[`rootDir throws if the options is missing a rootDir property 1`] = `
"<red><bold><bold>● <bold>Validation Error</>:</>
"<red><bold><bold>● </><bold>Validation Error</>:</>
<red></>
<red> Configuration option <bold>rootDir</> must be specified.</>
<red></>
Expand All @@ -122,7 +122,7 @@ exports[`rootDir throws if the options is missing a rootDir property 1`] = `
`;

exports[`runner throw error when a runner is not found 1`] = `
"<red><bold><bold>● <bold>Validation Error</>:</>
"<red><bold><bold>● </><bold>Validation Error</>:</>
<red></>
<red> Jest Runner <bold>missing-runner</> cannot be found. Make sure the <bold>runner</> configuration option points to an existing node module.</>
<red></>
Expand All @@ -132,7 +132,7 @@ exports[`runner throw error when a runner is not found 1`] = `
`;

exports[`setupTestFrameworkScriptFile logs a deprecation warning when \`setupTestFrameworkScriptFile\` is used 1`] = `
"<yellow><bold><bold>●<bold> Deprecation Warning</>:</>
"<yellow><bold><bold>●</><bold> Deprecation Warning</>:</>
<yellow></>
<yellow> Option <bold>\\"setupTestFrameworkScriptFile\\"</> was replaced by configuration <bold>\\"setupFilesAfterEnv\\"</>, which supports multiple paths.</>
<yellow></>
Expand All @@ -144,7 +144,7 @@ exports[`setupTestFrameworkScriptFile logs a deprecation warning when \`setupTes
`;

exports[`setupTestFrameworkScriptFile logs an error when \`setupTestFrameworkScriptFile\` and \`setupFilesAfterEnv\` are used 1`] = `
"<red><bold><bold>● <bold>Validation Error</>:</>
"<red><bold><bold>● </><bold>Validation Error</>:</>
<red></>
<red> Options: <bold>setupTestFrameworkScriptFile</> and <bold>setupFilesAfterEnv</> cannot be used together.</>
<red> Please change your configuration to only use <bold>setupFilesAfterEnv</>.</>
Expand All @@ -155,7 +155,7 @@ exports[`setupTestFrameworkScriptFile logs an error when \`setupTestFrameworkScr
`;

exports[`testEnvironment throws on invalid environment names 1`] = `
"<red><bold><bold>● <bold>Validation Error</>:</>
"<red><bold><bold>● </><bold>Validation Error</>:</>
<red></>
<red> Test environment <bold>phantom</> cannot be found. Make sure the <bold>testEnvironment</> configuration option points to an existing node module.</>
<red></>
Expand All @@ -165,7 +165,7 @@ exports[`testEnvironment throws on invalid environment names 1`] = `
`;

exports[`testMatch throws if testRegex and testMatch are both specified 1`] = `
"<red><bold><bold>● <bold>Validation Error</>:</>
"<red><bold><bold>● </><bold>Validation Error</>:</>
<red></>
<red> Configuration options <bold>testMatch</> and <bold>testRegex</> cannot be used together.</>
<red></>
Expand All @@ -179,7 +179,7 @@ exports[`testPathPattern <regexForTestFiles> ignores invalid regular expressions
exports[`testPathPattern --testPathPattern ignores invalid regular expressions and logs a warning 1`] = `"<red> Invalid testPattern a( supplied. Running all tests instead.</>"`;

exports[`testTimeout should throw an error if timeout is a negative number 1`] = `
"<red><bold><bold>● <bold>Validation Error</>:</>
"<red><bold><bold>● </><bold>Validation Error</>:</>
<red></>
<red> Option \\"<bold>testTimeout</>\\" must be a natural number.</>
<red></>
Expand All @@ -189,7 +189,7 @@ exports[`testTimeout should throw an error if timeout is a negative number 1`] =
`;

exports[`watchPlugins throw error when a watch plugin is not found 1`] = `
"<red><bold><bold>● <bold>Validation Error</>:</>
"<red><bold><bold>● </><bold>Validation Error</>:</>
<red></>
<red> Watch plugin <bold>missing-plugin</> cannot be found. Make sure the <bold>watchPlugins</> configuration option points to an existing node module.</>
<red></>
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-config/src/color.ts
Expand Up @@ -6,7 +6,7 @@
*/

import {createHash} from 'crypto';
import chalk from 'chalk';
import chalk = require('chalk');

const colors: Array<keyof typeof chalk> = [
'red',
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-config/src/index.ts
Expand Up @@ -8,7 +8,7 @@
import * as fs from 'fs';
import * as path from 'path';
import {Config} from '@jest/types';
import chalk from 'chalk';
import chalk = require('chalk');
import {isJSONString, replaceRootDirInPath} from './utils';
import normalize from './normalize';
import resolveConfigPath from './resolveConfigPath';
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-config/src/normalize.ts
Expand Up @@ -11,7 +11,7 @@ import {sync as glob} from 'glob';
import {Config} from '@jest/types';
import {ValidationError, validate} from 'jest-validate';
import {clearLine, replacePathSepForGlob} from 'jest-util';
import chalk from 'chalk';
import chalk = require('chalk');
import micromatch = require('micromatch');
import {sync as realpath} from 'realpath-native';
import Resolver = require('jest-resolve');
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-config/src/utils.ts
Expand Up @@ -9,7 +9,7 @@ import * as path from 'path';
import {Config} from '@jest/types';
import {ValidationError} from 'jest-validate';
import Resolver = require('jest-resolve');
import chalk from 'chalk';
import chalk = require('chalk');

type ResolveOptions = {
rootDir: Config.Path;
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-console/package.json
Expand Up @@ -11,7 +11,7 @@
"types": "build/index.d.ts",
"dependencies": {
"@jest/source-map": "^24.9.0",
"chalk": "^2.0.1",
"chalk": "^3.0.0",
"jest-util": "^24.9.0",
"slash": "^3.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-console/src/BufferedConsole.ts
Expand Up @@ -8,7 +8,7 @@
import assert = require('assert');
import {Console} from 'console';
import {format} from 'util';
import chalk from 'chalk';
import chalk = require('chalk');
import {SourceMapRegistry, getCallsite} from '@jest/source-map';
import {
ConsoleBuffer,
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-console/src/CustomConsole.ts
Expand Up @@ -8,7 +8,7 @@
import assert = require('assert');
import {format} from 'util';
import {Console} from 'console';
import chalk from 'chalk';
import chalk = require('chalk');
import {clearLine} from 'jest-util';
import {LogCounters, LogMessage, LogTimers, LogType} from './types';

Expand Down
2 changes: 1 addition & 1 deletion packages/jest-console/src/__tests__/CustomConsole.test.ts
Expand Up @@ -6,7 +6,7 @@
*/

import {Writable} from 'stream';
import chalk from 'chalk';
import chalk = require('chalk');
import CustomConsole from '../CustomConsole';

describe('CustomConsole', () => {
Expand Down
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import chalk from 'chalk';
import chalk = require('chalk');
import BufferedConsole from '../BufferedConsole';

describe('CustomConsole', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-console/src/getConsoleOutput.ts
Expand Up @@ -6,7 +6,7 @@
*/

import * as path from 'path';
import chalk from 'chalk';
import chalk = require('chalk');
import slash = require('slash');
import {ConsoleBuffer} from './types';

Expand Down
2 changes: 1 addition & 1 deletion packages/jest-core/package.json
Expand Up @@ -11,7 +11,7 @@
"@jest/transform": "^24.9.0",
"@jest/types": "^24.9.0",
"ansi-escapes": "^4.2.1",
"chalk": "^2.0.1",
"chalk": "^3.0.0",
"exit": "^0.1.2",
"graceful-fs": "^4.2.3",
"jest-changed-files": "^24.9.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-core/src/SnapshotInteractiveMode.ts
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import chalk from 'chalk';
import chalk = require('chalk');
import ansiEscapes = require('ansi-escapes');
import {AggregatedResult, AssertionLocation} from '@jest/test-result';
import {KEYS} from 'jest-watcher';
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-core/src/TestScheduler.ts
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import chalk from 'chalk';
import chalk = require('chalk');
import {formatExecError} from 'jest-message-util';
import {Config} from '@jest/types';
import snapshot = require('jest-snapshot');
Expand Down
Expand Up @@ -27,7 +27,7 @@ jest
});

jest.doMock('chalk', () =>
Object.assign(new chalk.constructor({enabled: false}), {
Object.assign(new chalk.Instance({level: 0}), {
stripColor: str => str,
}),
);
Expand Down