summaryrefslogtreecommitdiff
path: root/cli/tests/testdata/test/steps
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2022-04-16 19:51:12 +0200
committerGitHub <noreply@github.com>2022-04-16 19:51:12 +0200
commit5f2d9a4a220307b1111c91dfac74951ef3925457 (patch)
tree0873546419f8f8dd9ccbaf53dd0c6aa04c78baf0 /cli/tests/testdata/test/steps
parent32aaefd9eeea4a08eec0159f6374bfadf2bec62f (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 'cli/tests/testdata/test/steps')
-rw-r--r--cli/tests/testdata/test/steps/failing_steps.out10
-rw-r--r--cli/tests/testdata/test/steps/invalid_usage.out12
2 files changed, 22 insertions, 0 deletions
diff --git a/cli/tests/testdata/test/steps/failing_steps.out b/cli/tests/testdata/test/steps/failing_steps.out
index 0724da178..24e19a064 100644
--- a/cli/tests/testdata/test/steps/failing_steps.out
+++ b/cli/tests/testdata/test/steps/failing_steps.out
@@ -4,6 +4,8 @@ nested failure ...
step 1 ...
inner 1 ... FAILED ([WILDCARD])
Error: Failed.
+ throw new Error("Failed.");
+ ^
at [WILDCARD]/failing_steps.ts:[WILDCARD]
[WILDCARD]
inner 2 ... ok ([WILDCARD])
@@ -12,15 +14,21 @@ FAILED ([WILDCARD])
multiple test step failures ...
step 1 ... FAILED ([WILDCARD])
Error: Fail.
+ throw new Error("Fail.");
+ ^
[WILDCARD]
step 2 ... FAILED ([WILDCARD])
Error: Fail.
+ await t.step("step 2", () => Promise.reject(new Error("Fail.")));
+ ^
at [WILDCARD]/failing_steps.ts:[WILDCARD]
[WILDCARD]
FAILED ([WILDCARD])
failing step in failing test ...
step 1 ... FAILED ([WILDCARD])
Error: Fail.
+ throw new Error("Fail.");
+ ^
at [WILDCARD]/failing_steps.ts:[WILDCARD]
at [WILDCARD]
FAILED ([WILDCARD])
@@ -39,6 +47,8 @@ Error: 2 test steps failed.
test/steps/failing_steps.ts > failing step in failing test
Error: Fail test.
+ throw new Error("Fail test.");
+ ^
at [WILDCARD]/failing_steps.ts:[WILDCARD]
at [WILDCARD]
diff --git a/cli/tests/testdata/test/steps/invalid_usage.out b/cli/tests/testdata/test/steps/invalid_usage.out
index f64f148b7..833c3a74f 100644
--- a/cli/tests/testdata/test/steps/invalid_usage.out
+++ b/cli/tests/testdata/test/steps/invalid_usage.out
@@ -14,6 +14,8 @@ inner missing await ...
at testStepSanitizer [WILDCARD]
FAILED ([WILDCARD])
Error: There were still test steps running after the current scope finished execution. Ensure all steps are awaited (ex. `await t.step(...)`).
+ await t.step("step", (t) => {
+ ^
at postValidation [WILDCARD]
at testStepSanitizer [WILDCARD]
at async fn ([WILDCARD]/invalid_usage.ts:[WILDCARD])
@@ -24,6 +26,8 @@ parallel steps with sanitizers ...
step 2 ... FAILED ([WILDCARD])
Error: Cannot start test step while another test step with sanitizers is running.
* parallel steps with sanitizers > step 1
+ await t.step("step 2", () => {});
+ ^
at preValidation ([WILDCARD])
at testStepSanitizer ([WILDCARD])
at [WILDCARD]/invalid_usage.ts:[WILDCARD]
@@ -34,6 +38,8 @@ parallel steps when first has sanitizer ...
step 2 ... FAILED ([WILDCARD])
Error: Cannot start test step while another test step with sanitizers is running.
* parallel steps when first has sanitizer > step 1
+ await t.step({
+ ^
at preValidation ([WILDCARD])
at testStepSanitizer ([WILDCARD])
at [WILDCARD]/invalid_usage.ts:[WILDCARD]
@@ -44,6 +50,8 @@ parallel steps when second has sanitizer ...
step 2 ... FAILED ([WILDCARD])
Error: Cannot start test step with sanitizers while another test step is running.
* parallel steps when second has sanitizer > step 1
+ await t.step({
+ ^
at preValidation ([WILDCARD])
at testStepSanitizer ([WILDCARD])
at [WILDCARD]/invalid_usage.ts:[WILDCARD]
@@ -57,6 +65,8 @@ parallel steps where only inner tests have sanitizers ...
step inner ... FAILED ([WILDCARD])
Error: Cannot start test step with sanitizers while another test step is running.
* parallel steps where only inner tests have sanitizers > step 1
+ await t.step({
+ ^
at preValidation ([WILDCARD])
at testStepSanitizer ([WILDCARD])
at [WILDCARD]/invalid_usage.ts:[WILDCARD]
@@ -67,6 +77,8 @@ failures:
test/steps/invalid_usage.ts > capturing
Error: Cannot run test step after parent scope has finished execution. Ensure any `.step(...)` calls are executed before their parent scope completes execution.
+ await capturedContext.step("next step", () => {});
+ ^
at TestContext.step ([WILDCARD])
at [WILDCARD]/invalid_usage.ts:[WILDCARD]
at [WILDCARD]