summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2023-03-25 19:32:11 +0000
committerGitHub <noreply@github.com>2023-03-25 21:32:11 +0200
commit8a4865c3790a6eb93d95189e129b3ee98f349b45 (patch)
treeeb7a7f7a32addcfb49e5814d509c244532e38c2f /cli/tests
parentfe88b53e50034e185246e03be586c470ca4fbf78 (diff)
feat(test): print pending tests on sigint (#18246)
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/integration/test_tests.rs21
-rw-r--r--cli/tests/testdata/test/ops_sanitizer_missing_details.out7
-rw-r--r--cli/tests/testdata/test/ops_sanitizer_multiple_timeout_tests.out14
-rw-r--r--cli/tests/testdata/test/ops_sanitizer_multiple_timeout_tests_no_trace.out14
-rw-r--r--cli/tests/testdata/test/ops_sanitizer_unstable.out7
-rw-r--r--cli/tests/testdata/test/parallel_output.out53
-rw-r--r--cli/tests/testdata/test/resource_sanitizer.out9
-rw-r--r--cli/tests/testdata/test/sigint_with_hanging_test.out10
-rw-r--r--cli/tests/testdata/test/sigint_with_hanging_test.ts15
-rw-r--r--cli/tests/testdata/test/steps/failing_steps.out61
-rw-r--r--cli/tests/testdata/test/steps/invalid_usage.out110
-rw-r--r--cli/tests/testdata/test/steps/invalid_usage.ts2
-rw-r--r--cli/tests/unit_node/process_test.ts84
13 files changed, 208 insertions, 199 deletions
diff --git a/cli/tests/integration/test_tests.rs b/cli/tests/integration/test_tests.rs
index 047dcbc7e..107d137e7 100644
--- a/cli/tests/integration/test_tests.rs
+++ b/cli/tests/integration/test_tests.rs
@@ -4,6 +4,7 @@ use deno_core::url::Url;
use test_util as util;
use util::assert_contains;
use util::env_vars_for_npm_tests;
+use util::wildcard_match;
use util::TestContext;
#[test]
@@ -444,6 +445,26 @@ itest!(parallel_output {
exit_code: 1,
});
+#[test]
+fn sigint_with_hanging_test() {
+ util::with_pty(
+ &[
+ "test",
+ "--quiet",
+ "--no-check",
+ "test/sigint_with_hanging_test.ts",
+ ],
+ |mut console| {
+ std::thread::sleep(std::time::Duration::from_secs(1));
+ console.write_line("\x03");
+ wildcard_match(
+ include_str!("../testdata/test/sigint_with_hanging_test.out"),
+ &console.read_all_output(),
+ );
+ },
+ );
+}
+
itest!(package_json_basic {
args: "test",
output: "package_json/basic/lib.test.out",
diff --git a/cli/tests/testdata/test/ops_sanitizer_missing_details.out b/cli/tests/testdata/test/ops_sanitizer_missing_details.out
index b277ba74f..36191912a 100644
--- a/cli/tests/testdata/test/ops_sanitizer_missing_details.out
+++ b/cli/tests/testdata/test/ops_sanitizer_missing_details.out
@@ -5,12 +5,9 @@ test 1 ... FAILED [WILDCARD]
ERRORS
test 1 => ./test/ops_sanitizer_missing_details.ts:[WILDCARD]
-error: AssertionError: Test case is leaking async ops.
-
- - 1 async operation to op_write was started in this test, but never completed.
-
+error: Leaking async ops:
+ - 1 async operation to op_write was started in this test, but never completed.
To get more details where ops were leaked, run again with --trace-ops flag.
- at [WILDCARD]
FAILURES
diff --git a/cli/tests/testdata/test/ops_sanitizer_multiple_timeout_tests.out b/cli/tests/testdata/test/ops_sanitizer_multiple_timeout_tests.out
index ded6708d1..d7ccc6a00 100644
--- a/cli/tests/testdata/test/ops_sanitizer_multiple_timeout_tests.out
+++ b/cli/tests/testdata/test/ops_sanitizer_multiple_timeout_tests.out
@@ -6,9 +6,8 @@ test 2 ... FAILED ([WILDCARD])
ERRORS
test 1 => ./test/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]
-error: AssertionError: Test case is leaking async ops.
-
- - 2 async operations to sleep for a duration were started in this test, but never completed. This is often caused by not cancelling a `setTimeout` or `setInterval` call. The operations were started here:
+error: Leaking async ops:
+ - 2 async operations to sleep for a duration were started in this test, but never completed. This is often caused by not cancelling a `setTimeout` or `setInterval` call. The operations were started here:
at [WILDCARD]
at setTimeout ([WILDCARD])
at test ([WILDCARD]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts:4:3)
@@ -21,12 +20,9 @@ error: AssertionError: Test case is leaking async ops.
at [WILDCARD]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts:8:27
at [WILDCARD]
- at [WILDCARD]
-
test 2 => ./test/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]
-error: AssertionError: Test case is leaking async ops.
-
- - 2 async operations to sleep for a duration were started in this test, but never completed. This is often caused by not cancelling a `setTimeout` or `setInterval` call. The operations were started here:
+error: Leaking async ops:
+ - 2 async operations to sleep for a duration were started in this test, but never completed. This is often caused by not cancelling a `setTimeout` or `setInterval` call. The operations were started here:
at [WILDCARD]
at setTimeout ([WILDCARD])
at test ([WILDCARD]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts:4:3)
@@ -39,8 +35,6 @@ error: AssertionError: Test case is leaking async ops.
at [WILDCARD]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts:10:27
at [WILDCARD]
- at [WILDCARD]
-
FAILURES
test 1 => ./test/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]
diff --git a/cli/tests/testdata/test/ops_sanitizer_multiple_timeout_tests_no_trace.out b/cli/tests/testdata/test/ops_sanitizer_multiple_timeout_tests_no_trace.out
index 3f40bb9d0..1655c162f 100644
--- a/cli/tests/testdata/test/ops_sanitizer_multiple_timeout_tests_no_trace.out
+++ b/cli/tests/testdata/test/ops_sanitizer_multiple_timeout_tests_no_trace.out
@@ -6,20 +6,14 @@ test 2 ... FAILED ([WILDCARD])
ERRORS
test 1 => ./test/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]
-error: AssertionError: Test case is leaking async ops.
-
- - 2 async operations to sleep for a duration were started in this test, but never completed. This is often caused by not cancelling a `setTimeout` or `setInterval` call.
-
+error: Leaking async ops:
+ - 2 async operations to sleep for a duration were started in this test, but never completed. This is often caused by not cancelling a `setTimeout` or `setInterval` call.
To get more details where ops were leaked, run again with --trace-ops flag.
- at [WILDCARD]
test 2 => ./test/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]
-error: AssertionError: Test case is leaking async ops.
-
- - 2 async operations to sleep for a duration were started in this test, but never completed. This is often caused by not cancelling a `setTimeout` or `setInterval` call.
-
+error: Leaking async ops:
+ - 2 async operations to sleep for a duration were started in this test, but never completed. This is often caused by not cancelling a `setTimeout` or `setInterval` call.
To get more details where ops were leaked, run again with --trace-ops flag.
- at [WILDCARD]
FAILURES
diff --git a/cli/tests/testdata/test/ops_sanitizer_unstable.out b/cli/tests/testdata/test/ops_sanitizer_unstable.out
index 98e0a26ff..2d5ab9079 100644
--- a/cli/tests/testdata/test/ops_sanitizer_unstable.out
+++ b/cli/tests/testdata/test/ops_sanitizer_unstable.out
@@ -6,16 +6,13 @@ leak interval ... FAILED ([WILDCARD])
ERRORS
leak interval => ./test/ops_sanitizer_unstable.ts:[WILDCARD]
-error: AssertionError: Test case is leaking async ops.
-
- - 1 async operation to sleep for a duration was started in this test, but never completed. This is often caused by not cancelling a `setTimeout` or `setInterval` call. The operation was started here:
+error: Leaking async ops:
+ - 1 async operation to sleep for a duration was started in this test, but never completed. This is often caused by not cancelling a `setTimeout` or `setInterval` call. The operation was started here:
at [WILDCARD]
at setInterval ([WILDCARD])
at [WILDCARD]/testdata/test/ops_sanitizer_unstable.ts:3:3
at [WILDCARD]
- at [WILDCARD]
-
FAILURES
leak interval => ./test/ops_sanitizer_unstable.ts:[WILDCARD]
diff --git a/cli/tests/testdata/test/parallel_output.out b/cli/tests/testdata/test/parallel_output.out
index 3ec9c5221..f5c932171 100644
--- a/cli/tests/testdata/test/parallel_output.out
+++ b/cli/tests/testdata/test/parallel_output.out
@@ -12,45 +12,44 @@ Hello, world! (from step 4)
./test/parallel_output.ts => step output ... ok ([WILDCARD]ms)
./test/parallel_output.ts => step failures ... step 1 ... ok ([WILDCARD]ms)
./test/parallel_output.ts => step failures ... step 2 ... FAILED ([WILDCARD]ms)
- error: Error: Fail.
- throw new Error("Fail.");
- ^
- at file:///[WILDCARD]/test/parallel_output.ts:15:11
- at [WILDCARD]
- at file:///[WILDCARD]/test/parallel_output.ts:14:11
./test/parallel_output.ts => step failures ... step 3 ... FAILED ([WILDCARD]ms)
- error: Error: Fail.
- await t.step("step 3", () => Promise.reject(new Error("Fail.")));
- ^
- at file:///[WILDCARD]/test/parallel_output.ts:17:47
- at [WILDCARD]
- at file:///[WILDCARD]/test/parallel_output.ts:17:11
-./test/parallel_output.ts => step failures ... FAILED ([WILDCARD]ms)
+./test/parallel_output.ts => step failures ... FAILED (due to 2 failed steps) ([WILDCARD]ms)
./test/parallel_output.ts => step nested failure ... step 1 ... inner 1 ... ok ([WILDCARD]ms)
./test/parallel_output.ts => step nested failure ... step 1 ... inner 2 ... FAILED ([WILDCARD]ms)
- error: Error: Failed.
- throw new Error("Failed.");
- ^
- at file:///[WILDCARD]/test/parallel_output.ts:24:13
- at [WILDCARD]
- at file:///[WILDCARD]/test/parallel_output.ts:23:13
-./test/parallel_output.ts => step nested failure ... step 1 ... FAILED ([WILDCARD]ms)
-./test/parallel_output.ts => step nested failure ... FAILED ([WILDCARD]ms)
+./test/parallel_output.ts => step nested failure ... step 1 ... FAILED (due to 1 failed step) ([WILDCARD]ms)
+./test/parallel_output.ts => step nested failure ... FAILED (due to 1 failed step) ([WILDCARD]ms)
ERRORS
-step failures => ./test/parallel_output.ts:12:6
-error: Error: 2 test steps failed.
+step failures ... step 2 => ./test/parallel_output.ts:14:11
+error: Error: Fail.
+ throw new Error("Fail.");
+ ^
+ at file:///[WILDCARD]/test/parallel_output.ts:15:11
at [WILDCARD]
+ at file:///[WILDCARD]/test/parallel_output.ts:14:11
-step nested failure => ./test/parallel_output.ts:20:6
-error: Error: 1 test step failed.
+step failures ... step 3 => ./test/parallel_output.ts:17:11
+error: Error: Fail.
+ await t.step("step 3", () => Promise.reject(new Error("Fail.")));
+ ^
+ at file:///[WILDCARD]/test/parallel_output.ts:17:47
at [WILDCARD]
+ at file:///[WILDCARD]/test/parallel_output.ts:17:11
+
+step nested failure ... step 1 ... inner 2 => ./test/parallel_output.ts:23:13
+error: Error: Failed.
+ throw new Error("Failed.");
+ ^
+ at file:///[WILDCARD]/test/parallel_output.ts:24:13
+ at [WILDCARD]
+ at file:///[WILDCARD]/test/parallel_output.ts:23:13
FAILURES
-step failures => ./test/parallel_output.ts:12:6
-step nested failure => ./test/parallel_output.ts:20:6
+step failures ... step 2 => ./test/parallel_output.ts:14:11
+step failures ... step 3 => ./test/parallel_output.ts:17:11
+step nested failure ... step 1 ... inner 2 => ./test/parallel_output.ts:23:13
FAILED | 1 passed (6 steps) | 2 failed (4 steps) ([WILDCARD]ms)
diff --git a/cli/tests/testdata/test/resource_sanitizer.out b/cli/tests/testdata/test/resource_sanitizer.out
index 695a45a4c..a0e916654 100644
--- a/cli/tests/testdata/test/resource_sanitizer.out
+++ b/cli/tests/testdata/test/resource_sanitizer.out
@@ -5,12 +5,9 @@ leak ... FAILED ([WILDCARD])
ERRORS
leak => ./test/resource_sanitizer.ts:[WILDCARD]
-error: AssertionError: Test case is leaking 2 resources:
-
- - The stdin pipe (rid 0) was opened before the test started, but was closed during the test. Do not close resources in a test that were not created during that test.
- - A file (rid 3) was opened during the test, but not closed during the test. Close the file handle by calling `file.close()`.
-
- at [WILDCARD]
+error: Leaking resources:
+ - The stdin pipe (rid 0) was opened before the test started, but was closed during the test. Do not close resources in a test that were not created during that test.
+ - A file (rid 3) was opened during the test, but not closed during the test. Close the file handle by calling `file.close()`.
FAILURES
diff --git a/cli/tests/testdata/test/sigint_with_hanging_test.out b/cli/tests/testdata/test/sigint_with_hanging_test.out
new file mode 100644
index 000000000..c590c2192
--- /dev/null
+++ b/cli/tests/testdata/test/sigint_with_hanging_test.out
@@ -0,0 +1,10 @@
+running 1 test from [WILDCARD]/hanging_test.ts
+test ...
+ step 1 ...
+ step 2 ...
+SIGINT The following tests were pending:
+
+test => [WILDCARD]/hanging_test.ts:3:6
+test ... step 1 => [WILDCARD]/hanging_test.ts:9:13
+test ... step 1 ... step 2 => [WILDCARD]/hanging_test.ts:10:15
+
diff --git a/cli/tests/testdata/test/sigint_with_hanging_test.ts b/cli/tests/testdata/test/sigint_with_hanging_test.ts
new file mode 100644
index 000000000..07b126e98
--- /dev/null
+++ b/cli/tests/testdata/test/sigint_with_hanging_test.ts
@@ -0,0 +1,15 @@
+setInterval(() => {}, 10000);
+
+Deno.test({
+ name: "test",
+ sanitizeOps: false,
+ sanitizeExit: false,
+ sanitizeResources: false,
+ async fn(t) {
+ await t.step("step 1", async (t) => {
+ await t.step("step 2", async () => {
+ await new Promise(() => {});
+ });
+ });
+ },
+});
diff --git a/cli/tests/testdata/test/steps/failing_steps.out b/cli/tests/testdata/test/steps/failing_steps.out
index c68889c8d..4b717f5cc 100644
--- a/cli/tests/testdata/test/steps/failing_steps.out
+++ b/cli/tests/testdata/test/steps/failing_steps.out
@@ -3,47 +3,42 @@ running 3 tests from ./test/steps/failing_steps.ts
nested failure ...
step 1 ...
inner 1 ... FAILED ([WILDCARD])
- error: Error: Failed.
- throw new Error("Failed.");
- ^
- at [WILDCARD]/failing_steps.ts:[WILDCARD]
- [WILDCARD]
inner 2 ... ok ([WILDCARD])
- step 1 ... FAILED ([WILDCARD])
-nested failure ... FAILED ([WILDCARD])
+ step 1 ... FAILED (due to 1 failed step) ([WILDCARD])
+nested failure ... FAILED (due to 1 failed step) ([WILDCARD])
multiple test step failures ...
step 1 ... FAILED ([WILDCARD])
- error: Error: Fail.
- throw new Error("Fail.");
- ^
- [WILDCARD]
step 2 ... FAILED ([WILDCARD])
- error: Error: Fail.
- await t.step("step 2", () => Promise.reject(new Error("Fail.")));
- ^
- at [WILDCARD]/failing_steps.ts:[WILDCARD]
- [WILDCARD]
-multiple test step failures ... FAILED ([WILDCARD])
+multiple test step failures ... FAILED (due to 2 failed steps) ([WILDCARD])
failing step in failing test ...
step 1 ... FAILED ([WILDCARD])
- error: Error: Fail.
- throw new Error("Fail.");
- ^
- at [WILDCARD]/failing_steps.ts:[WILDCARD]
- at [WILDCARD]
failing step in failing test ... FAILED ([WILDCARD])
ERRORS
-nested failure => ./test/steps/failing_steps.ts:[WILDCARD]
-error: Error: 1 test step failed.
- at runTest (ext:cli/40_testing.js:[WILDCARD])
- at async runTests (ext:cli/40_testing.js:[WILDCARD])
+nested failure ... step 1 ... inner 1 => ./test/steps/failing_steps.ts:[WILDCARD]
+error: Error: Failed.
+ throw new Error("Failed.");
+ ^
+ at [WILDCARD]/failing_steps.ts:[WILDCARD]
+
+multiple test step failures ... step 1 => ./test/steps/failing_steps.ts:[WILDCARD]
+error: Error: Fail.
+ throw new Error("Fail.");
+ ^
+ at [WILDCARD]/failing_steps.ts:[WILDCARD]
-multiple test step failures => ./test/steps/failing_steps.ts:[WILDCARD]
-error: Error: 2 test steps failed.
- at runTest (ext:cli/40_testing.js:[WILDCARD])
- at async runTests (ext:cli/40_testing.js:[WILDCARD])
+multiple test step failures ... step 2 => ./test/steps/failing_steps.ts:[WILDCARD]
+error: Error: Fail.
+ await t.step("step 2", () => Promise.reject(new Error("Fail.")));
+ ^
+ at [WILDCARD]/failing_steps.ts:[WILDCARD]
+
+failing step in failing test ... step 1 => ./test/steps/failing_steps.ts:[WILDCARD]
+error: Error: Fail.
+ throw new Error("Fail.");
+ ^
+ at [WILDCARD]/failing_steps.ts:[WILDCARD]
failing step in failing test => ./test/steps/failing_steps.ts:[WILDCARD]
error: Error: Fail test.
@@ -53,8 +48,10 @@ error: Error: Fail test.
FAILURES
-nested failure => ./test/steps/failing_steps.ts:[WILDCARD]
-multiple test step failures => ./test/steps/failing_steps.ts:[WILDCARD]
+nested failure ... step 1 ... inner 1 => ./test/steps/failing_steps.ts:[WILDCARD]
+multiple test step failures ... step 1 => ./test/steps/failing_steps.ts:[WILDCARD]
+multiple test step failures ... step 2 => ./test/steps/failing_steps.ts:[WILDCARD]
+failing step in failing test ... step 1 => ./test/steps/failing_steps.ts:[WILDCARD]
failing step in failing test => ./test/steps/failing_steps.ts:[WILDCARD]
FAILED | 0 passed (1 step) | 3 failed (5 steps) ([WILDCARD])
diff --git a/cli/tests/testdata/test/steps/invalid_usage.out b/cli/tests/testdata/test/steps/invalid_usage.out
index dc97a5eed..311be4fd7 100644
--- a/cli/tests/testdata/test/steps/invalid_usage.out
+++ b/cli/tests/testdata/test/steps/invalid_usage.out
@@ -4,65 +4,33 @@ capturing ...
some step ... ok ([WILDCARD])
capturing ... FAILED ([WILDCARD])
top level missing await ...
- step ... pending ([WILDCARD])
-top level missing await ... FAILED ([WILDCARD])
+ step ... INCOMPLETE
+top level missing await ... FAILED (due to incomplete steps) ([WILDCARD])
inner missing await ...
step ...
- inner ... pending ([WILDCARD])
- error: Error: Parent scope completed before test step finished execution. Ensure all steps are awaited (ex. `await t.step(...)`).
- at [WILDCARD]
- at async TestContext.step [WILDCARD]
- step ... FAILED ([WILDCARD])
- error: 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 [WILDCARD]
- at async fn ([WILDCARD]/invalid_usage.ts:[WILDCARD])
-inner missing await ... FAILED ([WILDCARD])
+ inner ... INCOMPLETE
+ step ... FAILED (due to incomplete steps) ([WILDCARD])
+inner missing await ... FAILED (due to 1 failed step) ([WILDCARD])
parallel steps with sanitizers ...
- step 1 ... pending ([WILDCARD])
+ step 1 ... INCOMPLETE
step 2 ... FAILED ([WILDCARD])
- error: 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 [WILDCARD]
- at [WILDCARD]/invalid_usage.ts:[WILDCARD]
-parallel steps with sanitizers ... FAILED ([WILDCARD])
+parallel steps with sanitizers ... FAILED (due to incomplete steps) ([WILDCARD])
parallel steps when first has sanitizer ...
- step 1 ... pending ([WILDCARD])
+ step 1 ... ok ([WILDCARD])
step 2 ... FAILED ([WILDCARD])
- error: 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 [WILDCARD]
- at [WILDCARD]/invalid_usage.ts:[WILDCARD]
-parallel steps when first has sanitizer ... FAILED ([WILDCARD])
+parallel steps when first has sanitizer ... FAILED (due to 1 failed step) ([WILDCARD])
parallel steps when second has sanitizer ...
step 1 ... ok ([WILDCARD])
step 2 ... FAILED ([WILDCARD])
- error: 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 [WILDCARD]
- at [WILDCARD]/invalid_usage.ts:[WILDCARD]
-parallel steps when second has sanitizer ... FAILED ([WILDCARD])
+parallel steps when second has sanitizer ... FAILED (due to 1 failed step) ([WILDCARD])
parallel steps where only inner tests have sanitizers ...
step 1 ...
step inner ... ok ([WILDCARD])
step 1 ... ok ([WILDCARD])
step 2 ...
step inner ... FAILED ([WILDCARD])
- error: 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 [WILDCARD]
- at [WILDCARD]/invalid_usage.ts:[WILDCARD]
- step 2 ... FAILED ([WILDCARD])
-parallel steps where only inner tests have sanitizers ... FAILED ([WILDCARD])
+ step 2 ... FAILED (due to 1 failed step) ([WILDCARD])
+parallel steps where only inner tests have sanitizers ... FAILED (due to 1 failed step) ([WILDCARD])
ERRORS
@@ -73,38 +41,42 @@ error: Error: Cannot run test step after parent scope has finished execution. En
at TestContext.step ([WILDCARD])
at [WILDCARD]/invalid_usage.ts:[WILDCARD]
-top level missing await => ./test/steps/invalid_usage.ts:[WILDCARD]
-error: Error: There were still test steps running after the current scope finished execution. Ensure all steps are awaited (ex. `await t.step(...)`).
- [WILDCARD]
+top level missing await ... step => ./test/steps/invalid_usage.ts:[WILDCARD]
+error: Didn't complete before parent. Await step with `await t.step(...)`.
+
+inner missing await ... step ... inner => ./test/steps/invalid_usage.ts:[WILDCARD]
+error: Didn't complete before parent. Await step with `await t.step(...)`.
-inner missing await => ./test/steps/invalid_usage.ts:[WILDCARD]
-error: Error: 1 test step failed.
- at [WILDCARD]
+parallel steps with sanitizers ... step 2 => ./test/steps/invalid_usage.ts:[WILDCARD]
+error: Started test step while another test step with sanitizers was running:
+ * parallel steps with sanitizers ... step 1
-parallel steps with sanitizers => ./test/steps/invalid_usage.ts:[WILDCARD]
-error: Error: There were still test steps running after the current scope finished execution. Ensure all steps are awaited (ex. `await t.step(...)`).
- [WILDCARD]
+parallel steps with sanitizers ... step 1 => ./test/steps/invalid_usage.ts:[WILDCARD]
+error: Didn't complete before parent. Await step with `await t.step(...)`.
-parallel steps when first has sanitizer => ./test/steps/invalid_usage.ts:[WILDCARD]
-error: Error: 1 test step failed.
- at runTest ([WILDCARD])
- at [WILDCARD]
+parallel steps when first has sanitizer ... step 2 => ./test/steps/invalid_usage.ts:[WILDCARD]
+error: Started test step while another test step with sanitizers was running:
+ * parallel steps when first has sanitizer ... step 1
-parallel steps when second has sanitizer => ./test/steps/invalid_usage.ts:[WILDCARD]
-error: Error: 1 test step failed.
- at runTest ([WILDCARD])
- at [WILDCARD]
+parallel steps when second has sanitizer ... step 2 => ./test/steps/invalid_usage.ts:[WILDCARD]
+error: Started test step with sanitizers while another test step was running:
+ * parallel steps when second has sanitizer ... step 1
+
+parallel steps where only inner tests have sanitizers ... step 2 ... step inner => ./test/steps/invalid_usage.ts:[WILDCARD]
+error: Started test step with sanitizers while another test step was running:
+ * parallel steps where only inner tests have sanitizers ... step 1
FAILURES
-capturing => ./test/steps/invalid_usage.ts:[WILDCARD]
-top level missing await => ./test/steps/invalid_usage.ts:[WILDCARD]
-inner missing await => ./test/steps/invalid_usage.ts:[WILDCARD]
-parallel steps with sanitizers => ./test/steps/invalid_usage.ts:[WILDCARD]
-parallel steps when first has sanitizer => ./test/steps/invalid_usage.ts:[WILDCARD]
-parallel steps when second has sanitizer => ./test/steps/invalid_usage.ts:[WILDCARD]
-parallel steps where only inner tests have sanitizers => ./test/steps/invalid_usage.ts:[WILDCARD]
+capturing => ./test/steps/invalid_usage.ts:3:6
+top level missing await ... step => ./test/steps/invalid_usage.ts:[WILDCARD]
+inner missing await ... step ... inner => ./test/steps/invalid_usage.ts:[WILDCARD]
+parallel steps with sanitizers ... step 2 => ./test/steps/invalid_usage.ts:[WILDCARD]
+parallel steps with sanitizers ... step 1 => ./test/steps/invalid_usage.ts:[WILDCARD]
+parallel steps when first has sanitizer ... step 2 => ./test/steps/invalid_usage.ts:[WILDCARD]
+parallel steps when second has sanitizer ... step 2 => ./test/steps/invalid_usage.ts:[WILDCARD]
+parallel steps where only inner tests have sanitizers ... step 2 ... step inner => ./test/steps/invalid_usage.ts:[WILDCARD]
-FAILED | 0 passed (4 steps) | 7 failed (10 steps) ([WILDCARD])
+FAILED | 0 passed (5 steps) | 7 failed (9 steps) ([WILDCARD])
error: Test failed
diff --git a/cli/tests/testdata/test/steps/invalid_usage.ts b/cli/tests/testdata/test/steps/invalid_usage.ts
index bc761b5dd..fcbe8b454 100644
--- a/cli/tests/testdata/test/steps/invalid_usage.ts
+++ b/cli/tests/testdata/test/steps/invalid_usage.ts
@@ -11,7 +11,7 @@ Deno.test("capturing", async (t) => {
Deno.test("top level missing await", (t) => {
t.step("step", () => {
- return new Promise((resolve) => setTimeout(resolve, 10));
+ return new Promise(() => {});
});
});
diff --git a/cli/tests/unit_node/process_test.ts b/cli/tests/unit_node/process_test.ts
index 7310e4ad7..686a3dbbc 100644
--- a/cli/tests/unit_node/process_test.ts
+++ b/cli/tests/unit_node/process_test.ts
@@ -155,24 +155,29 @@ Deno.test({
name: "process.on signal",
ignore: Deno.build.os == "windows",
async fn() {
- const promise = deferred();
- let c = 0;
- const listener = () => {
- c += 1;
- };
- process.on("SIGINT", listener);
- setTimeout(async () => {
- // Sends SIGINT 3 times.
- for (const _ of Array(3)) {
- await delay(20);
- Deno.kill(Deno.pid, "SIGINT");
- }
+ const process = new Deno.Command(Deno.execPath(), {
+ args: [
+ "eval",
+ `
+ import process from "node:process";
+ setInterval(() => {}, 1000);
+ process.on("SIGINT", () => {
+ console.log("foo");
+ });
+ `,
+ ],
+ stdout: "piped",
+ stderr: "null",
+ }).spawn();
+ await delay(500);
+ for (const _ of Array(3)) {
+ process.kill("SIGINT");
await delay(20);
- Deno.removeSignalListener("SIGINT", listener);
- promise.resolve();
- });
- await promise;
- assertEquals(c, 3);
+ }
+ await delay(20);
+ process.kill("SIGTERM");
+ const output = await process.output();
+ assertEquals(new TextDecoder().decode(output.stdout), "foo\nfoo\nfoo\n");
},
});
@@ -180,24 +185,35 @@ Deno.test({
name: "process.off signal",
ignore: Deno.build.os == "windows",
async fn() {
- const promise = deferred();
- let c = 0;
- const listener = () => {
- c += 1;
- process.off("SIGINT", listener);
- };
- process.on("SIGINT", listener);
- setTimeout(async () => {
- // Sends SIGINT 3 times.
- for (const _ of Array(3)) {
- await delay(20);
- Deno.kill(Deno.pid, "SIGINT");
- }
+ const process = new Deno.Command(Deno.execPath(), {
+ args: [
+ "eval",
+ `
+ import process from "node:process";
+ setInterval(() => {}, 1000);
+ const listener = () => {
+ console.log("foo");
+ process.off("SIGINT")
+ };
+ process.on("SIGINT", listener);
+ `,
+ ],
+ stdout: "piped",
+ stderr: "null",
+ }).spawn();
+ await delay(500);
+ for (const _ of Array(3)) {
+ try {
+ process.kill("SIGINT");
+ } catch { /* should die after the first one */ }
await delay(20);
- promise.resolve();
- });
- await promise;
- assertEquals(c, 1);
+ }
+ await delay(20);
+ try {
+ process.kill("SIGTERM");
+ } catch { /* should be dead, avoid hanging just in case */ }
+ const output = await process.output();
+ assertEquals(new TextDecoder().decode(output.stdout), "foo\n");
},
});