From a3ea26c388486c50772fd9431a360d495266005d Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Sun, 3 Mar 2019 16:39:47 +0100 Subject: [PATCH] chore: create new `@jest/console` package --- CHANGELOG.md | 1 + .../consoleAfterTeardown.test.ts.snap | 2 +- packages/jest-console/.npmignore | 3 ++ packages/jest-console/package.json | 25 +++++++++++++ .../src/BufferedConsole.ts | 26 ++++++++------ .../src/CustomConsole.ts | 21 ++++++----- .../src/NullConsole.ts | 0 .../src/__tests__/bufferedConsole.test.ts | 0 .../src/__tests__/console.test.ts | 0 .../src/getConsoleOutput.ts | 8 ++--- packages/jest-console/src/index.ts | 12 +++++++ .../Console.ts => jest-console/src/types.ts} | 0 packages/jest-console/tsconfig.json | 10 ++++++ packages/jest-core/package.json | 1 + .../jest-core/src/__tests__/run_jest.test.js | 2 +- packages/jest-core/src/cli/index.ts | 5 +-- packages/jest-core/src/runJest.ts | 9 ++--- packages/jest-core/tsconfig.json | 1 + packages/jest-runner/package.json | 1 + packages/jest-runner/src/runTest.ts | 36 ++++++++++--------- packages/jest-runner/tsconfig.json | 1 + packages/jest-runtime/package.json | 1 + packages/jest-runtime/src/cli/index.ts | 5 +-- packages/jest-runtime/tsconfig.json | 1 + packages/jest-types/package.json | 1 + packages/jest-types/src/TestResult.ts | 2 +- packages/jest-types/src/index.ts | 3 +- packages/jest-types/tsconfig.json | 5 ++- packages/jest-util/package.json | 1 + packages/jest-util/src/index.ts | 12 ++++--- packages/jest-util/tsconfig.json | 1 + 31 files changed, 135 insertions(+), 61 deletions(-) create mode 100644 packages/jest-console/.npmignore create mode 100644 packages/jest-console/package.json rename packages/{jest-util => jest-console}/src/BufferedConsole.ts (88%) rename packages/{jest-util => jest-console}/src/CustomConsole.ts (87%) rename packages/{jest-util => jest-console}/src/NullConsole.ts (100%) rename packages/{jest-util => jest-console}/src/__tests__/bufferedConsole.test.ts (100%) rename packages/{jest-util => jest-console}/src/__tests__/console.test.ts (100%) rename packages/{jest-util => jest-console}/src/getConsoleOutput.ts (89%) create mode 100644 packages/jest-console/src/index.ts rename packages/{jest-types/src/Console.ts => jest-console/src/types.ts} (100%) create mode 100644 packages/jest-console/tsconfig.json diff --git a/CHANGELOG.md b/CHANGELOG.md index a22b3f2bbf6c..02a4ee7443f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -79,6 +79,7 @@ - `[docs]`: Update CONTRIBUTING.md to add information about running jest with `jest-circus` locally ([#8013](https://github.com/facebook/jest/pull/8013)). - `[@jest/core]`: Migrate to TypeScript ([#7998](https://github.com/facebook/jest/pull/7998)) - `[@jest/source-map]`: Extract `getCallsite` function from `jest-util` into a new separate package ([#8029](https://github.com/facebook/jest/pull/8029)) +- `[@jest/console]`: Extract custom `console` implementations from `jest-util` into a new separate package ([#8030](https://github.com/facebook/jest/pull/8030)) ### Performance diff --git a/e2e/__tests__/__snapshots__/consoleAfterTeardown.test.ts.snap b/e2e/__tests__/__snapshots__/consoleAfterTeardown.test.ts.snap index 19dd01c49fcf..13d01c6299aa 100644 --- a/e2e/__tests__/__snapshots__/consoleAfterTeardown.test.ts.snap +++ b/e2e/__tests__/__snapshots__/consoleAfterTeardown.test.ts.snap @@ -15,6 +15,6 @@ PASS __tests__/console.test.js 15 | }); 16 | - at BufferedConsole.log (../../packages/jest-util/build/BufferedConsole.js:180:10) + at BufferedConsole.log (../../packages/jest-console/build/BufferedConsole.js:180:10) at log (__tests__/console.test.js:13:13) `; diff --git a/packages/jest-console/.npmignore b/packages/jest-console/.npmignore new file mode 100644 index 000000000000..85e48fe7b0a4 --- /dev/null +++ b/packages/jest-console/.npmignore @@ -0,0 +1,3 @@ +**/__mocks__/** +**/__tests__/** +src diff --git a/packages/jest-console/package.json b/packages/jest-console/package.json new file mode 100644 index 000000000000..f934bddceb67 --- /dev/null +++ b/packages/jest-console/package.json @@ -0,0 +1,25 @@ +{ + "name": "@jest/console", + "version": "24.1.0", + "repository": { + "type": "git", + "url": "https://github.com/facebook/jest.git", + "directory": "packages/jest-console" + }, + "license": "MIT", + "main": "build/index.js", + "types": "build/index.d.ts", + "dependencies": { + "@jest/source-map": "^24.1.0", + "@types/node": "*", + "chalk": "^2.0.1", + "slash": "^2.0.0" + }, + "devDependencies": { + "@types/slash": "^2.0.0" + }, + "engines": { + "node": ">= 6" + }, + "gitHead": "634e5a54f46b2a62d1dc81a170562e6f4e55ad60" +} diff --git a/packages/jest-util/src/BufferedConsole.ts b/packages/jest-console/src/BufferedConsole.ts similarity index 88% rename from packages/jest-util/src/BufferedConsole.ts rename to packages/jest-console/src/BufferedConsole.ts index 989fda5c0d91..0a4f125d705d 100644 --- a/packages/jest-util/src/BufferedConsole.ts +++ b/packages/jest-console/src/BufferedConsole.ts @@ -9,18 +9,24 @@ import assert from 'assert'; import {Console} from 'console'; import {format} from 'util'; import chalk from 'chalk'; -import {Console as ConsoleType} from '@jest/types'; import {getCallsite, SourceMapRegistry} from '@jest/source-map'; +import { + ConsoleBuffer, + LogCounters, + LogMessage, + LogTimers, + LogType, +} from './types'; export default class BufferedConsole extends Console { - private _buffer: ConsoleType.ConsoleBuffer; - private _counters: ConsoleType.LogCounters; - private _timers: ConsoleType.LogTimers; + private _buffer: ConsoleBuffer; + private _counters: LogCounters; + private _timers: LogTimers; private _groupDepth: number; private _getSourceMaps: () => SourceMapRegistry | null | undefined; constructor(getSourceMaps: () => SourceMapRegistry | null | undefined) { - const buffer: ConsoleType.ConsoleBuffer = []; + const buffer: ConsoleBuffer = []; super({ write: (message: string) => { BufferedConsole.write(buffer, 'log', message, null, getSourceMaps()); @@ -36,9 +42,9 @@ export default class BufferedConsole extends Console { } static write( - buffer: ConsoleType.ConsoleBuffer, - type: ConsoleType.LogType, - message: ConsoleType.LogMessage, + buffer: ConsoleBuffer, + type: LogType, + message: LogMessage, level?: number | null, sourceMaps?: SourceMapRegistry | null, ) { @@ -54,7 +60,7 @@ export default class BufferedConsole extends Console { return buffer; } - private _log(type: ConsoleType.LogType, message: ConsoleType.LogMessage) { + private _log(type: LogType, message: LogMessage) { BufferedConsole.write( this._buffer, type, @@ -153,7 +159,7 @@ export default class BufferedConsole extends Console { this._log('warn', format(firstArg, ...rest)); } - getBuffer(): ConsoleType.ConsoleBuffer { + getBuffer(): ConsoleBuffer { return this._buffer; } } diff --git a/packages/jest-util/src/CustomConsole.ts b/packages/jest-console/src/CustomConsole.ts similarity index 87% rename from packages/jest-util/src/CustomConsole.ts rename to packages/jest-console/src/CustomConsole.ts index a2a3fb9a8950..758f3f53b7ba 100644 --- a/packages/jest-util/src/CustomConsole.ts +++ b/packages/jest-console/src/CustomConsole.ts @@ -9,19 +9,22 @@ import assert from 'assert'; import {format} from 'util'; import {Console} from 'console'; import chalk from 'chalk'; -import {Console as ConsoleType} from '@jest/types'; -import clearLine from './clearLine'; +import {LogCounters, LogMessage, LogTimers, LogType} from './types'; -type Formatter = ( - type: ConsoleType.LogType, - message: ConsoleType.LogMessage, -) => string; +// TODO: Copied from `jest-util`. Import from it in Jest 25 +function clearLine(stream: NodeJS.WritableStream) { + if (process.stdout.isTTY) { + stream.write('\x1b[999D\x1b[K'); + } +} + +type Formatter = (type: LogType, message: LogMessage) => string; export default class CustomConsole extends Console { private _stdout: NodeJS.WritableStream; private _formatBuffer: Formatter; - private _counters: ConsoleType.LogCounters; - private _timers: ConsoleType.LogTimers; + private _counters: LogCounters; + private _timers: LogTimers; private _groupDepth: number; constructor( @@ -41,7 +44,7 @@ export default class CustomConsole extends Console { super.log(message); } - private _log(type: ConsoleType.LogType, message: string) { + private _log(type: LogType, message: string) { clearLine(this._stdout); this._logToParentConsole( this._formatBuffer(type, ' '.repeat(this._groupDepth) + message), diff --git a/packages/jest-util/src/NullConsole.ts b/packages/jest-console/src/NullConsole.ts similarity index 100% rename from packages/jest-util/src/NullConsole.ts rename to packages/jest-console/src/NullConsole.ts diff --git a/packages/jest-util/src/__tests__/bufferedConsole.test.ts b/packages/jest-console/src/__tests__/bufferedConsole.test.ts similarity index 100% rename from packages/jest-util/src/__tests__/bufferedConsole.test.ts rename to packages/jest-console/src/__tests__/bufferedConsole.test.ts diff --git a/packages/jest-util/src/__tests__/console.test.ts b/packages/jest-console/src/__tests__/console.test.ts similarity index 100% rename from packages/jest-util/src/__tests__/console.test.ts rename to packages/jest-console/src/__tests__/console.test.ts diff --git a/packages/jest-util/src/getConsoleOutput.ts b/packages/jest-console/src/getConsoleOutput.ts similarity index 89% rename from packages/jest-util/src/getConsoleOutput.ts rename to packages/jest-console/src/getConsoleOutput.ts index 1d3b9da964e2..1401b85a4ccd 100644 --- a/packages/jest-util/src/getConsoleOutput.ts +++ b/packages/jest-console/src/getConsoleOutput.ts @@ -8,13 +8,9 @@ import path from 'path'; import chalk from 'chalk'; import slash from 'slash'; -import {Console} from '@jest/types'; +import {ConsoleBuffer} from './types'; -export default ( - root: string, - verbose: boolean, - buffer: Console.ConsoleBuffer, -) => { +export default (root: string, verbose: boolean, buffer: ConsoleBuffer) => { const TITLE_INDENT = verbose ? ' ' : ' '; const CONSOLE_INDENT = TITLE_INDENT + ' '; diff --git a/packages/jest-console/src/index.ts b/packages/jest-console/src/index.ts new file mode 100644 index 000000000000..8734d06f2271 --- /dev/null +++ b/packages/jest-console/src/index.ts @@ -0,0 +1,12 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +export {default as BufferedConsole} from './BufferedConsole'; +export {default as CustomConsole} from './CustomConsole'; +export {default as NullConsole} from './NullConsole'; +export {default as getConsoleOutput} from './getConsoleOutput'; +export {ConsoleBuffer, LogMessage, LogType} from './types'; diff --git a/packages/jest-types/src/Console.ts b/packages/jest-console/src/types.ts similarity index 100% rename from packages/jest-types/src/Console.ts rename to packages/jest-console/src/types.ts diff --git a/packages/jest-console/tsconfig.json b/packages/jest-console/tsconfig.json new file mode 100644 index 000000000000..d38e7a48fd1c --- /dev/null +++ b/packages/jest-console/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "build" + }, + "references": [ + {"path": "../jest-source-map"} + ] +} diff --git a/packages/jest-core/package.json b/packages/jest-core/package.json index cc35ed46893d..2d3c7f2ac4fd 100644 --- a/packages/jest-core/package.json +++ b/packages/jest-core/package.json @@ -5,6 +5,7 @@ "main": "build/jest.js", "types": "build/jest.d.ts", "dependencies": { + "@jest/console": "^24.1.0", "@jest/types": "^24.1.0", "@jest/reporters": "^24.1.0", "@jest/transform": "^24.1.0", diff --git a/packages/jest-core/src/__tests__/run_jest.test.js b/packages/jest-core/src/__tests__/run_jest.test.js index f312f48d5323..3c4c6d170cbc 100644 --- a/packages/jest-core/src/__tests__/run_jest.test.js +++ b/packages/jest-core/src/__tests__/run_jest.test.js @@ -2,7 +2,7 @@ import runJest from '../runJest'; -jest.mock('jest-util'); +jest.mock('@jest/console'); const processErrWriteFn = process.stderr.write; describe('runJest', () => { diff --git a/packages/jest-core/src/cli/index.ts b/packages/jest-core/src/cli/index.ts index a3837305829b..6f7f987791b4 100644 --- a/packages/jest-core/src/cli/index.ts +++ b/packages/jest-core/src/cli/index.ts @@ -6,7 +6,8 @@ */ import {Config, TestResult} from '@jest/types'; -import {Console, createDirectory, preRunMessage} from 'jest-util'; +import {CustomConsole} from '@jest/console'; +import {createDirectory, preRunMessage} from 'jest-util'; import {readConfigs} from 'jest-config'; import Runtime, {Context} from 'jest-runtime'; import {ChangedFilesPromise} from 'jest-changed-files'; @@ -118,7 +119,7 @@ const buildContextsAndHasteMaps = async ( configs.map(async (config, index) => { createDirectory(config.cacheDirectory); const hasteMapInstance = Runtime.createHasteMap(config, { - console: new Console(outputStream, outputStream), + console: new CustomConsole(outputStream, outputStream), maxWorkers: globalConfig.maxWorkers, resetCache: !config.cache, watch: globalConfig.watch || globalConfig.watchAll, diff --git a/packages/jest-core/src/runJest.ts b/packages/jest-core/src/runJest.ts index e6f7e16e6d96..976c27a42f14 100644 --- a/packages/jest-core/src/runJest.ts +++ b/packages/jest-core/src/runJest.ts @@ -8,7 +8,8 @@ import path from 'path'; import chalk from 'chalk'; import {sync as realpath} from 'realpath-native'; -import {Console, formatTestResults} from 'jest-util'; +import {CustomConsole} from '@jest/console'; +import {formatTestResults} from 'jest-util'; import exit from 'exit'; import fs from 'graceful-fs'; import {JestHook, JestHookEmitter} from 'jest-watcher'; @@ -38,7 +39,7 @@ const getTestPaths = async ( const data = await source.getTestPaths(globalConfig, changedFiles); if (!data.tests.length && globalConfig.onlyChanged && data.noSCM) { - new Console(outputStream, outputStream).log( + new CustomConsole(outputStream, outputStream).log( 'Jest can only find uncommitted changed files in a git or hg ' + 'repository. If you make your project a git or hg ' + 'repository (`git init` or `hg init`), Jest will be able ' + @@ -204,9 +205,9 @@ export default (async function runJest({ globalConfig.lastCommit || globalConfig.onlyChanged ) { - new Console(outputStream, outputStream).log(noTestsFoundMessage); + new CustomConsole(outputStream, outputStream).log(noTestsFoundMessage); } else { - new Console(outputStream, outputStream).error(noTestsFoundMessage); + new CustomConsole(outputStream, outputStream).error(noTestsFoundMessage); exit(1); } diff --git a/packages/jest-core/tsconfig.json b/packages/jest-core/tsconfig.json index 3e44249a9879..b235da20ff81 100644 --- a/packages/jest-core/tsconfig.json +++ b/packages/jest-core/tsconfig.json @@ -8,6 +8,7 @@ "references": [ {"path": "../jest-changed-files"}, {"path": "../jest-config"}, + {"path": "../jest-console"}, {"path": "../jest-haste-map"}, {"path": "../jest-message-util"}, {"path": "../jest-regex-util"}, diff --git a/packages/jest-runner/package.json b/packages/jest-runner/package.json index 024e7d04e3c7..eca46c1cfd29 100644 --- a/packages/jest-runner/package.json +++ b/packages/jest-runner/package.json @@ -10,6 +10,7 @@ "main": "build/index.js", "types": "build/index.d.ts", "dependencies": { + "@jest/console": "^24.1.0", "@jest/environment": "^24.1.0", "@jest/types": "^24.1.0", "chalk": "^2.4.2", diff --git a/packages/jest-runner/src/runTest.ts b/packages/jest-runner/src/runTest.ts index 2bda5aa71b3c..ebbae640c6d3 100644 --- a/packages/jest-runner/src/runTest.ts +++ b/packages/jest-runner/src/runTest.ts @@ -6,18 +6,19 @@ * */ -import {Config, TestResult, Console as ConsoleType} from '@jest/types'; -import {JestEnvironment} from '@jest/environment'; -import RuntimeClass from 'jest-runtime'; -import fs from 'graceful-fs'; +import {Config, TestResult} from '@jest/types'; import { BufferedConsole, - Console, - ErrorWithStack, + CustomConsole, NullConsole, + LogType, + LogMessage, getConsoleOutput, - setGlobal, -} from 'jest-util'; +} from '@jest/console'; +import {JestEnvironment} from '@jest/environment'; +import RuntimeClass from 'jest-runtime'; +import fs from 'graceful-fs'; +import {ErrorWithStack, setGlobal} from 'jest-util'; import LeakDetector from 'jest-leak-detector'; import Resolver from 'jest-resolve'; import {getTestEnvironment} from 'jest-config'; @@ -35,13 +36,13 @@ type RunTestInternalResult = { }; function freezeConsole( - // @ts-ignore: Correct types when `jest-util` is ESM - testConsole: BufferedConsole | Console | NullConsole, + testConsole: BufferedConsole | CustomConsole | NullConsole, config: Config.ProjectConfig, ) { + // @ts-ignore: `_log` is `private` - we should figure out some proper API here testConsole._log = function fakeConsolePush( - _type: ConsoleType.LogType, - message: ConsoleType.LogMessage, + _type: LogType, + message: LogMessage, ) { const error = new ErrorWithStack( `${chalk.red( @@ -114,10 +115,7 @@ async function runTestInternal( let runtime: RuntimeClass | undefined = undefined; const consoleOut = globalConfig.useStderr ? process.stderr : process.stdout; - const consoleFormatter = ( - type: ConsoleType.LogType, - message: ConsoleType.LogMessage, - ) => + const consoleFormatter = (type: LogType, message: LogMessage) => getConsoleOutput( config.cwd, !!globalConfig.verbose, @@ -136,7 +134,11 @@ async function runTestInternal( if (globalConfig.silent) { testConsole = new NullConsole(consoleOut, process.stderr, consoleFormatter); } else if (globalConfig.verbose) { - testConsole = new Console(consoleOut, process.stderr, consoleFormatter); + testConsole = new CustomConsole( + consoleOut, + process.stderr, + consoleFormatter, + ); } else { testConsole = new BufferedConsole(() => runtime && runtime.getSourceMaps()); } diff --git a/packages/jest-runner/tsconfig.json b/packages/jest-runner/tsconfig.json index 2b89d723edb6..e541cc3f572c 100644 --- a/packages/jest-runner/tsconfig.json +++ b/packages/jest-runner/tsconfig.json @@ -6,6 +6,7 @@ }, "references": [ {"path": "../jest-config"}, + {"path": "../jest-console"}, {"path": "../jest-docblock"}, {"path": "../jest-environment"}, {"path": "../jest-haste-map"}, diff --git a/packages/jest-runtime/package.json b/packages/jest-runtime/package.json index 2015d8139ca5..1e1ede4e1d43 100644 --- a/packages/jest-runtime/package.json +++ b/packages/jest-runtime/package.json @@ -10,6 +10,7 @@ "main": "build/index.js", "types": "build/index.d.ts", "dependencies": { + "@jest/console": "^24.1.0", "@jest/environment": "^24.1.0", "@jest/source-map": "^24.1.0", "@jest/transform": "^24.1.0", diff --git a/packages/jest-runtime/src/cli/index.ts b/packages/jest-runtime/src/cli/index.ts index 381b300e0078..6e776508a8f9 100644 --- a/packages/jest-runtime/src/cli/index.ts +++ b/packages/jest-runtime/src/cli/index.ts @@ -12,7 +12,8 @@ import {sync as realpath} from 'realpath-native'; import yargs from 'yargs'; import {Config} from '@jest/types'; import {JestEnvironment} from '@jest/environment'; -import {Console, setGlobal} from 'jest-util'; +import {CustomConsole} from '@jest/console'; +import {setGlobal} from 'jest-util'; import {validateCLIOptions} from 'jest-validate'; import {readConfig, deprecationEntries} from 'jest-config'; import {VERSION} from '../version'; @@ -86,7 +87,7 @@ export function run(cliArgv?: Config.Argv, cliInfo?: Array) { setGlobal( environment.global, 'console', - new Console(process.stdout, process.stderr), + new CustomConsole(process.stdout, process.stderr), ); setGlobal(environment.global, 'jestProjectConfig', config); setGlobal(environment.global, 'jestGlobalConfig', globalConfig); diff --git a/packages/jest-runtime/tsconfig.json b/packages/jest-runtime/tsconfig.json index 51952766fb90..2892d4eb078d 100644 --- a/packages/jest-runtime/tsconfig.json +++ b/packages/jest-runtime/tsconfig.json @@ -6,6 +6,7 @@ }, "references": [ {"path": "../jest-config"}, + {"path": "../jest-console"}, {"path": "../jest-environment"}, {"path": "../jest-environment-node"}, {"path": "../jest-haste-map"}, diff --git a/packages/jest-types/package.json b/packages/jest-types/package.json index 7c7cd4c7538d..2e3ce749573b 100644 --- a/packages/jest-types/package.json +++ b/packages/jest-types/package.json @@ -13,6 +13,7 @@ "main": "build/index.js", "types": "build/index.d.ts", "dependencies": { + "@jest/console": "^24.1.0", "@types/istanbul-lib-coverage": "^1.1.0" } } diff --git a/packages/jest-types/src/TestResult.ts b/packages/jest-types/src/TestResult.ts index c9434eae5a63..caa976e84a28 100644 --- a/packages/jest-types/src/TestResult.ts +++ b/packages/jest-types/src/TestResult.ts @@ -6,7 +6,7 @@ */ import {CoverageMap, CoverageMapData} from 'istanbul-lib-coverage'; -import {ConsoleBuffer} from './Console'; +import {ConsoleBuffer} from '@jest/console'; export type SerializableError = { code?: unknown; diff --git a/packages/jest-types/src/index.ts b/packages/jest-types/src/index.ts index 00215efafd54..eb28f92c93c5 100644 --- a/packages/jest-types/src/index.ts +++ b/packages/jest-types/src/index.ts @@ -6,9 +6,8 @@ */ import * as Config from './Config'; -import * as Console from './Console'; import * as Matchers from './Matchers'; import * as TestResult from './TestResult'; import * as Global from './Global'; -export {Config, Console, Matchers, TestResult, Global}; +export {Config, Matchers, TestResult, Global}; diff --git a/packages/jest-types/tsconfig.json b/packages/jest-types/tsconfig.json index 7bb06bce6d20..7808cc33f9e5 100644 --- a/packages/jest-types/tsconfig.json +++ b/packages/jest-types/tsconfig.json @@ -3,5 +3,8 @@ "compilerOptions": { "rootDir": "src", "outDir": "build" - } + }, + "references": [ + {"path": "../jest-console"} + ] } diff --git a/packages/jest-util/package.json b/packages/jest-util/package.json index 83718f437c2c..b1d9a023e075 100644 --- a/packages/jest-util/package.json +++ b/packages/jest-util/package.json @@ -10,6 +10,7 @@ "main": "build/index.js", "types": "build/index.d.ts", "dependencies": { + "@jest/console": "^24.1.0", "@jest/fake-timers": "^24.1.0", "@jest/source-map": "^24.1.0", "@jest/types": "^24.1.0", diff --git a/packages/jest-util/src/index.ts b/packages/jest-util/src/index.ts index 8171c1c18548..6495e87e1f26 100644 --- a/packages/jest-util/src/index.ts +++ b/packages/jest-util/src/index.ts @@ -5,19 +5,21 @@ * LICENSE file in the root directory of this source tree. */ -// TODO: Remove this export in the next major +// TODO: Remove these exports in the next major import {JestFakeTimers as FakeTimers} from '@jest/fake-timers'; import {getCallsite} from '@jest/source-map'; -import BufferedConsole from './BufferedConsole'; +import { + BufferedConsole, + CustomConsole, + NullConsole, + getConsoleOutput, +} from '@jest/console'; import clearLine from './clearLine'; -import CustomConsole from './CustomConsole'; import createDirectory from './createDirectory'; import ErrorWithStack from './ErrorWithStack'; import formatTestResults from './formatTestResults'; import getFailedSnapshotTests from './getFailedSnapshotTests'; -import getConsoleOutput from './getConsoleOutput'; import installCommonGlobals from './installCommonGlobals'; -import NullConsole from './NullConsole'; import isInteractive from './isInteractive'; import setGlobal from './setGlobal'; import deepCyclicCopy from './deepCyclicCopy'; diff --git a/packages/jest-util/tsconfig.json b/packages/jest-util/tsconfig.json index 506468d169f1..84ae1d60d0e8 100644 --- a/packages/jest-util/tsconfig.json +++ b/packages/jest-util/tsconfig.json @@ -5,6 +5,7 @@ "outDir": "build" }, "references": [ + {"path": "../jest-console"}, {"path": "../jest-fake-timers"}, {"path": "../jest-source-map"}, {"path": "../jest-types"}