Skip to content

don't catch assertion error as this suppresses the diff output

With this try/catch in place, we see the following output when there is an assertion error:

AssertionError: expected { body: [ { …(2) }, { …(2) } ] } to deeply equal { body: [ { …(2) }, { …(2) } ] }

Without it, we see the diff in the output:

AssertionError: expected { body: [ { …(2) }, { …(2) } ] } to deeply equal { body: [ { …(2) }, { …(2) } ] } 
+ expected - actual

       "type": "Paragraph"
     }
     {
       "lines": [
-        "To begin a new paragraph, separate it by at least one empty line from the previous paragraph or block."
+        "To start a new paragraph, separate it by at least one empty line from the previous paragraph or block."
       ]
       "type": "Paragraph"
     }
   ]

Thus, there's no reason for it to be there.

If there is a need for the try/catch for other kinds of failures, then the runner should instead rethrow the error if it's an AssertionError.

if (e.name === 'AssertionError') throw e

Merge request reports

Loading