Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ychi committed Apr 9, 2020
1 parent 0a1a884 commit 3e9c172
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 25 deletions.
12 changes: 4 additions & 8 deletions packages/jest-console/src/BufferedConsole.ts
Expand Up @@ -29,7 +29,7 @@ export default class BufferedConsole extends Console {
const buffer: ConsoleBuffer = [];
super({
write: (message: string) => {
BufferedConsole.write(buffer, 'log', message, null);
BufferedConsole.write(buffer, 'log', message, null);

return true;
},
Expand All @@ -47,8 +47,7 @@ export default class BufferedConsole extends Console {
level?: number | null,
): ConsoleBuffer {
const stackLevel = level != null ? level : 2;
const rawStack =
new ErrorWithStack(undefined, BufferedConsole.write).stack;
const rawStack = new ErrorWithStack(undefined, BufferedConsole.write).stack;

invariant(rawStack, 'always have a stack trace');

Expand All @@ -72,7 +71,7 @@ export default class BufferedConsole extends Console {
this._buffer,
type,
' '.repeat(this._groupDepth) + message,
3
3,
);
}

Expand Down Expand Up @@ -170,10 +169,7 @@ export default class BufferedConsole extends Console {
}
}

function invariant(
condition: unknown,
message?: string,
): asserts condition {
function invariant(condition: unknown, message?: string): asserts condition {
if (!condition) {
throw new Error(message);
}
Expand Down
11 changes: 2 additions & 9 deletions packages/jest-console/src/getConsoleOutput.ts
Expand Up @@ -7,10 +7,7 @@

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

export default (
Expand Down Expand Up @@ -50,11 +47,7 @@ export default (
noStackTrace,
};

const formattedStackTrace = formatStackTrace(
origin,
config,
options,
);
const formattedStackTrace = formatStackTrace(origin, config, options);

return (
output +
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-message-util/src/index.ts
Expand Up @@ -288,7 +288,7 @@ export const formatStackTrace = (

if (topFrame) {
const {column, file: filename, line} = topFrame;

if (line && filename && path.isAbsolute(filename)) {
let fileContent;
try {
Expand All @@ -301,7 +301,7 @@ export const formatStackTrace = (
}
}
}
}
}

const stacktrace = lines
.filter(Boolean)
Expand Down
7 changes: 1 addition & 6 deletions packages/jest-runner/src/runTest.ts
Expand Up @@ -122,12 +122,7 @@ async function runTestInternal(
config.cwd,
!!globalConfig.verbose,
// 4 = the console call is buried 4 stack frames deep
BufferedConsole.write(
[],
type,
message,
4
),
BufferedConsole.write([], type, message, 4),
config,
);

Expand Down

0 comments on commit 3e9c172

Please sign in to comment.