Fix: Color E(xecption) lines in the log red (#631)
This commit is contained in:
parent
8350dda5eb
commit
5f580273a9
|
@ -95,7 +95,9 @@ const dom = {
|
|||
resultBody.querySelector('.col-duration').innerText = duration < 1 ? formatDuration(duration).ms : formatDuration(duration).formatted
|
||||
|
||||
if (log) {
|
||||
resultBody.querySelector('.log').innerHTML = log
|
||||
// Wrap lines starting with "E" with span.error to color those lines red
|
||||
const wrappedLog = log.replace(/^E.*$/gm, (match) => `<span class="error">${match}</span>`)
|
||||
resultBody.querySelector('.log').innerHTML = wrappedLog
|
||||
} else {
|
||||
resultBody.querySelector('.log').remove()
|
||||
}
|
||||
|
|
|
@ -206,6 +206,9 @@ class TestHTML:
|
|||
page = run(pytester)
|
||||
assert_results(page, failed=1)
|
||||
assert_that(get_log(page)).contains("AssertionError")
|
||||
assert_that(get_text(page, ".summary div[class='log'] span.error")).matches(
|
||||
r"^E\s+assert False$"
|
||||
)
|
||||
|
||||
def test_xfail(self, pytester):
|
||||
reason = str(random.random())
|
||||
|
|
Loading…
Reference in New Issue