Skip to content

Commit

Permalink
feat: Add Console to custom console object
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark1626 committed Sep 12, 2020
1 parent aa02c2d commit a83a831
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/jest-console/src/BufferedConsole.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ export default class BufferedConsole extends Console {
this._groupDepth = 0;
}

Console: NodeJS.ConsoleConstructor = Console;

static write(
buffer: ConsoleBuffer,
type: LogType,
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-console/src/CustomConsole.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export default class CustomConsole extends Console {
this._groupDepth = 0;
}

Console: NodeJS.ConsoleConstructor = Console;

private _log(type: LogType, message: string) {
clearLine(this._stdout);
super.log(
Expand Down
6 changes: 6 additions & 0 deletions packages/jest-console/src/__tests__/CustomConsole.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,4 +224,10 @@ describe('CustomConsole', () => {
_console.timeEnd('custom');
});
});

describe('console', () => {
test('should be able to initialize console instance', () => {
expect(_console.Console).toBeDefined();
});
});
});
6 changes: 6 additions & 0 deletions packages/jest-console/src/__tests__/bufferedConsole.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,4 +184,10 @@ describe('CustomConsole', () => {
_console.timeEnd('custom');
});
});

describe('console', () => {
test('should be able to initialize console instance', () => {
expect(_console.Console).toBeDefined();
});
});
});

0 comments on commit a83a831

Please sign in to comment.