1
0
mirror of https://github.com/svg/svgo.git synced 2025-07-29 20:21:14 +03:00

Replace strip-ansi with --no-color flag (#1588)

nanocolors checks for --color and --no-color flags to force or disable
output coloring. Which can be used instead of strip-ansi package which
btw introduced vulnerability recently.
This commit is contained in:
Bogdan Chadkin
2021-09-30 14:39:12 +03:00
committed by GitHub
parent acd91835f5
commit 203db9aaec
4 changed files with 57 additions and 30 deletions

View File

@ -1,10 +1,9 @@
'use strict';
const { spawn } = require('child_process');
const stripAnsi = require('strip-ansi');
test('should exit with 1 code on syntax error', async () => {
const proc = spawn('node', ['../../bin/svgo', 'invalid.svg'], {
const proc = spawn('node', ['../../bin/svgo', '--no-color', 'invalid.svg'], {
cwd: __dirname,
});
const [code, stderr] = await Promise.all([
@ -20,7 +19,7 @@ test('should exit with 1 code on syntax error', async () => {
}),
]);
expect(code).toEqual(1);
expect(stripAnsi(stderr))
expect(stderr)
.toEqual(`SvgoParserError: invalid.svg:2:27: Unquoted attribute value
1 | <svg>