From d7a7b4294a4507030f86fe4f78e1790f53d0bda9 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Sat, 9 Nov 2019 20:19:36 +0100 Subject: [PATCH] chore: upgrade chalk to v3 (#9154) * chore: upgrade chalk * import Color from chalk rather than hard coding * import require only in ts * update tests --- package.json | 2 +- packages/babel-jest/package.json | 2 +- packages/babel-jest/src/index.ts | 2 +- packages/jest-circus/package.json | 2 +- .../jest-circus/src/formatNodeAssertErrors.ts | 2 +- packages/jest-circus/src/index.ts | 2 +- packages/jest-cli/package.json | 2 +- packages/jest-cli/src/cli/index.ts | 2 +- packages/jest-cli/src/init/index.ts | 2 +- packages/jest-config/package.json | 2 +- packages/jest-config/src/Deprecated.ts | 2 +- .../src/ReporterValidationErrors.ts | 2 +- .../__snapshots__/normalize.test.js.snap | 30 +++++------ packages/jest-config/src/color.ts | 2 +- packages/jest-config/src/index.ts | 2 +- packages/jest-config/src/normalize.ts | 2 +- packages/jest-config/src/utils.ts | 2 +- packages/jest-console/package.json | 2 +- packages/jest-console/src/BufferedConsole.ts | 2 +- packages/jest-console/src/CustomConsole.ts | 2 +- .../src/__tests__/CustomConsole.test.ts | 2 +- .../src/__tests__/bufferedConsole.test.ts | 2 +- packages/jest-console/src/getConsoleOutput.ts | 2 +- packages/jest-core/package.json | 2 +- .../jest-core/src/SnapshotInteractiveMode.ts | 2 +- packages/jest-core/src/TestScheduler.ts | 2 +- .../__tests__/SnapshotInteractiveMode.test.js | 2 +- .../SnapshotInteractiveMode.test.js.snap | 44 ++++++++-------- .../jest-core/src/__tests__/watch.test.js | 2 +- .../watch_filename_pattern_mode.test.js | 2 +- .../watch_test_name_pattern_mode.test.js | 2 +- packages/jest-core/src/cli/index.ts | 2 +- .../jest-core/src/getChangedFilesPromise.ts | 2 +- packages/jest-core/src/getNoTestFound.ts | 2 +- .../jest-core/src/getNoTestFoundFailed.ts | 2 +- .../src/getNoTestFoundPassWithNoTests.ts | 2 +- .../getNoTestFoundRelatedToChangedFiles.ts | 2 +- .../jest-core/src/getNoTestFoundVerbose.ts | 2 +- .../src/lib/active_filters_message.ts | 2 +- .../src/lib/handle_deprecation_warnings.ts | 2 +- packages/jest-core/src/runJest.ts | 2 +- packages/jest-core/src/watch.ts | 2 +- packages/jest-diff/README.md | 12 ++--- packages/jest-diff/package.json | 2 +- packages/jest-diff/src/__tests__/diff.test.ts | 2 +- packages/jest-diff/src/constants.ts | 2 +- packages/jest-diff/src/index.ts | 2 +- .../jest-diff/src/normalizeDiffOptions.ts | 2 +- packages/jest-each/package.json | 2 +- packages/jest-each/src/validation.ts | 2 +- packages/jest-jasmine2/package.json | 2 +- .../src/assertionErrorMessage.ts | 2 +- packages/jest-jasmine2/src/jasmine/Env.ts | 2 +- packages/jest-matcher-utils/package.json | 2 +- .../src/__tests__/index.test.ts | 2 +- packages/jest-matcher-utils/src/index.ts | 2 +- packages/jest-message-util/package.json | 2 +- .../__snapshots__/messages.test.ts.snap | 24 ++++----- packages/jest-message-util/src/index.ts | 2 +- packages/jest-reporters/package.json | 2 +- packages/jest-reporters/src/Status.ts | 2 +- .../jest-reporters/src/coverage_reporter.ts | 2 +- .../jest-reporters/src/default_reporter.ts | 2 +- .../jest-reporters/src/get_result_header.ts | 2 +- .../jest-reporters/src/get_snapshot_status.ts | 2 +- .../src/get_snapshot_summary.ts | 2 +- .../jest-reporters/src/summary_reporter.ts | 2 +- packages/jest-reporters/src/utils.ts | 2 +- .../jest-reporters/src/verbose_reporter.ts | 2 +- packages/jest-resolve/package.json | 2 +- packages/jest-resolve/src/index.ts | 2 +- packages/jest-runner/package.json | 2 +- packages/jest-runner/src/index.ts | 2 +- packages/jest-runner/src/runTest.ts | 2 +- packages/jest-runtime/package.json | 2 +- packages/jest-runtime/src/cli/index.ts | 2 +- packages/jest-snapshot/package.json | 2 +- .../src/__tests__/printSnapshot.test.ts | 2 +- .../jest-snapshot/src/__tests__/utils.test.ts | 2 +- packages/jest-snapshot/src/printSnapshot.ts | 2 +- .../jest-snapshot/src/snapshot_resolver.ts | 2 +- packages/jest-snapshot/src/utils.ts | 2 +- packages/jest-transform/package.json | 2 +- .../src/enhanceUnexpectedTokenMessage.ts | 2 +- packages/jest-types/package.json | 3 +- packages/jest-types/src/Config.ts | 44 +--------------- packages/jest-util/package.json | 2 +- packages/jest-util/src/preRunMessage.ts | 2 +- packages/jest-validate/package.json | 2 +- .../__snapshots__/validate.test.ts.snap | 50 +++++++++---------- .../validateCLIOptions.test.js.snap | 4 +- .../src/__tests__/fixtures/jestConfig.ts | 2 +- packages/jest-validate/src/errors.ts | 2 +- packages/jest-validate/src/utils.ts | 2 +- .../jest-validate/src/validateCLIOptions.ts | 2 +- packages/jest-validate/src/warnings.ts | 2 +- packages/jest-watcher/package.json | 2 +- packages/jest-watcher/src/PatternPrompt.ts | 2 +- packages/jest-watcher/src/lib/colorize.ts | 2 +- .../src/lib/formatTestNameByPattern.ts | 2 +- .../src/lib/patternModeHelpers.ts | 2 +- yarn.lock | 10 +++- 102 files changed, 188 insertions(+), 219 deletions(-) diff --git a/package.json b/package.json index 306738ec0bbe..2b583cc43b80 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/packages/babel-jest/package.json b/packages/babel-jest/package.json index a6d8c2df0264..db76931ce5bb 100644 --- a/packages/babel-jest/package.json +++ b/packages/babel-jest/package.json @@ -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": { diff --git a/packages/babel-jest/src/index.ts b/packages/babel-jest/src/index.ts index 6ff249cbe967..bddce17bd536 100644 --- a/packages/babel-jest/src/index.ts +++ b/packages/babel-jest/src/index.ts @@ -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); diff --git a/packages/jest-circus/package.json b/packages/jest-circus/package.json index 08c8832e4981..88039ea6a6b4 100644 --- a/packages/jest-circus/package.json +++ b/packages/jest-circus/package.json @@ -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", diff --git a/packages/jest-circus/src/formatNodeAssertErrors.ts b/packages/jest-circus/src/formatNodeAssertErrors.ts index 841f98d03f1e..7383611dcb7f 100644 --- a/packages/jest-circus/src/formatNodeAssertErrors.ts +++ b/packages/jest-circus/src/formatNodeAssertErrors.ts @@ -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 { diff --git a/packages/jest-circus/src/index.ts b/packages/jest-circus/src/index.ts index f7dc64781f81..10056acc358b 100644 --- a/packages/jest-circus/src/index.ts +++ b/packages/jest-circus/src/index.ts @@ -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'; diff --git a/packages/jest-cli/package.json b/packages/jest-cli/package.json index 0ae23ab456eb..112fbcdc982f 100644 --- a/packages/jest-cli/package.json +++ b/packages/jest-cli/package.json @@ -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", diff --git a/packages/jest-cli/src/cli/index.ts b/packages/jest-cli/src/cli/index.ts index f8029b065eda..c4024ea7aab1 100644 --- a/packages/jest-cli/src/cli/index.ts +++ b/packages/jest-cli/src/cli/index.ts @@ -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'; diff --git a/packages/jest-cli/src/init/index.ts b/packages/jest-cli/src/init/index.ts index d7e7aaf6f6c7..55022c1be9f0 100644 --- a/packages/jest-cli/src/init/index.ts +++ b/packages/jest-cli/src/init/index.ts @@ -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'; diff --git a/packages/jest-config/package.json b/packages/jest-config/package.json index b6ce70c9e922..aaff4de29cf2 100644 --- a/packages/jest-config/package.json +++ b/packages/jest-config/package.json @@ -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", diff --git a/packages/jest-config/src/Deprecated.ts b/packages/jest-config/src/Deprecated.ts index 4b9eca9b3f45..a76f26229ddd 100644 --- a/packages/jest-config/src/Deprecated.ts +++ b/packages/jest-config/src/Deprecated.ts @@ -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}); diff --git a/packages/jest-config/src/ReporterValidationErrors.ts b/packages/jest-config/src/ReporterValidationErrors.ts index 0a95373f5d3a..8137dedd61cb 100644 --- a/packages/jest-config/src/ReporterValidationErrors.ts +++ b/packages/jest-config/src/ReporterValidationErrors.ts @@ -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'; diff --git a/packages/jest-config/src/__tests__/__snapshots__/normalize.test.js.snap b/packages/jest-config/src/__tests__/__snapshots__/normalize.test.js.snap index 890e0f7087cf..29f8228c7c3d 100644 --- a/packages/jest-config/src/__tests__/__snapshots__/normalize.test.js.snap +++ b/packages/jest-config/src/__tests__/__snapshots__/normalize.test.js.snap @@ -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`] = ` -" Deprecation Warning: +" Deprecation Warning: Option \\"preprocessorIgnorePatterns\\" was replaced by \\"transformIgnorePatterns\\", which support multiple preprocessors. @@ -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`] = ` -"Validation Error: +"Validation Error: Option \\"displayName\\" must be of type: @@ -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`] = ` -"Validation Error: +"Validation Error: Option \\"displayName\\" must be of type: @@ -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`] = ` -"Validation Error: +"Validation Error: Option \\"displayName\\" must be of type: @@ -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`] = ` -"Validation Error: +"Validation Error: Option \\"displayName\\" must be of type: @@ -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`] = ` -"Validation Error: +"Validation Error: Module exist-but-no-jest-preset should have \\"jest-preset.js\\" or \\"jest-preset.json\\" file at the root. @@ -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`] = ` -"Validation Error: +"Validation Error: Preset doesnt-exist not found. @@ -112,7 +112,7 @@ exports[`preset throws when preset not found 1`] = ` `; exports[`rootDir throws if the options is missing a rootDir property 1`] = ` -"Validation Error: +"Validation Error: Configuration option rootDir must be specified. @@ -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`] = ` -"Validation Error: +"Validation Error: Jest Runner missing-runner cannot be found. Make sure the runner configuration option points to an existing node module. @@ -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`] = ` -" Deprecation Warning: +" Deprecation Warning: Option \\"setupTestFrameworkScriptFile\\" was replaced by configuration \\"setupFilesAfterEnv\\", which supports multiple paths. @@ -144,7 +144,7 @@ exports[`setupTestFrameworkScriptFile logs a deprecation warning when \`setupTes `; exports[`setupTestFrameworkScriptFile logs an error when \`setupTestFrameworkScriptFile\` and \`setupFilesAfterEnv\` are used 1`] = ` -"Validation Error: +"Validation Error: Options: setupTestFrameworkScriptFile and setupFilesAfterEnv cannot be used together. Please change your configuration to only use setupFilesAfterEnv. @@ -155,7 +155,7 @@ exports[`setupTestFrameworkScriptFile logs an error when \`setupTestFrameworkScr `; exports[`testEnvironment throws on invalid environment names 1`] = ` -"Validation Error: +"Validation Error: Test environment phantom cannot be found. Make sure the testEnvironment configuration option points to an existing node module. @@ -165,7 +165,7 @@ exports[`testEnvironment throws on invalid environment names 1`] = ` `; exports[`testMatch throws if testRegex and testMatch are both specified 1`] = ` -"Validation Error: +"Validation Error: Configuration options testMatch and testRegex cannot be used together. @@ -179,7 +179,7 @@ exports[`testPathPattern ignores invalid regular expressions exports[`testPathPattern --testPathPattern ignores invalid regular expressions and logs a warning 1`] = `" Invalid testPattern a( supplied. Running all tests instead."`; exports[`testTimeout should throw an error if timeout is a negative number 1`] = ` -"Validation Error: +"Validation Error: Option \\"testTimeout\\" must be a natural number. @@ -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`] = ` -"Validation Error: +"Validation Error: Watch plugin missing-plugin cannot be found. Make sure the watchPlugins configuration option points to an existing node module. diff --git a/packages/jest-config/src/color.ts b/packages/jest-config/src/color.ts index ff55010cf181..f7fdd5317f5c 100644 --- a/packages/jest-config/src/color.ts +++ b/packages/jest-config/src/color.ts @@ -6,7 +6,7 @@ */ import {createHash} from 'crypto'; -import chalk from 'chalk'; +import chalk = require('chalk'); const colors: Array = [ 'red', diff --git a/packages/jest-config/src/index.ts b/packages/jest-config/src/index.ts index 1e414212a8e8..fc796086e2a1 100644 --- a/packages/jest-config/src/index.ts +++ b/packages/jest-config/src/index.ts @@ -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'; diff --git a/packages/jest-config/src/normalize.ts b/packages/jest-config/src/normalize.ts index d5d8f5a8f0b6..b1e2afb4602a 100644 --- a/packages/jest-config/src/normalize.ts +++ b/packages/jest-config/src/normalize.ts @@ -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'); diff --git a/packages/jest-config/src/utils.ts b/packages/jest-config/src/utils.ts index 0694c01ef88e..1fe8c244d3c9 100644 --- a/packages/jest-config/src/utils.ts +++ b/packages/jest-config/src/utils.ts @@ -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; diff --git a/packages/jest-console/package.json b/packages/jest-console/package.json index 0605f0d10a99..53b673c148ff 100644 --- a/packages/jest-console/package.json +++ b/packages/jest-console/package.json @@ -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" }, diff --git a/packages/jest-console/src/BufferedConsole.ts b/packages/jest-console/src/BufferedConsole.ts index 9f9b939597d3..fd60ec8c5287 100644 --- a/packages/jest-console/src/BufferedConsole.ts +++ b/packages/jest-console/src/BufferedConsole.ts @@ -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, diff --git a/packages/jest-console/src/CustomConsole.ts b/packages/jest-console/src/CustomConsole.ts index 481cb18a1953..c7b12ea69faf 100644 --- a/packages/jest-console/src/CustomConsole.ts +++ b/packages/jest-console/src/CustomConsole.ts @@ -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'; diff --git a/packages/jest-console/src/__tests__/CustomConsole.test.ts b/packages/jest-console/src/__tests__/CustomConsole.test.ts index f0dc966df14c..13e578db0680 100644 --- a/packages/jest-console/src/__tests__/CustomConsole.test.ts +++ b/packages/jest-console/src/__tests__/CustomConsole.test.ts @@ -6,7 +6,7 @@ */ import {Writable} from 'stream'; -import chalk from 'chalk'; +import chalk = require('chalk'); import CustomConsole from '../CustomConsole'; describe('CustomConsole', () => { diff --git a/packages/jest-console/src/__tests__/bufferedConsole.test.ts b/packages/jest-console/src/__tests__/bufferedConsole.test.ts index ac6b06966b0c..23411b6a9523 100644 --- a/packages/jest-console/src/__tests__/bufferedConsole.test.ts +++ b/packages/jest-console/src/__tests__/bufferedConsole.test.ts @@ -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', () => { diff --git a/packages/jest-console/src/getConsoleOutput.ts b/packages/jest-console/src/getConsoleOutput.ts index 7612ce593046..60ad4f70a763 100644 --- a/packages/jest-console/src/getConsoleOutput.ts +++ b/packages/jest-console/src/getConsoleOutput.ts @@ -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'; diff --git a/packages/jest-core/package.json b/packages/jest-core/package.json index 543525a1998d..54b6735f91a6 100644 --- a/packages/jest-core/package.json +++ b/packages/jest-core/package.json @@ -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", diff --git a/packages/jest-core/src/SnapshotInteractiveMode.ts b/packages/jest-core/src/SnapshotInteractiveMode.ts index b63af3c130ef..0bea51b6bc84 100644 --- a/packages/jest-core/src/SnapshotInteractiveMode.ts +++ b/packages/jest-core/src/SnapshotInteractiveMode.ts @@ -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'; diff --git a/packages/jest-core/src/TestScheduler.ts b/packages/jest-core/src/TestScheduler.ts index a4d237cd939a..ed6d73528982 100644 --- a/packages/jest-core/src/TestScheduler.ts +++ b/packages/jest-core/src/TestScheduler.ts @@ -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'); diff --git a/packages/jest-core/src/__tests__/SnapshotInteractiveMode.test.js b/packages/jest-core/src/__tests__/SnapshotInteractiveMode.test.js index b6524599da47..af11788ab076 100644 --- a/packages/jest-core/src/__tests__/SnapshotInteractiveMode.test.js +++ b/packages/jest-core/src/__tests__/SnapshotInteractiveMode.test.js @@ -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, }), ); diff --git a/packages/jest-core/src/__tests__/__snapshots__/SnapshotInteractiveMode.test.js.snap b/packages/jest-core/src/__tests__/__snapshots__/SnapshotInteractiveMode.test.js.snap index 7eb11da97da9..411444957a8b 100644 --- a/packages/jest-core/src/__tests__/__snapshots__/SnapshotInteractiveMode.test.js.snap +++ b/packages/jest-core/src/__tests__/__snapshots__/SnapshotInteractiveMode.test.js.snap @@ -5,7 +5,7 @@ exports[`SnapshotInteractiveMode skip 1 test, then quit 1`] = ` [MOCK - eraseDown] Interactive Snapshot Progress - › 1 snapshot remaining + › 1 snapshot remaining Watch Usage › Press u to update failing snapshots for this test. @@ -19,7 +19,7 @@ exports[`SnapshotInteractiveMode skip 1 test, then quit 2`] = ` "[MOCK - clear] Interactive Snapshot Result - › 1 snapshot reviewed, 1 snapshot skipped + › 1 snapshot reviewed, 1 snapshot skipped Watch Usage › Press r to restart Interactive Snapshot Mode. @@ -32,7 +32,7 @@ exports[`SnapshotInteractiveMode skip 1 test, then restart 1`] = ` [MOCK - eraseDown] Interactive Snapshot Progress - › 1 snapshot remaining + › 1 snapshot remaining Watch Usage › Press u to update failing snapshots for this test. @@ -46,7 +46,7 @@ exports[`SnapshotInteractiveMode skip 1 test, then restart 2`] = ` "[MOCK - clear] Interactive Snapshot Result - › 1 snapshot reviewed, 1 snapshot skipped + › 1 snapshot reviewed, 1 snapshot skipped Watch Usage › Press r to restart Interactive Snapshot Mode. @@ -59,7 +59,7 @@ exports[`SnapshotInteractiveMode skip 1 test, then restart 3`] = ` [MOCK - eraseDown] Interactive Snapshot Progress - › 1 snapshot remaining + › 1 snapshot remaining Watch Usage › Press u to update failing snapshots for this test. @@ -74,7 +74,7 @@ exports[`SnapshotInteractiveMode skip 1 test, update 1 test, then finish and res [MOCK - eraseDown] Interactive Snapshot Progress - › 2 snapshots remaining + › 2 snapshots remaining Watch Usage › Press u to update failing snapshots for this test. @@ -89,7 +89,7 @@ exports[`SnapshotInteractiveMode skip 1 test, update 1 test, then finish and res [MOCK - eraseDown] Interactive Snapshot Progress - › 1 snapshot remaining, 1 snapshot skipped + › 1 snapshot remaining, 1 snapshot skipped Watch Usage › Press u to update failing snapshots for this test. @@ -103,7 +103,7 @@ exports[`SnapshotInteractiveMode skip 1 test, update 1 test, then finish and res "[MOCK - clear] Interactive Snapshot Result - › 2 snapshots reviewed, 1 snapshot updated, 1 snapshot skipped + › 2 snapshots reviewed, 1 snapshot updated, 1 snapshot skipped Watch Usage › Press r to restart Interactive Snapshot Mode. @@ -116,7 +116,7 @@ exports[`SnapshotInteractiveMode skip 1 test, update 1 test, then finish and res [MOCK - eraseDown] Interactive Snapshot Progress - › 1 snapshot remaining + › 1 snapshot remaining Watch Usage › Press u to update failing snapshots for this test. @@ -131,7 +131,7 @@ exports[`SnapshotInteractiveMode skip 2 tests, then finish and restart 1`] = ` [MOCK - eraseDown] Interactive Snapshot Progress - › 2 snapshots remaining + › 2 snapshots remaining Watch Usage › Press u to update failing snapshots for this test. @@ -146,7 +146,7 @@ exports[`SnapshotInteractiveMode skip 2 tests, then finish and restart 2`] = ` [MOCK - eraseDown] Interactive Snapshot Progress - › 1 snapshot remaining, 1 snapshot skipped + › 1 snapshot remaining, 1 snapshot skipped Watch Usage › Press u to update failing snapshots for this test. @@ -160,7 +160,7 @@ exports[`SnapshotInteractiveMode skip 2 tests, then finish and restart 3`] = ` "[MOCK - clear] Interactive Snapshot Result - › 2 snapshots reviewed, 2 snapshots skipped + › 2 snapshots reviewed, 2 snapshots skipped Watch Usage › Press r to restart Interactive Snapshot Mode. @@ -173,7 +173,7 @@ exports[`SnapshotInteractiveMode skip 2 tests, then finish and restart 4`] = ` [MOCK - eraseDown] Interactive Snapshot Progress - › 2 snapshots remaining + › 2 snapshots remaining Watch Usage › Press u to update failing snapshots for this test. @@ -188,7 +188,7 @@ exports[`SnapshotInteractiveMode update 1 test, skip 1 test, then finish and res [MOCK - eraseDown] Interactive Snapshot Progress - › 2 snapshots remaining + › 2 snapshots remaining Watch Usage › Press u to update failing snapshots for this test. @@ -203,7 +203,7 @@ exports[`SnapshotInteractiveMode update 1 test, skip 1 test, then finish and res [MOCK - eraseDown] Interactive Snapshot Progress - › 1 snapshot remaining, 1 snapshot updated + › 1 snapshot remaining, 1 snapshot updated Watch Usage › Press u to update failing snapshots for this test. @@ -217,7 +217,7 @@ exports[`SnapshotInteractiveMode update 1 test, skip 1 test, then finish and res "[MOCK - clear] Interactive Snapshot Result - › 2 snapshots reviewed, 1 snapshot updated, 1 snapshot skipped + › 2 snapshots reviewed, 1 snapshot updated, 1 snapshot skipped Watch Usage › Press r to restart Interactive Snapshot Mode. @@ -230,7 +230,7 @@ exports[`SnapshotInteractiveMode update 1 test, skip 1 test, then finish and res [MOCK - eraseDown] Interactive Snapshot Progress - › 1 snapshot remaining + › 1 snapshot remaining Watch Usage › Press u to update failing snapshots for this test. @@ -245,7 +245,7 @@ exports[`SnapshotInteractiveMode update 1 test, then finish and return 1`] = ` [MOCK - eraseDown] Interactive Snapshot Progress - › 1 snapshot remaining + › 1 snapshot remaining Watch Usage › Press u to update failing snapshots for this test. @@ -259,7 +259,7 @@ exports[`SnapshotInteractiveMode update 1 test, then finish and return 2`] = ` "[MOCK - clear] Interactive Snapshot Result - › 1 snapshot reviewed, 1 snapshot updated + › 1 snapshot reviewed, 1 snapshot updated Watch Usage › Press Enter to return to watch mode. @@ -271,7 +271,7 @@ exports[`SnapshotInteractiveMode update 2 tests, then finish and return 1`] = ` [MOCK - eraseDown] Interactive Snapshot Progress - › 2 snapshots remaining + › 2 snapshots remaining Watch Usage › Press u to update failing snapshots for this test. @@ -286,7 +286,7 @@ exports[`SnapshotInteractiveMode update 2 tests, then finish and return 2`] = ` [MOCK - eraseDown] Interactive Snapshot Progress - › 1 snapshot remaining, 1 snapshot updated + › 1 snapshot remaining, 1 snapshot updated Watch Usage › Press u to update failing snapshots for this test. @@ -300,7 +300,7 @@ exports[`SnapshotInteractiveMode update 2 tests, then finish and return 3`] = ` "[MOCK - clear] Interactive Snapshot Result - › 2 snapshots reviewed, 2 snapshots updated + › 2 snapshots reviewed, 2 snapshots updated Watch Usage › Press Enter to return to watch mode. diff --git a/packages/jest-core/src/__tests__/watch.test.js b/packages/jest-core/src/__tests__/watch.test.js index 358446807c64..84e55a43dee0 100644 --- a/packages/jest-core/src/__tests__/watch.test.js +++ b/packages/jest-core/src/__tests__/watch.test.js @@ -42,7 +42,7 @@ jest.mock( }, ); -jest.doMock('chalk', () => new chalk.constructor({enabled: false})); +jest.doMock('chalk', () => new chalk.Instance({level: 0})); jest.doMock( '../runJest', () => diff --git a/packages/jest-core/src/__tests__/watch_filename_pattern_mode.test.js b/packages/jest-core/src/__tests__/watch_filename_pattern_mode.test.js index bfd1efab9f54..30374f5e2623 100644 --- a/packages/jest-core/src/__tests__/watch_filename_pattern_mode.test.js +++ b/packages/jest-core/src/__tests__/watch_filename_pattern_mode.test.js @@ -64,7 +64,7 @@ jest.mock( }, ); -jest.doMock('chalk', () => new chalk.constructor({enabled: false})); +jest.doMock('chalk', () => new chalk.Instance({level: 0})); jest.doMock('strip-ansi'); require('strip-ansi').mockImplementation(str => str); diff --git a/packages/jest-core/src/__tests__/watch_test_name_pattern_mode.test.js b/packages/jest-core/src/__tests__/watch_test_name_pattern_mode.test.js index 00963e501753..bfaa38f6b13f 100644 --- a/packages/jest-core/src/__tests__/watch_test_name_pattern_mode.test.js +++ b/packages/jest-core/src/__tests__/watch_test_name_pattern_mode.test.js @@ -40,7 +40,7 @@ jest.mock( }, ); -jest.doMock('chalk', () => new chalk.constructor({enabled: false})); +jest.doMock('chalk', () => new chalk.Instance({level: 0})); jest.doMock('strip-ansi'); require('strip-ansi').mockImplementation(str => str); diff --git a/packages/jest-core/src/cli/index.ts b/packages/jest-core/src/cli/index.ts index 1098332ef064..ad2f2e2bea73 100644 --- a/packages/jest-core/src/cli/index.ts +++ b/packages/jest-core/src/cli/index.ts @@ -13,7 +13,7 @@ import {readConfigs} from 'jest-config'; import Runtime = require('jest-runtime'); import {ChangedFilesPromise} from 'jest-changed-files'; import HasteMap = require('jest-haste-map'); -import chalk from 'chalk'; +import chalk = require('chalk'); import rimraf = require('rimraf'); import exit = require('exit'); import {Filter} from '../types'; diff --git a/packages/jest-core/src/getChangedFilesPromise.ts b/packages/jest-core/src/getChangedFilesPromise.ts index 43e79e448e59..570a13d754eb 100644 --- a/packages/jest-core/src/getChangedFilesPromise.ts +++ b/packages/jest-core/src/getChangedFilesPromise.ts @@ -8,7 +8,7 @@ import {Config} from '@jest/types'; import {ChangedFilesPromise, getChangedFilesForRoots} from 'jest-changed-files'; import {formatExecError} from 'jest-message-util'; -import chalk from 'chalk'; +import chalk = require('chalk'); export default ( globalConfig: Config.GlobalConfig, diff --git a/packages/jest-core/src/getNoTestFound.ts b/packages/jest-core/src/getNoTestFound.ts index d1fa85d3ec8e..647393d312b3 100644 --- a/packages/jest-core/src/getNoTestFound.ts +++ b/packages/jest-core/src/getNoTestFound.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import chalk from 'chalk'; +import chalk = require('chalk'); import {Config} from '@jest/types'; import {TestRunData} from './types'; import pluralize from './pluralize'; diff --git a/packages/jest-core/src/getNoTestFoundFailed.ts b/packages/jest-core/src/getNoTestFoundFailed.ts index b36bb8ea659a..ec448781b695 100644 --- a/packages/jest-core/src/getNoTestFoundFailed.ts +++ b/packages/jest-core/src/getNoTestFoundFailed.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import chalk from 'chalk'; +import chalk = require('chalk'); export default function getNoTestFoundFailed() { return ( diff --git a/packages/jest-core/src/getNoTestFoundPassWithNoTests.ts b/packages/jest-core/src/getNoTestFoundPassWithNoTests.ts index fc404021d624..15a808b6a52a 100644 --- a/packages/jest-core/src/getNoTestFoundPassWithNoTests.ts +++ b/packages/jest-core/src/getNoTestFoundPassWithNoTests.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import chalk from 'chalk'; +import chalk = require('chalk'); export default function getNoTestFoundPassWithNoTests() { return chalk.bold('No tests found, exiting with code 0'); diff --git a/packages/jest-core/src/getNoTestFoundRelatedToChangedFiles.ts b/packages/jest-core/src/getNoTestFoundRelatedToChangedFiles.ts index 6efd4a40adaf..59aae5f978fc 100644 --- a/packages/jest-core/src/getNoTestFoundRelatedToChangedFiles.ts +++ b/packages/jest-core/src/getNoTestFoundRelatedToChangedFiles.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import chalk from 'chalk'; +import chalk = require('chalk'); import {Config} from '@jest/types'; import {isInteractive} from 'jest-util'; diff --git a/packages/jest-core/src/getNoTestFoundVerbose.ts b/packages/jest-core/src/getNoTestFoundVerbose.ts index 0b26e8927985..71314a3878e9 100644 --- a/packages/jest-core/src/getNoTestFoundVerbose.ts +++ b/packages/jest-core/src/getNoTestFoundVerbose.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import chalk from 'chalk'; +import chalk = require('chalk'); import {Config} from '@jest/types'; import pluralize from './pluralize'; import {Stats, TestRunData} from './types'; diff --git a/packages/jest-core/src/lib/active_filters_message.ts b/packages/jest-core/src/lib/active_filters_message.ts index 240fab05b574..97df611b11ad 100644 --- a/packages/jest-core/src/lib/active_filters_message.ts +++ b/packages/jest-core/src/lib/active_filters_message.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import chalk from 'chalk'; +import chalk = require('chalk'); import {Config} from '@jest/types'; const activeFilters = ( diff --git a/packages/jest-core/src/lib/handle_deprecation_warnings.ts b/packages/jest-core/src/lib/handle_deprecation_warnings.ts index 938d586cbac0..83eea7aaf967 100644 --- a/packages/jest-core/src/lib/handle_deprecation_warnings.ts +++ b/packages/jest-core/src/lib/handle_deprecation_warnings.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import chalk from 'chalk'; +import chalk = require('chalk'); import {KEYS} from 'jest-watcher'; export default ( diff --git a/packages/jest-core/src/runJest.ts b/packages/jest-core/src/runJest.ts index ce698948ecbe..ea81c524e381 100644 --- a/packages/jest-core/src/runJest.ts +++ b/packages/jest-core/src/runJest.ts @@ -6,7 +6,7 @@ */ import * as path from 'path'; -import chalk from 'chalk'; +import chalk = require('chalk'); import {sync as realpath} from 'realpath-native'; import {CustomConsole} from '@jest/console'; import {interopRequireDefault} from 'jest-util'; diff --git a/packages/jest-core/src/watch.ts b/packages/jest-core/src/watch.ts index 81a1769a0294..400986d3871c 100644 --- a/packages/jest-core/src/watch.ts +++ b/packages/jest-core/src/watch.ts @@ -7,7 +7,7 @@ import * as path from 'path'; import ansiEscapes = require('ansi-escapes'); -import chalk from 'chalk'; +import chalk = require('chalk'); import exit = require('exit'); import slash = require('slash'); import HasteMap = require('jest-haste-map'); diff --git a/packages/jest-diff/README.md b/packages/jest-diff/README.md index f774c66665ab..f63843ce8f3c 100644 --- a/packages/jest-diff/README.md +++ b/packages/jest-diff/README.md @@ -429,8 +429,8 @@ The `jest-diff` package does not assume that the 2 labels have equal length. For consistency with most diff tools, you might exchange the colors: -```js -import chalk from 'chalk'; +```ts +import chalk = require('chalk'); const options = { aColor: chalk.red, @@ -442,8 +442,8 @@ const options = { Although the default inverse of foreground and background colors is hard to beat for changed substrings **within lines**, especially because it highlights spaces, if you want bold font weight on yellow background color: -```js -import chalk from 'chalk'; +```ts +import chalk = require('chalk'); const options = { changeColor: chalk.bold.bgYellowBright, @@ -532,8 +532,8 @@ A patch mark like `@@ -12,7 +12,9 @@` accounts for omitted common lines. If you want patch marks to have the same dim color as common lines: -```js -import chalk from 'chalk'; +```ts +import chalk = require('chalk'); const options = { expand: false, diff --git a/packages/jest-diff/package.json b/packages/jest-diff/package.json index 25e6e49cd734..c16d0787c5b6 100644 --- a/packages/jest-diff/package.json +++ b/packages/jest-diff/package.json @@ -10,7 +10,7 @@ "main": "build/index.js", "types": "build/index.d.ts", "dependencies": { - "chalk": "^2.0.1", + "chalk": "^3.0.0", "diff-sequences": "^24.9.0", "jest-get-type": "^24.9.0", "pretty-format": "^24.9.0" diff --git a/packages/jest-diff/src/__tests__/diff.test.ts b/packages/jest-diff/src/__tests__/diff.test.ts index 2d2fc5cbbfc9..980d78cfc598 100644 --- a/packages/jest-diff/src/__tests__/diff.test.ts +++ b/packages/jest-diff/src/__tests__/diff.test.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import chalk from 'chalk'; +import chalk = require('chalk'); import stripAnsi from 'strip-ansi'; import {alignedAnsiStyleSerializer} from '@jest/test-utils'; diff --git a/packages/jest-diff/src/constants.ts b/packages/jest-diff/src/constants.ts index 9f3f45e7c63c..c8cb4b4bc7f8 100644 --- a/packages/jest-diff/src/constants.ts +++ b/packages/jest-diff/src/constants.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import chalk from 'chalk'; +import chalk = require('chalk'); export const NO_DIFF_MESSAGE = chalk.dim( 'Compared values have no visual difference.', diff --git a/packages/jest-diff/src/index.ts b/packages/jest-diff/src/index.ts index 49d5ef1a3672..e7c4c3752bc5 100644 --- a/packages/jest-diff/src/index.ts +++ b/packages/jest-diff/src/index.ts @@ -6,7 +6,7 @@ */ import prettyFormat = require('pretty-format'); -import chalk from 'chalk'; +import chalk = require('chalk'); import getType = require('jest-get-type'); import {DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT, Diff} from './cleanupSemantic'; import {diffLinesRaw, diffLinesUnified, diffLinesUnified2} from './diffLines'; diff --git a/packages/jest-diff/src/normalizeDiffOptions.ts b/packages/jest-diff/src/normalizeDiffOptions.ts index 5ea5ec6d6dbf..1dbe1110dd19 100644 --- a/packages/jest-diff/src/normalizeDiffOptions.ts +++ b/packages/jest-diff/src/normalizeDiffOptions.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import chalk from 'chalk'; +import chalk = require('chalk'); import {DiffOptions, DiffOptionsNormalized} from './types'; diff --git a/packages/jest-each/package.json b/packages/jest-each/package.json index 88673dc175d4..f6c675cdd7e7 100644 --- a/packages/jest-each/package.json +++ b/packages/jest-each/package.json @@ -19,7 +19,7 @@ "license": "MIT", "dependencies": { "@jest/types": "^24.9.0", - "chalk": "^2.0.1", + "chalk": "^3.0.0", "jest-get-type": "^24.9.0", "jest-util": "^24.9.0", "pretty-format": "^24.9.0" diff --git a/packages/jest-each/src/validation.ts b/packages/jest-each/src/validation.ts index e48fdf12887d..3f95f94c832c 100644 --- a/packages/jest-each/src/validation.ts +++ b/packages/jest-each/src/validation.ts @@ -6,7 +6,7 @@ * */ -import chalk from 'chalk'; +import chalk = require('chalk'); import pretty = require('pretty-format'); import {Global} from '@jest/types'; diff --git a/packages/jest-jasmine2/package.json b/packages/jest-jasmine2/package.json index e2c82903825c..2dfd200ccd97 100644 --- a/packages/jest-jasmine2/package.json +++ b/packages/jest-jasmine2/package.json @@ -15,7 +15,7 @@ "@jest/source-map": "^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", diff --git a/packages/jest-jasmine2/src/assertionErrorMessage.ts b/packages/jest-jasmine2/src/assertionErrorMessage.ts index 4637faef2949..1da6fb9b5688 100644 --- a/packages/jest-jasmine2/src/assertionErrorMessage.ts +++ b/packages/jest-jasmine2/src/assertionErrorMessage.ts @@ -11,7 +11,7 @@ import { printExpected, printReceived, } from 'jest-matcher-utils'; -import chalk from 'chalk'; +import chalk = require('chalk'); import {AssertionErrorWithStack} from './types'; const assertOperatorsMap: Record = { diff --git a/packages/jest-jasmine2/src/jasmine/Env.ts b/packages/jest-jasmine2/src/jasmine/Env.ts index 6ff8da163bcf..dcd6165d5bfa 100644 --- a/packages/jest-jasmine2/src/jasmine/Env.ts +++ b/packages/jest-jasmine2/src/jasmine/Env.ts @@ -31,7 +31,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /* eslint-disable sort-keys */ import {AssertionError} from 'assert'; -import chalk from 'chalk'; +import chalk = require('chalk'); import {formatExecError} from 'jest-message-util'; import {ErrorWithStack, isPromise} from 'jest-util'; import queueRunner, { diff --git a/packages/jest-matcher-utils/package.json b/packages/jest-matcher-utils/package.json index b0767cecd813..1c3746f07f12 100644 --- a/packages/jest-matcher-utils/package.json +++ b/packages/jest-matcher-utils/package.json @@ -13,7 +13,7 @@ "license": "MIT", "main": "build/index.js", "dependencies": { - "chalk": "^2.0.1", + "chalk": "^3.0.0", "jest-diff": "^24.9.0", "jest-get-type": "^24.9.0", "pretty-format": "^24.9.0" diff --git a/packages/jest-matcher-utils/src/__tests__/index.test.ts b/packages/jest-matcher-utils/src/__tests__/index.test.ts index 681472a20080..2afa9f79de62 100644 --- a/packages/jest-matcher-utils/src/__tests__/index.test.ts +++ b/packages/jest-matcher-utils/src/__tests__/index.test.ts @@ -6,7 +6,7 @@ * */ -import chalk from 'chalk'; +import chalk = require('chalk'); import prettyFormat = require('pretty-format'); import {alignedAnsiStyleSerializer} from '@jest/test-utils'; import { diff --git a/packages/jest-matcher-utils/src/index.ts b/packages/jest-matcher-utils/src/index.ts index 74ecb460527a..84f1bcbe6fb2 100644 --- a/packages/jest-matcher-utils/src/index.ts +++ b/packages/jest-matcher-utils/src/index.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import chalk from 'chalk'; +import chalk = require('chalk'); import diffDefault, { DIFF_DELETE, DIFF_EQUAL, diff --git a/packages/jest-message-util/package.json b/packages/jest-message-util/package.json index 12c6d7f7d017..dccdc3cf3e8e 100644 --- a/packages/jest-message-util/package.json +++ b/packages/jest-message-util/package.json @@ -17,7 +17,7 @@ "@jest/test-result": "^24.9.0", "@jest/types": "^24.9.0", "@types/stack-utils": "^1.0.1", - "chalk": "^2.0.1", + "chalk": "^3.0.0", "micromatch": "^4.0.2", "slash": "^3.0.0", "stack-utils": "^1.0.1" diff --git a/packages/jest-message-util/src/__tests__/__snapshots__/messages.test.ts.snap b/packages/jest-message-util/src/__tests__/__snapshots__/messages.test.ts.snap index 95b567d67a3f..8fb8249ca9b5 100644 --- a/packages/jest-message-util/src/__tests__/__snapshots__/messages.test.ts.snap +++ b/packages/jest-message-util/src/__tests__/__snapshots__/messages.test.ts.snap @@ -8,7 +8,7 @@ exports[`.formatExecError() 1`] = ` `; exports[`formatStackTrace should strip node internals 1`] = ` -" Unix test +" Unix test Expected value to be of type: @@ -18,21 +18,21 @@ exports[`formatStackTrace should strip node internals 1`] = ` type: \\"string\\" - at Object.it (__tests__/test.js:8:14) - at internal/process/next_tick.js:188:7 + at Object.it (__tests__/test.js:8:14) + at internal/process/next_tick.js:188:7 " `; exports[`retains message in babel code frame error 1`] = ` -" Babel test +" Babel test packages/react/src/forwardRef.js: Unexpected token, expected , (20:10) 18 | false, 19 | 'forwardRef requires a render function but received a \`memo\` ' - > 20 | 'component. Instead of forwardRef(memo(...)), use ' + - | ^ + > 20 | 'component. Instead of forwardRef(memo(...)), use ' + + | ^ 21 | 'memo(forwardRef(...)).', 22 | ); 23 | } else if (typeof render !== 'function') { @@ -40,17 +40,17 @@ exports[`retains message in babel code frame error 1`] = ` `; exports[`should exclude jasmine from stack trace for Unix paths. 1`] = ` -" Unix test +" Unix test at stack (../jest-jasmine2/build/jasmine-2.4.1.js:1580:17) - at Object.addResult (../jest-jasmine2/build/jasmine-2.4.1.js:1550:14) - at Object.it (build/__tests__/messages-test.js:45:41) + at Object.addResult (../jest-jasmine2/build/jasmine-2.4.1.js:1550:14) + at Object.it (build/__tests__/messages-test.js:45:41) " `; exports[`should not exclude vendor from stack trace 1`] = ` -" Vendor test +" Vendor test Expected value to be of type: @@ -60,7 +60,7 @@ exports[`should not exclude vendor from stack trace 1`] = ` type: \\"string\\" - at Object.it (__tests__/vendor/cool_test.js:6:666) - at Object.asyncFn (__tests__/vendor/sulu/node_modules/sulu-content-bundle/best_component.js:1:5) + at Object.it (__tests__/vendor/cool_test.js:6:666) + at Object.asyncFn (__tests__/vendor/sulu/node_modules/sulu-content-bundle/best_component.js:1:5) " `; diff --git a/packages/jest-message-util/src/index.ts b/packages/jest-message-util/src/index.ts index 1a02126233bd..66cee3dbc6cc 100644 --- a/packages/jest-message-util/src/index.ts +++ b/packages/jest-message-util/src/index.ts @@ -9,7 +9,7 @@ import * as fs from 'fs'; import * as path from 'path'; import {Config} from '@jest/types'; import {AssertionResult, SerializableError} from '@jest/test-result'; -import chalk from 'chalk'; +import chalk = require('chalk'); import micromatch = require('micromatch'); import slash = require('slash'); import {codeFrameColumns} from '@babel/code-frame'; diff --git a/packages/jest-reporters/package.json b/packages/jest-reporters/package.json index 1668a8920b38..583ff4c72c0f 100644 --- a/packages/jest-reporters/package.json +++ b/packages/jest-reporters/package.json @@ -10,7 +10,7 @@ "@jest/test-result": "^24.9.0", "@jest/transform": "^24.9.0", "@jest/types": "^24.9.0", - "chalk": "^2.0.1", + "chalk": "^3.0.0", "exit": "^0.1.2", "glob": "^7.1.2", "istanbul-lib-coverage": "^2.0.2", diff --git a/packages/jest-reporters/src/Status.ts b/packages/jest-reporters/src/Status.ts index b486b7a3ae2c..efd927aa7e1c 100644 --- a/packages/jest-reporters/src/Status.ts +++ b/packages/jest-reporters/src/Status.ts @@ -7,7 +7,7 @@ import {Config} from '@jest/types'; import {AggregatedResult, TestResult} from '@jest/test-result'; -import chalk from 'chalk'; +import chalk = require('chalk'); import stringLength = require('string-length'); import {ReporterOnStartOptions} from './types'; import { diff --git a/packages/jest-reporters/src/coverage_reporter.ts b/packages/jest-reporters/src/coverage_reporter.ts index 75764da11773..505b04f04e41 100644 --- a/packages/jest-reporters/src/coverage_reporter.ts +++ b/packages/jest-reporters/src/coverage_reporter.ts @@ -11,7 +11,7 @@ import {AggregatedResult, TestResult} from '@jest/test-result'; import {clearLine, isInteractive} from 'jest-util'; import istanbulReport = require('istanbul-lib-report'); import istanbulReports = require('istanbul-reports'); -import chalk from 'chalk'; +import chalk = require('chalk'); import istanbulCoverage = require('istanbul-lib-coverage'); import libSourceMaps = require('istanbul-lib-source-maps'); import Worker from 'jest-worker'; diff --git a/packages/jest-reporters/src/default_reporter.ts b/packages/jest-reporters/src/default_reporter.ts index 9f9f613ac001..982236fde3e2 100644 --- a/packages/jest-reporters/src/default_reporter.ts +++ b/packages/jest-reporters/src/default_reporter.ts @@ -9,7 +9,7 @@ import {Config} from '@jest/types'; import {AggregatedResult, TestResult} from '@jest/test-result'; import {clearLine, isInteractive} from 'jest-util'; import {getConsoleOutput} from '@jest/console'; -import chalk from 'chalk'; +import chalk = require('chalk'); import {ReporterOnStartOptions, Test} from './types'; import BaseReporter from './base_reporter'; import Status from './Status'; diff --git a/packages/jest-reporters/src/get_result_header.ts b/packages/jest-reporters/src/get_result_header.ts index 81292fa3e518..827b7f84833d 100644 --- a/packages/jest-reporters/src/get_result_header.ts +++ b/packages/jest-reporters/src/get_result_header.ts @@ -7,7 +7,7 @@ import {Config} from '@jest/types'; import {TestResult} from '@jest/test-result'; -import chalk from 'chalk'; +import chalk = require('chalk'); import {formatTestPath, printDisplayName} from './utils'; import terminalLink = require('terminal-link'); diff --git a/packages/jest-reporters/src/get_snapshot_status.ts b/packages/jest-reporters/src/get_snapshot_status.ts index 42ea340fe022..5ff509cea701 100644 --- a/packages/jest-reporters/src/get_snapshot_status.ts +++ b/packages/jest-reporters/src/get_snapshot_status.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import chalk from 'chalk'; +import chalk = require('chalk'); import {TestResult} from '@jest/test-result'; import {pluralize} from 'jest-util'; diff --git a/packages/jest-reporters/src/get_snapshot_summary.ts b/packages/jest-reporters/src/get_snapshot_summary.ts index 214963b0edf4..fae207dfab49 100644 --- a/packages/jest-reporters/src/get_snapshot_summary.ts +++ b/packages/jest-reporters/src/get_snapshot_summary.ts @@ -7,7 +7,7 @@ import {Config} from '@jest/types'; import {SnapshotSummary} from '@jest/test-result'; -import chalk from 'chalk'; +import chalk = require('chalk'); import {pluralize} from 'jest-util'; import {formatTestPath} from './utils'; diff --git a/packages/jest-reporters/src/summary_reporter.ts b/packages/jest-reporters/src/summary_reporter.ts index e94cffb2d0a5..a92f4fdf4d78 100644 --- a/packages/jest-reporters/src/summary_reporter.ts +++ b/packages/jest-reporters/src/summary_reporter.ts @@ -7,7 +7,7 @@ import {Config} from '@jest/types'; import {AggregatedResult, SnapshotSummary} from '@jest/test-result'; -import chalk from 'chalk'; +import chalk = require('chalk'); import {testPathPatternToRegExp} from 'jest-util'; import {Context, ReporterOnStartOptions} from './types'; import BaseReporter from './base_reporter'; diff --git a/packages/jest-reporters/src/utils.ts b/packages/jest-reporters/src/utils.ts index 3d730e59404b..97781b8ef8ac 100644 --- a/packages/jest-reporters/src/utils.ts +++ b/packages/jest-reporters/src/utils.ts @@ -8,7 +8,7 @@ import * as path from 'path'; import {Config} from '@jest/types'; import {AggregatedResult} from '@jest/test-result'; -import chalk from 'chalk'; +import chalk = require('chalk'); import slash = require('slash'); import {pluralize} from 'jest-util'; import {SummaryOptions} from './types'; diff --git a/packages/jest-reporters/src/verbose_reporter.ts b/packages/jest-reporters/src/verbose_reporter.ts index b34b69f2121e..4fd78dd6da1f 100644 --- a/packages/jest-reporters/src/verbose_reporter.ts +++ b/packages/jest-reporters/src/verbose_reporter.ts @@ -12,7 +12,7 @@ import { Suite, TestResult, } from '@jest/test-result'; -import chalk from 'chalk'; +import chalk = require('chalk'); import {specialChars} from 'jest-util'; import {Test} from './types'; import DefaultReporter from './default_reporter'; diff --git a/packages/jest-resolve/package.json b/packages/jest-resolve/package.json index 22a7662e04e0..7a856435d124 100644 --- a/packages/jest-resolve/package.json +++ b/packages/jest-resolve/package.json @@ -12,7 +12,7 @@ "dependencies": { "@jest/types": "^24.9.0", "browser-resolve": "^1.11.3", - "chalk": "^2.0.1", + "chalk": "^3.0.0", "jest-pnp-resolver": "^1.2.1", "realpath-native": "^1.1.0" }, diff --git a/packages/jest-resolve/src/index.ts b/packages/jest-resolve/src/index.ts index 5d536bff8889..f21e520e6f52 100644 --- a/packages/jest-resolve/src/index.ts +++ b/packages/jest-resolve/src/index.ts @@ -9,7 +9,7 @@ import * as path from 'path'; import {Config} from '@jest/types'; import {ModuleMap} from 'jest-haste-map'; // eslint-disable-line import/no-extraneous-dependencies import {sync as realpath} from 'realpath-native'; -import chalk from 'chalk'; +import chalk = require('chalk'); import nodeModulesPaths from './nodeModulesPaths'; import isBuiltinModule from './isBuiltinModule'; import defaultResolver, {clearDefaultResolverCache} from './defaultResolver'; diff --git a/packages/jest-runner/package.json b/packages/jest-runner/package.json index 495c121887ab..289133731ba4 100644 --- a/packages/jest-runner/package.json +++ b/packages/jest-runner/package.json @@ -14,7 +14,7 @@ "@jest/environment": "^24.9.0", "@jest/test-result": "^24.9.0", "@jest/types": "^24.9.0", - "chalk": "^2.4.2", + "chalk": "^3.0.0", "exit": "^0.1.2", "graceful-fs": "^4.2.3", "jest-config": "^24.9.0", diff --git a/packages/jest-runner/src/index.ts b/packages/jest-runner/src/index.ts index e838e63e06b6..05939a1268b2 100644 --- a/packages/jest-runner/src/index.ts +++ b/packages/jest-runner/src/index.ts @@ -8,7 +8,7 @@ import {Config} from '@jest/types'; import {SerializableError} from '@jest/test-result'; import exit = require('exit'); -import chalk from 'chalk'; +import chalk = require('chalk'); import throat from 'throat'; import Worker from 'jest-worker'; import runTest from './runTest'; diff --git a/packages/jest-runner/src/runTest.ts b/packages/jest-runner/src/runTest.ts index b0892c948168..6786e0e172ae 100644 --- a/packages/jest-runner/src/runTest.ts +++ b/packages/jest-runner/src/runTest.ts @@ -26,7 +26,7 @@ import {getTestEnvironment} from 'jest-config'; import * as docblock from 'jest-docblock'; import {formatExecError} from 'jest-message-util'; import sourcemapSupport = require('source-map-support'); -import chalk from 'chalk'; +import chalk = require('chalk'); import {TestFramework, TestRunnerContext} from './types'; type RunTestInternalResult = { diff --git a/packages/jest-runtime/package.json b/packages/jest-runtime/package.json index c95893d037d1..383bf24d58b6 100644 --- a/packages/jest-runtime/package.json +++ b/packages/jest-runtime/package.json @@ -16,7 +16,7 @@ "@jest/transform": "^24.9.0", "@jest/types": "^24.9.0", "@types/yargs": "^13.0.0", - "chalk": "^2.0.1", + "chalk": "^3.0.0", "exit": "^0.1.2", "glob": "^7.1.3", "graceful-fs": "^4.2.3", diff --git a/packages/jest-runtime/src/cli/index.ts b/packages/jest-runtime/src/cli/index.ts index c2b3e0151e53..0c701d5a29f1 100644 --- a/packages/jest-runtime/src/cli/index.ts +++ b/packages/jest-runtime/src/cli/index.ts @@ -7,7 +7,7 @@ import {cpus} from 'os'; import * as path from 'path'; -import chalk from 'chalk'; +import chalk = require('chalk'); import {sync as realpath} from 'realpath-native'; import yargs = require('yargs'); import {Config} from '@jest/types'; diff --git a/packages/jest-snapshot/package.json b/packages/jest-snapshot/package.json index 928744797d83..860aea2e7b0f 100644 --- a/packages/jest-snapshot/package.json +++ b/packages/jest-snapshot/package.json @@ -12,7 +12,7 @@ "dependencies": { "@babel/types": "^7.0.0", "@jest/types": "^24.9.0", - "chalk": "^2.0.1", + "chalk": "^3.0.0", "expect": "^24.9.0", "jest-diff": "^24.9.0", "jest-get-type": "^24.9.0", diff --git a/packages/jest-snapshot/src/__tests__/printSnapshot.test.ts b/packages/jest-snapshot/src/__tests__/printSnapshot.test.ts index 6df0bab18d65..692f47ffc274 100644 --- a/packages/jest-snapshot/src/__tests__/printSnapshot.test.ts +++ b/packages/jest-snapshot/src/__tests__/printSnapshot.test.ts @@ -7,7 +7,7 @@ import ansiRegex = require('ansi-regex'); import * as styles from 'ansi-styles'; -import chalk from 'chalk'; +import chalk = require('chalk'); import format = require('pretty-format'); import jestSnapshot = require('../index'); diff --git a/packages/jest-snapshot/src/__tests__/utils.test.ts b/packages/jest-snapshot/src/__tests__/utils.test.ts index f2c12fb2b1d9..fb2d1ad9194c 100644 --- a/packages/jest-snapshot/src/__tests__/utils.test.ts +++ b/packages/jest-snapshot/src/__tests__/utils.test.ts @@ -13,7 +13,7 @@ jest.mock('fs', () => ({ import * as fs from 'fs'; import * as path from 'path'; import assert = require('assert'); -import chalk from 'chalk'; +import chalk = require('chalk'); import { SNAPSHOT_GUIDE_LINK, diff --git a/packages/jest-snapshot/src/printSnapshot.ts b/packages/jest-snapshot/src/printSnapshot.ts index 538efcbbd466..cd83d3fd7fe6 100644 --- a/packages/jest-snapshot/src/printSnapshot.ts +++ b/packages/jest-snapshot/src/printSnapshot.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import chalk from 'chalk'; +import chalk = require('chalk'); import { DIFF_DELETE, DIFF_EQUAL, diff --git a/packages/jest-snapshot/src/snapshot_resolver.ts b/packages/jest-snapshot/src/snapshot_resolver.ts index 203eec627b2d..f6b59f17946c 100644 --- a/packages/jest-snapshot/src/snapshot_resolver.ts +++ b/packages/jest-snapshot/src/snapshot_resolver.ts @@ -7,7 +7,7 @@ import * as path from 'path'; import {Config} from '@jest/types'; -import chalk from 'chalk'; +import chalk = require('chalk'); export type SnapshotResolver = { testPathForConsistencyCheck: string; diff --git a/packages/jest-snapshot/src/utils.ts b/packages/jest-snapshot/src/utils.ts index af0d059476e1..379319575706 100644 --- a/packages/jest-snapshot/src/utils.ts +++ b/packages/jest-snapshot/src/utils.ts @@ -9,7 +9,7 @@ import * as fs from 'fs'; import * as path from 'path'; import {sync as mkdirp} from 'mkdirp'; import naturalCompare = require('natural-compare'); -import chalk from 'chalk'; +import chalk = require('chalk'); import {Config} from '@jest/types'; import prettyFormat = require('pretty-format'); import {getSerializers} from './plugins'; diff --git a/packages/jest-transform/package.json b/packages/jest-transform/package.json index 4f5ee4a0a150..c462a5c91136 100644 --- a/packages/jest-transform/package.json +++ b/packages/jest-transform/package.json @@ -12,7 +12,7 @@ "@babel/core": "^7.1.0", "@jest/types": "^24.9.0", "babel-plugin-istanbul": "^5.1.0", - "chalk": "^2.0.1", + "chalk": "^3.0.0", "convert-source-map": "^1.4.0", "fast-json-stable-stringify": "^2.0.0", "graceful-fs": "^4.2.3", diff --git a/packages/jest-transform/src/enhanceUnexpectedTokenMessage.ts b/packages/jest-transform/src/enhanceUnexpectedTokenMessage.ts index 0b5e3661d1c5..0e146d8944b0 100644 --- a/packages/jest-transform/src/enhanceUnexpectedTokenMessage.ts +++ b/packages/jest-transform/src/enhanceUnexpectedTokenMessage.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import chalk from 'chalk'; +import chalk = require('chalk'); const DOT = ' \u2022 '; diff --git a/packages/jest-types/package.json b/packages/jest-types/package.json index b2e3909fb047..fae461172159 100644 --- a/packages/jest-types/package.json +++ b/packages/jest-types/package.json @@ -15,7 +15,8 @@ "dependencies": { "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^13.0.0" + "@types/yargs": "^13.0.0", + "chalk": "^3.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/jest-types/src/Config.ts b/packages/jest-types/src/Config.ts index ec9ad63921b0..3cb344ce9932 100644 --- a/packages/jest-types/src/Config.ts +++ b/packages/jest-types/src/Config.ts @@ -7,6 +7,7 @@ import {Arguments} from 'yargs'; import {ReportOptions} from 'istanbul-reports'; +import chalk = require('chalk'); export type Path = string; @@ -112,7 +113,7 @@ export type DisplayName = | string | { name: string; - color: DisplayNameColor; + color: typeof chalk.Color; }; export type InitialOptionsWithRootDir = InitialOptions & @@ -240,47 +241,6 @@ type NotifyMode = | 'success-change' | 'failure-change'; -/** - * Hard coding this until - * https://github.com/chalk/chalk/pull/336 - * gets merged - */ -type DisplayNameColor = - | 'black' - | 'red' - | 'green' - | 'yellow' - | 'blue' - | 'magenta' - | 'cyan' - | 'white' - | 'gray' - | 'grey' - | 'blackBright' - | 'redBright' - | 'greenBright' - | 'yellowBright' - | 'blueBright' - | 'magentaBright' - | 'cyanBright' - | 'whiteBright' - | 'bgBlack' - | 'bgRed' - | 'bgGreen' - | 'bgYellow' - | 'bgBlue' - | 'bgMagenta' - | 'bgCyan' - | 'bgWhite' - | 'bgBlackBright' - | 'bgRedBright' - | 'bgGreenBright' - | 'bgYellowBright' - | 'bgBlueBright' - | 'bgMagentaBright' - | 'bgCyanBright' - | 'bgWhiteBright'; - export type CoverageThresholdValue = { branches?: number; functions?: number; diff --git a/packages/jest-util/package.json b/packages/jest-util/package.json index e2d3e4c6bb4c..4dff39900f15 100644 --- a/packages/jest-util/package.json +++ b/packages/jest-util/package.json @@ -11,7 +11,7 @@ "types": "build/index.d.ts", "dependencies": { "@jest/types": "^24.9.0", - "chalk": "^2.0.1", + "chalk": "^3.0.0", "is-ci": "^2.0.0", "mkdirp": "^0.5.1" }, diff --git a/packages/jest-util/src/preRunMessage.ts b/packages/jest-util/src/preRunMessage.ts index 100d4226a245..5f60c71f26d9 100644 --- a/packages/jest-util/src/preRunMessage.ts +++ b/packages/jest-util/src/preRunMessage.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import chalk from 'chalk'; +import chalk = require('chalk'); import clearLine from './clearLine'; import isInteractive from './isInteractive'; diff --git a/packages/jest-validate/package.json b/packages/jest-validate/package.json index 2c9974f894ed..4d2fcae115fb 100644 --- a/packages/jest-validate/package.json +++ b/packages/jest-validate/package.json @@ -12,7 +12,7 @@ "dependencies": { "@jest/types": "^24.9.0", "camelcase": "^5.3.1", - "chalk": "^2.0.1", + "chalk": "^3.0.0", "jest-get-type": "^24.9.0", "leven": "^3.1.0", "pretty-format": "^24.9.0" diff --git a/packages/jest-validate/src/__tests__/__snapshots__/validate.test.ts.snap b/packages/jest-validate/src/__tests__/__snapshots__/validate.test.ts.snap index 5834cb065fdc..eeaf59c1a094 100644 --- a/packages/jest-validate/src/__tests__/__snapshots__/validate.test.ts.snap +++ b/packages/jest-validate/src/__tests__/__snapshots__/validate.test.ts.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Repeated types within multiple valid examples are coalesced in error report 1`] = ` -" Validation Error: +" Validation Error: Option \\"foo\\" must be of type: - string or number + string or number but instead received: - boolean + boolean Example: { @@ -28,7 +28,7 @@ exports[`Repeated types within multiple valid examples are coalesced in error re `; exports[`displays warning for deprecated config options 1`] = ` -" Deprecation Warning: +" Deprecation Warning: Option scriptPreprocessor was replaced by transform, which support multiple preprocessors. @@ -42,7 +42,7 @@ exports[`displays warning for deprecated config options 1`] = ` `; exports[`displays warning for unknown config options 1`] = ` -" Validation Warning: +" Validation Warning: Unknown option \\"unkwon\\" with value {} was found. Did you mean \\"unknown\\"? This is probably a typing mistake. Fixing it will remove this message. @@ -50,12 +50,12 @@ exports[`displays warning for unknown config options 1`] = ` `; exports[`pretty prints valid config for Array 1`] = ` -" Validation Error: +" Validation Error: Option \\"coverageReporters\\" must be of type: - array + array but instead received: - object + object Example: { @@ -70,12 +70,12 @@ exports[`pretty prints valid config for Array 1`] = ` `; exports[`pretty prints valid config for Boolean 1`] = ` -" Validation Error: +" Validation Error: Option \\"automock\\" must be of type: - boolean + boolean but instead received: - array + array Example: { @@ -85,12 +85,12 @@ exports[`pretty prints valid config for Boolean 1`] = ` `; exports[`pretty prints valid config for Function 1`] = ` -" Validation Error: +" Validation Error: Option \\"fn\\" must be of type: - function + function but instead received: - string + string Example: { @@ -100,12 +100,12 @@ exports[`pretty prints valid config for Function 1`] = ` `; exports[`pretty prints valid config for Object 1`] = ` -" Validation Error: +" Validation Error: Option \\"haste\\" must be of type: - object + object but instead received: - number + number Example: { @@ -120,12 +120,12 @@ exports[`pretty prints valid config for Object 1`] = ` `; exports[`pretty prints valid config for String 1`] = ` -" Validation Error: +" Validation Error: Option \\"preset\\" must be of type: - string + string but instead received: - number + number Example: { @@ -135,12 +135,12 @@ exports[`pretty prints valid config for String 1`] = ` `; exports[`reports errors nicely when failing with multiple valid options 1`] = ` -" Validation Error: +" Validation Error: Option \\"foo\\" must be of type: - string or array + string or array but instead received: - number + number Example: { @@ -176,9 +176,9 @@ exports[`works with custom errors 1`] = ` "My Custom Error: Option \\"test\\" must be of type: - array + array but instead received: - string + string Example: { diff --git a/packages/jest-validate/src/__tests__/__snapshots__/validateCLIOptions.test.js.snap b/packages/jest-validate/src/__tests__/__snapshots__/validateCLIOptions.test.js.snap index 3bdd2c0bb8b5..dc3b83921154 100644 --- a/packages/jest-validate/src/__tests__/__snapshots__/validateCLIOptions.test.js.snap +++ b/packages/jest-validate/src/__tests__/__snapshots__/validateCLIOptions.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`fails for multiple unknown options 1`] = ` -" Unrecognized CLI Parameters: +" Unrecognized CLI Parameters: Following options were not recognized: [\\"jest\\", \\"test\\"] @@ -12,7 +12,7 @@ exports[`fails for multiple unknown options 1`] = ` `; exports[`fails for unknown option 1`] = ` -" Unrecognized CLI Parameter: +" Unrecognized CLI Parameter: Unrecognized option \\"unknown\\". diff --git a/packages/jest-validate/src/__tests__/fixtures/jestConfig.ts b/packages/jest-validate/src/__tests__/fixtures/jestConfig.ts index 4bdaf9dbad53..3e841c5bbf36 100644 --- a/packages/jest-validate/src/__tests__/fixtures/jestConfig.ts +++ b/packages/jest-validate/src/__tests__/fixtures/jestConfig.ts @@ -7,7 +7,7 @@ import {tmpdir} from 'os'; import * as path from 'path'; -import chalk from 'chalk'; +import chalk = require('chalk'); const NODE_MODULES = path.sep + 'node_modules' + path.sep; const replacePathSepForRegex = (string: string) => { diff --git a/packages/jest-validate/src/errors.ts b/packages/jest-validate/src/errors.ts index 564220aab694..d80d8a721ec6 100644 --- a/packages/jest-validate/src/errors.ts +++ b/packages/jest-validate/src/errors.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import chalk from 'chalk'; +import chalk = require('chalk'); import getType = require('jest-get-type'); import {ERROR, ValidationError, formatPrettyObject} from './utils'; import {getValues} from './condition'; diff --git a/packages/jest-validate/src/utils.ts b/packages/jest-validate/src/utils.ts index b75cc4943472..7c2cc5c721dc 100644 --- a/packages/jest-validate/src/utils.ts +++ b/packages/jest-validate/src/utils.ts @@ -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'); import leven from 'leven'; diff --git a/packages/jest-validate/src/validateCLIOptions.ts b/packages/jest-validate/src/validateCLIOptions.ts index a10bd24ba8aa..a1353b90407a 100644 --- a/packages/jest-validate/src/validateCLIOptions.ts +++ b/packages/jest-validate/src/validateCLIOptions.ts @@ -6,7 +6,7 @@ */ import {Config} from '@jest/types'; -import chalk from 'chalk'; +import chalk = require('chalk'); import camelcase from 'camelcase'; // eslint-disable-next-line import/no-extraneous-dependencies import {Options} from 'yargs'; diff --git a/packages/jest-validate/src/warnings.ts b/packages/jest-validate/src/warnings.ts index b8937ae032d6..ab9c4c437752 100644 --- a/packages/jest-validate/src/warnings.ts +++ b/packages/jest-validate/src/warnings.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import chalk from 'chalk'; +import chalk = require('chalk'); import {ValidationOptions} from './types'; import { WARNING, diff --git a/packages/jest-watcher/package.json b/packages/jest-watcher/package.json index bf867c8b351e..a9acc3512b28 100644 --- a/packages/jest-watcher/package.json +++ b/packages/jest-watcher/package.json @@ -8,7 +8,7 @@ "@jest/types": "^24.9.0", "@types/yargs": "^13.0.0", "ansi-escapes": "^4.2.1", - "chalk": "^2.0.1", + "chalk": "^3.0.0", "jest-util": "^24.9.0", "string-length": "^3.1.0" }, diff --git a/packages/jest-watcher/src/PatternPrompt.ts b/packages/jest-watcher/src/PatternPrompt.ts index fbb17ea4244b..b3c8ceb434e2 100644 --- a/packages/jest-watcher/src/PatternPrompt.ts +++ b/packages/jest-watcher/src/PatternPrompt.ts @@ -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 {specialChars} from 'jest-util'; import Prompt from './lib/Prompt'; diff --git a/packages/jest-watcher/src/lib/colorize.ts b/packages/jest-watcher/src/lib/colorize.ts index 8adf88ae2df1..cad555eb37ae 100644 --- a/packages/jest-watcher/src/lib/colorize.ts +++ b/packages/jest-watcher/src/lib/colorize.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import chalk from 'chalk'; +import chalk = require('chalk'); export default (str: string, start: number, end: number) => chalk.dim(str.slice(0, start)) + diff --git a/packages/jest-watcher/src/lib/formatTestNameByPattern.ts b/packages/jest-watcher/src/lib/formatTestNameByPattern.ts index b941c9887758..222992c68491 100644 --- a/packages/jest-watcher/src/lib/formatTestNameByPattern.ts +++ b/packages/jest-watcher/src/lib/formatTestNameByPattern.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import chalk from 'chalk'; +import chalk = require('chalk'); import colorize from './colorize'; diff --git a/packages/jest-watcher/src/lib/patternModeHelpers.ts b/packages/jest-watcher/src/lib/patternModeHelpers.ts index 9b47ecd43a94..5554b5e755bd 100644 --- a/packages/jest-watcher/src/lib/patternModeHelpers.ts +++ b/packages/jest-watcher/src/lib/patternModeHelpers.ts @@ -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 stringLength = require('string-length'); diff --git a/yarn.lock b/yarn.lock index 11ebbb06dbd5..b7c2c7c1eeb5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3735,6 +3735,14 @@ chalk@2.4.2, chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.1, chalk@^2.4. escape-string-regexp "^1.0.5" supports-color "^5.3.0" +chalk@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4" + integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + character-entities-legacy@^1.0.0: version "1.1.3" resolved "https://registry.yarnpkg.com/character-entities-legacy/-/character-entities-legacy-1.1.3.tgz#3c729991d9293da0ede6dddcaf1f2ce1009ee8b4" @@ -13151,7 +13159,7 @@ supports-color@^6.1.0: dependencies: has-flag "^3.0.0" -supports-color@^7.0.0: +supports-color@^7.0.0, supports-color@^7.1.0: version "7.1.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.1.0.tgz#68e32591df73e25ad1c4b49108a2ec507962bfd1" integrity sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==