Skip to content

Commit

Permalink
run-tests.js catch warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
kroitor committed Jun 26, 2019
1 parent b44f888 commit ef09bf2
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions run-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,29 @@ const exec = (bin, ...args) =>
ps.stderr.on ('data', data => { output += data.toString (); stderr += data.toString (); hasWarnings = true })

ps.on ('exit', code => {

output = ansi.strip (output.trim ())
stderr = ansi.strip (stderr)

const regex = /^\[[^\]]+\]/mg

let match = undefined
const warnings = []

match = regex.exec (output)

do {
if (match = regex.exec (output)) {
warnings.push (match[0])
}
} while (match);

return_ ({
failed: code !== 0,
output,
hasOutput: output.trim ().length > 0,
hasWarnings,
warnings: ansi.strip (stderr).match (/^\[[^\]]+\]/g) || []
hasOutput: output.length > 0,
hasWarnings: hasWarnings || warnings.length > 0,
warnings: warnings,
})
})

Expand Down

0 comments on commit ef09bf2

Please sign in to comment.