Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

chore: cleanup getConsoleOutput arguments #9970

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 6 additions & 15 deletions packages/jest-console/src/getConsoleOutput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,15 @@
*/

import chalk = require('chalk');
import {
StackTraceConfig,
StackTraceOptions,
formatStackTrace,
} from 'jest-message-util';
import {StackTraceOptions, formatStackTrace} from 'jest-message-util';
import type {Config} from '@jest/types';
import type {ConsoleBuffer} from './types';

export default (
// TODO: remove in 26
root: string,
export default function getConsoleOutput(
verbose: boolean,
buffer: ConsoleBuffer,
// TODO: make mandatory and take Config.ProjectConfig in 26
config: StackTraceConfig = {
rootDir: root,
testMatch: [],
},
): string => {
config: Config.ProjectConfig,
): string {
const TITLE_INDENT = verbose ? ' ' : ' ';
const CONSOLE_INDENT = TITLE_INDENT + ' ';

Expand Down Expand Up @@ -69,4 +60,4 @@ export default (
}, '');

return logEntries.trimRight() + '\n';
};
}
1 change: 0 additions & 1 deletion packages/jest-reporters/src/default_reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ export default class DefaultReporter extends BaseReporter {
TITLE_BULLET +
'Console\n\n' +
getConsoleOutput(
config.cwd,
!!this._globalConfig.verbose,
result.console,
config,
Expand Down
1 change: 0 additions & 1 deletion packages/jest-runner/src/runTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,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),
Expand Down