From 39b6e602933f466eeaa608caa82c63edb0eaa89c Mon Sep 17 00:00:00 2001 From: Michael Stramel Date: Sat, 20 Jun 2020 14:35:24 -0500 Subject: [PATCH] strip ansi-escapes --- test/integration/runner.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/integration/runner.js b/test/integration/runner.js index b4ba4a88fb..3f23ffff15 100644 --- a/test/integration/runner.js +++ b/test/integration/runner.js @@ -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'); @@ -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),