Files
cypress/cli/test/support/normalize.js
renovate[bot] eab801ae3f chore(deps): Update dependency eslint to version 6.8.0 🌟 (#6509)
* chore(deps): Update eslint to 6.8.0 🌟

* fix missing dangling commas for linter

* fix missing dangling commas for linter

* more lint fixes

* yarn lock

Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
Co-authored-by: Jennifer Shehane <shehane.jennifer@gmail.com>
2020-02-25 00:09:47 +06:30

28 lines
673 B
JavaScript

const stripAnsi = require('strip-ansi')
const whitespaceAtEndOfLineRe = /\s+$/g
const datesRe = /(\d+:\d+:\d+)/g
const downloadQueryRe = /(\?platform=(darwin|linux|win32)&arch=(x64|ia32))/
const removeExcessWhiteSpace = (str) => {
return str.replace(whitespaceAtEndOfLineRe, '')
}
/**
* strip dates and ansi codes and excess whitespace
* @param {string} str input string
* @returns {string} cleaned output string
*/
const normalize = (str) => {
return stripAnsi(
str
.replace(datesRe, 'xx:xx:xx')
.split('\n')
.map(removeExcessWhiteSpace)
.join('\n')
.replace(downloadQueryRe, '?platform=OS&arch=ARCH'),
)
}
module.exports = normalize