(style, input)
| 961 | // Test util.inspect.styles and util.inspect.colors. |
| 962 | { |
| 963 | function testColorStyle(style, input) { |
| 964 | const colorName = util.inspect.styles[style]; |
| 965 | let color = ['', '']; |
| 966 | if (util.inspect.colors[colorName]) |
| 967 | color = util.inspect.colors[colorName]; |
| 968 | |
| 969 | const withoutColor = util.inspect(input, false, 0, false); |
| 970 | const withColor = util.inspect(input, false, 0, true); |
| 971 | const expect = `\u001b[${color[0]}m${withoutColor}\u001b[${color[1]}m`; |
| 972 | assert.strictEqual( |
| 973 | withColor, |
| 974 | expect, |
| 975 | `util.inspect color for style ${style}`); |
| 976 | } |
| 977 | |
| 978 | testColorStyle('special', function() {}); |
| 979 | testColorStyle('number', 123.456); |
no test coverage detected
searching dependent graphs…