Skip to content

Commit

Permalink
chore(jest-console): migrate function signature (#10126)
Browse files Browse the repository at this point in the history
  • Loading branch information
ychi committed Nov 15, 2020
1 parent c8418df commit a9d2bb1
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 23 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -19,6 +19,7 @@

### Chore & Maintenance

- `[jest-console]` [**BREAKING**] Move `root` into `config` and take `GlobalConfig` as mandatory parameter for `getConsoleOutput` ([#10126](https://github.com/facebook/jest/pull/10126))
- `[*]` [**BREAKING**] Only support Node LTS releases and Node 15 ([#10685](https://github.com/facebook/jest/pull/10685))
- `[*]` [**BREAKING**] Add `exports` field to all `package.json`s ([#9921](https://github.com/facebook/jest/pull/9921))
- `[*]` Make it easier for Jest's packages to use the VM escape hatch ([#10824](https://github.com/facebook/jest/pull/10824))
Expand Down
2 changes: 0 additions & 2 deletions packages/jest-console/src/__tests__/getConsoleOutput.test.ts
Expand Up @@ -35,8 +35,6 @@ describe('getConsoleOutput', () => {
${'warn'}
`('takes noStackTrace and pass it on for $logType', logType => {
getConsoleOutput(
'someRootPath',
true,
BufferedConsole.write([], logType as LogType, 'message', 4),
{
rootDir: 'root',
Expand Down
15 changes: 3 additions & 12 deletions packages/jest-console/src/getConsoleOutput.ts
Expand Up @@ -15,20 +15,11 @@ import {
import type {ConsoleBuffer} from './types';

export default (
// TODO: remove in 27
root: string,
// TODO: this is covered by GlobalConfig, switch over in 27
verbose: boolean,
buffer: ConsoleBuffer,
// TODO: make mandatory and take Config.ProjectConfig in 27
config: StackTraceConfig = {
rootDir: root,
testMatch: [],
},
// TODO: make mandatory in 27
globalConfig?: Config.GlobalConfig,
config: StackTraceConfig,
globalConfig: Config.GlobalConfig,
): string => {
const TITLE_INDENT = verbose ? ' ' : ' ';
const TITLE_INDENT = globalConfig.verbose ? ' ' : ' ';
const CONSOLE_INDENT = TITLE_INDENT + ' ';

const logEntries = buffer.reduce((output, {type, message, origin}) => {
Expand Down
8 changes: 1 addition & 7 deletions packages/jest-reporters/src/DefaultReporter.ts
Expand Up @@ -186,13 +186,7 @@ export default class DefaultReporter extends BaseReporter {
' ' +
TITLE_BULLET +
'Console\n\n' +
getConsoleOutput(
config.cwd,
!!this._globalConfig.verbose,
result.console,
config,
this._globalConfig,
),
getConsoleOutput(result.console, config, this._globalConfig),
);
}
}
Expand Down
2 changes: 0 additions & 2 deletions packages/jest-runner/src/runTest.ts
Expand Up @@ -120,8 +120,6 @@ async function runTestInternal(
const consoleOut = globalConfig.useStderr ? process.stderr : process.stdout;
const consoleFormatter = (type: LogType, message: LogMessage) =>
getConsoleOutput(
config.cwd,
!!globalConfig.verbose,
// 4 = the console call is buried 4 stack frames deep
BufferedConsole.write([], type, message, 4),
config,
Expand Down

0 comments on commit a9d2bb1

Please sign in to comment.