mirror of
https://github.com/cypress-io/cypress.git
synced 2026-01-31 03:29:43 -06:00
* added CYPRESS_SKIP_BINARY_INSTALL env var check before installing * cli: provide reason binary installation is being skipped - more linting, why not * cli: prettify snapshots by removing whitespace at end of line
23 lines
563 B
JavaScript
23 lines
563 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, '')
|
|
}
|
|
|
|
module.exports = (str) => {
|
|
// strip dates and ansi codes
|
|
// and excess whitespace
|
|
return stripAnsi(
|
|
str
|
|
.replace(datesRe, 'xx:xx:xx')
|
|
.split('\n')
|
|
.map(removeExcessWhiteSpace)
|
|
.join('\n')
|
|
.replace(downloadQueryRe, '?platform=OS&arch=ARCH')
|
|
)
|
|
}
|