jest-serializer-ansi-escapes
Version:
Jest snapshot serializer for ANSI escape sequences
13 lines (10 loc) • 341 B
JavaScript
const prettyAnsi = require("pretty-ansi");
const ansiEscapesSerializer = {
serialize(text, config, indentation, depth, refs, printer) {
return printer(prettyAnsi(text), config, indentation, depth, refs);
},
test(val) {
return typeof val === "string" && val.includes("\u001b");
},
};
module.exports = ansiEscapesSerializer;