Skip to content

Commit

Permalink
strip ansi-escapes
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Stramel committed Jun 20, 2020
1 parent f59f7b1 commit 39b6e60
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/integration/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ function stripConfigErrorPath(stdout) {
function stripResolveErrorPath(stdout) {
return stdout.replace(/" via "(.*)"/g, '" via "XXX"');
}
function stripAnsiEscapes(stdout) {
return stdout.replace(/[\u001B\u009B][[\]()#;?]*(?:(?:(?:[a-zA-Z\d]*(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?\u0007)|(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-ntqry=><~]))/g, '');
}

function removeLockfile(testName) {
const lockfileLoc = path.join(__dirname, testName, 'snowpack.lock.json');
Expand Down Expand Up @@ -84,7 +87,7 @@ for (const testName of readdirSync(__dirname)) {
assert.strictEqual(
stripWhitespace(
stripConfigErrorPath(
stripResolveErrorPath(stripBenchmark(stripChunkHash(stripStats(all)))),
stripResolveErrorPath(stripBenchmark(stripChunkHash(stripStats(stripAnsiEscapes(all))))),
),
),
stripWhitespace(expectedOutput),
Expand Down

0 comments on commit 39b6e60

Please sign in to comment.