diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2022-04-16 19:51:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-16 19:51:12 +0200 |
commit | 5f2d9a4a220307b1111c91dfac74951ef3925457 (patch) | |
tree | 0873546419f8f8dd9ccbaf53dd0c6aa04c78baf0 /runtime/js/40_testing.js | |
parent | 32aaefd9eeea4a08eec0159f6374bfadf2bec62f (diff) |
feat(test): use structured data for JavaScript errors in tests (#14287)
This commit rewrites test runner to send structured error data from JavaScript
to Rust instead of passing strings. This will allow to customize display of errors
in test report (which will be addressed in follow up commits).
Diffstat (limited to 'runtime/js/40_testing.js')
-rw-r--r-- | runtime/js/40_testing.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/runtime/js/40_testing.js b/runtime/js/40_testing.js index fdd044503..c5adc1f59 100644 --- a/runtime/js/40_testing.js +++ b/runtime/js/40_testing.js @@ -804,7 +804,7 @@ await test.fn(step); const failCount = step.failedChildStepsCount(); return failCount === 0 ? "ok" : { - "failed": formatError( + "failed": core.destructureError( new Error( `${failCount} test step${failCount === 1 ? "" : "s"} failed.`, ), @@ -812,7 +812,7 @@ }; } catch (error) { return { - "failed": formatError(error), + "failed": core.destructureError(error), }; } finally { step.finalized = true; @@ -1211,11 +1211,11 @@ return "ignored"; case "pending": return { - "pending": this.error && formatError(this.error), + "pending": this.error && core.destructureError(this.error), }; case "failed": return { - "failed": this.error && formatError(this.error), + "failed": this.error && core.destructureError(this.error), }; default: throw new Error(`Unhandled status: ${this.status}`); @@ -1335,7 +1335,7 @@ subStep.status = "ok"; } } catch (error) { - subStep.error = formatError(error); + subStep.error = error; subStep.status = "failed"; } |