Skip to content

Commit ef7e727

Browse files
code-asherjsjoeio
authored andcommittedFeb 22, 2021
Fix unreadable wtfnode output
1 parent 6d4f814 commit ef7e727

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
 

‎test/wtfnode.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,23 @@
1+
import * as util from "util"
12
import * as wtfnode from "wtfnode"
23

4+
// Jest seems to hijack console.log in a way that makes the output difficult to
5+
// read. So we'll write directly to process.stderr instead.
6+
const write = (...args: [any, ...any]) => {
7+
if (args.length > 0) {
8+
process.stderr.write(util.format(...args) + "\n")
9+
}
10+
}
11+
wtfnode.setLogger("info", write)
12+
wtfnode.setLogger("warn", write)
13+
wtfnode.setLogger("error", write)
14+
315
let active = false
416

17+
/**
18+
* Start logging open handles periodically. This can be used to see what is
19+
* hanging open if anything.
20+
*/
521
export function setup(): void {
622
if (active) {
723
return

0 commit comments

Comments
 (0)
Please sign in to comment.