|
2 | 2 | (function (root, factory) { |
3 | 3 | if (typeof exports === "object") { |
4 | 4 | if (process.env.JEST_WORKER_ID === undefined) { |
5 | | - const colors = require("ansis"); |
| 5 | + const { styleText } = require("node:util"); |
6 | 6 |
|
7 | 7 | // add timestamps in front of log messages |
8 | 8 | require("console-stamp")(console, { |
|
12 | 12 | const { method, defaultTokens } = arg; |
13 | 13 | let label = defaultTokens.label(arg); |
14 | 14 | if (method === "error") { |
15 | | - label = colors.red(label); |
| 15 | + label = styleText("red", label); |
16 | 16 | } else if (method === "warn") { |
17 | | - label = colors.yellow(label); |
| 17 | + label = styleText("yellow", label); |
18 | 18 | } else if (method === "debug") { |
19 | | - label = colors.bgBlue(label); |
| 19 | + label = styleText("bgBlue", label); |
20 | 20 | } else if (method === "info") { |
21 | | - label = colors.blue(label); |
| 21 | + label = styleText("blue", label); |
22 | 22 | } |
23 | 23 | return label; |
24 | 24 | }, |
25 | 25 | msg: (arg) => { |
26 | 26 | const { method, defaultTokens } = arg; |
27 | 27 | let msg = defaultTokens.msg(arg); |
28 | 28 | if (method === "error") { |
29 | | - msg = colors.red(msg); |
| 29 | + msg = styleText("red", msg); |
30 | 30 | } else if (method === "warn") { |
31 | | - msg = colors.yellow(msg); |
| 31 | + msg = styleText("yellow", msg); |
32 | 32 | } else if (method === "info") { |
33 | | - msg = colors.blue(msg); |
| 33 | + msg = styleText("blue", msg); |
34 | 34 | } |
35 | 35 | return msg; |
36 | 36 | } |
|
0 commit comments