Add forceColor option to babel-code-frame (#4913)

This commit is contained in:
Joe Haddad
2016-12-01 23:43:08 -05:00
committed by Henry Zhu
parent b43191d402
commit 06820ca17d
3 changed files with 43 additions and 18 deletions

View File

@@ -186,4 +186,21 @@ describe("babel-code-frame", function () {
" 8 | "
].join("\n"));
});
it("opts.forceColor", function() {
let marker = chalk.red.bold;
let gutter = chalk.grey;
let rawLines = [
"",
"",
"",
""
].join("\n");
assert.equal(codeFrame(rawLines, 3, null, { linesAbove: 1, linesBelow: 1, forceColor: true }), chalk.reset([
" " + gutter(" 2 | "),
marker(">") + gutter(" 3 | "),
" " + gutter(" 4 | ")
].join("\n")));
});
});