fix #207: assign diagnostic to correct test#209
Conversation
|
Also contains #208. |
test/e2e/compare.sh
Outdated
|
|
||
| # Function to replace test duration with 0 and remove file paths | ||
| remove_variables() { | ||
| echo "$1" | sed -E 's/\"duration\": [0-9\.]+/\"duration\": 0/g' | sed -E 's/\/.*\/test\//test\//g' |
There was a problem hiding this comment.
Note: do not escape "." in a regexp class. The backslash becomes part of the class rather than escaping ".".
|
|
||
| let diagnosticMessage = '' | ||
| const allTests = Object.create(null) | ||
| let currentTest |
There was a problem hiding this comment.
This is a little bit of a hack to hold on to the last test, so that messages that come in without file, line, and column have somewhere to go.
parse-report.js
Outdated
| function lastTestInStack() { | ||
| return testStack.length ? testStack[testStack.length - 1] : null | ||
| function testId(data) { | ||
| return [data.file, data.line, data.column].join('\0') |
There was a problem hiding this comment.
Column is included so that tests that are run together in the same line are distinguishable.
|
|
||
| function resetDiagnosticMessage() { | ||
| diagnosticMessage = '' | ||
| function appendDiagnosticMessage(data) { |
There was a problem hiding this comment.
I reordered these when I was going to use lastTestInStack. Can put them back in the previous order if this is confusing.
|
CI is failing. See my comment on the other PR. |
|
Will rebase this on #208 once it lands. |
|
This relies on #212 since the tests won't pass without it. |
Ensure that calls to test.diagnostic are reflected on the correct test. Now captures previously-lost top-level diagnostics as well. Fixes nearform#207.
|
@simoneb rebased on master |
simoneb
left a comment
There was a problem hiding this comment.
LGTM, thanks a lot for the contribution!
Fixes #207.