ansi-to-html
Advanced tools
Comparing version 0.6.4 to 0.6.5
{ | ||
"name": "ansi-to-html", | ||
"version": "0.6.4", | ||
"version": "0.6.5", | ||
"description": "Convert ansi escaped text streams to html.", | ||
@@ -50,2 +50,6 @@ "main": "lib/ansi_to_html.js", | ||
"email": "pnidem@gmail.com" | ||
}, | ||
{ | ||
"name": "Paul Grime", | ||
"email": "gitgrimbo@gmail.com" | ||
} | ||
@@ -52,0 +56,0 @@ ], |
@@ -221,2 +221,37 @@ /* globals describe, it*/ | ||
it('drops ED code with 0 parameter', function (done) { | ||
const text = '\x1b[Jhello'; | ||
const result = 'hello'; | ||
return test(text, result, done); | ||
}); | ||
it('drops ED code with 1 parameter', function (done) { | ||
const text = '\x1b[1Jhello'; | ||
const result = 'hello'; | ||
return test(text, result, done); | ||
}); | ||
it('drops HVP code with 0 parameter', function (done) { | ||
const text = '\x1b[;fhello'; | ||
const result = 'hello'; | ||
return test(text, result, done); | ||
}); | ||
it('drops HVP code with 1 parameter', function (done) { | ||
const text = '\x1b[123;fhello'; | ||
const result = 'hello'; | ||
return test(text, result, done); | ||
}); | ||
it('drops HVP code with 2 parameter', function (done) { | ||
const text = '\x1b[123;456fhello'; | ||
const result = 'hello'; | ||
return test(text, result, done); | ||
}); | ||
it('drops setusg0 sequence', function (done) { | ||
@@ -223,0 +258,0 @@ const text = '\x1b[(Bhello'; |
@@ -6,2 +6,4 @@ /* globals describe, it*/ | ||
const EOL = require('os').EOL; | ||
function getColorCmd(cmd) { | ||
@@ -11,3 +13,4 @@ const cmds = { | ||
linux: `CLICOLOR="1" ${cmd} | node lib/cli`, | ||
win32: `${cmd} | node lib/cli` | ||
// for win32 compatibility, make sure there is no space between the cmd and the pipe | ||
win32: `${cmd}| node lib/cli` | ||
}; | ||
@@ -18,6 +21,13 @@ | ||
function echo(str) { | ||
if (process.platform === 'win32') { | ||
return `echo ${str}`; | ||
} | ||
return `echo "${str}"`; | ||
} | ||
describe('cli', function () { | ||
it('converts colors', function (done) { | ||
const data = 'echo "what\033[0;31m what?"'; | ||
const result = 'what<span style=\"color:#A00\"> what?\n</span>'; | ||
const data = echo('what\033[0;31m what?'); | ||
const result = `what<span style="color:#A00"> what?${EOL}</span>`; | ||
@@ -24,0 +34,0 @@ childProcess.exec(getColorCmd(data), { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34894
830