Skip to content

Commit 7f715c8

Browse files
authoredJan 19, 2018
Add "debug" method to console (#5350)
1 parent 5943dc9 commit 7f715c8

File tree

5 files changed

+12
-1
lines changed

5 files changed

+12
-1
lines changed
 

‎CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
### Fixes
44

5+
* `[jest-util]` Add "debug" method to "console" implementations
6+
([#5350](https://github.com/facebook/jest/pull/5350))
57
* `[jest-resolve]` Add condition to avoid infinite loop when node module package main is ".".
68
([#5344)](https://github.com/facebook/jest/pull/5344)
79

‎packages/jest-util/src/Console.js

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ export default class CustomConsole extends Console {
3434
super.log(this._formatBuffer(type, message));
3535
}
3636

37+
debug(...args: Array<mixed>) {
38+
this._log('debug', format.apply(null, arguments));
39+
}
40+
3741
log(...args: Array<mixed>) {
3842
this._log('log', format.apply(null, arguments));
3943
}

‎packages/jest-util/src/buffered_console.js

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ export default class BufferedConsole extends Console {
3434
return buffer;
3535
}
3636

37+
debug() {
38+
BufferedConsole.write(this._buffer, 'debug', format.apply(null, arguments));
39+
}
40+
3741
log() {
3842
BufferedConsole.write(this._buffer, 'log', format.apply(null, arguments));
3943
}

‎packages/jest-util/src/null_console.js

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import Console from './Console';
1111

1212
export default class NullConsole extends Console {
1313
assert() {}
14+
debug() {}
1415
dir() {}
1516
error() {}
1617
info() {}

‎types/Console.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ export type LogEntry = {|
1313
origin: string,
1414
type: LogType,
1515
|};
16-
export type LogType = 'log' | 'info' | 'warn' | 'error';
16+
export type LogType = 'debug' | 'log' | 'info' | 'warn' | 'error';
1717
export type ConsoleBuffer = Array<LogEntry>;

0 commit comments

Comments
 (0)
Please sign in to comment.