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(jest-console): migrate function signature #10126

Merged
merged 3 commits into from
Nov 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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