mirror of
https://github.com/denoland/deno.git
synced 2025-01-05 13:59:01 -05:00
fix(test): don't error on missing op details (#14074)
This commit is contained in:
parent
3f805e61e2
commit
c7aecc1299
4 changed files with 41 additions and 2 deletions
|
@ -180,6 +180,12 @@ itest!(ops_sanitizer_multiple_timeout_tests_no_trace {
|
|||
output: "test/ops_sanitizer_multiple_timeout_tests_no_trace.out",
|
||||
});
|
||||
|
||||
itest!(ops_sanitizer_missing_details {
|
||||
args: "test --allow-write --allow-read test/ops_sanitizer_missing_details.ts",
|
||||
exit_code: 1,
|
||||
output: "test/ops_sanitizer_missing_details.out",
|
||||
});
|
||||
|
||||
itest!(ops_sanitizer_nexttick {
|
||||
args: "test test/ops_sanitizer_nexttick.ts",
|
||||
output: "test/ops_sanitizer_nexttick.out",
|
||||
|
|
20
cli/tests/testdata/test/ops_sanitizer_missing_details.out
vendored
Normal file
20
cli/tests/testdata/test/ops_sanitizer_missing_details.out
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
Check [WILDCARD]test/ops_sanitizer_missing_details.ts
|
||||
running 1 test from [WILDCARD]test/ops_sanitizer_missing_details.ts
|
||||
test test 1 ... FAILED [WILDCARD]
|
||||
|
||||
failures:
|
||||
|
||||
test 1
|
||||
Test case is 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.
|
||||
|
||||
failures:
|
||||
|
||||
test 1
|
||||
|
||||
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out [WILDCARD]
|
||||
|
||||
error: Test failed
|
10
cli/tests/testdata/test/ops_sanitizer_missing_details.ts
vendored
Normal file
10
cli/tests/testdata/test/ops_sanitizer_missing_details.ts
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
// https://github.com/denoland/deno/issues/13729
|
||||
// https://github.com/denoland/deno/issues/13938
|
||||
import { writeAll } from "../../../../test_util/std/io/util.ts";
|
||||
|
||||
Deno.test("test 1", { permissions: { write: true, read: true } }, async () => {
|
||||
const tmpFile = await Deno.makeTempFile();
|
||||
const file = await Deno.open(tmpFile, { write: true });
|
||||
const buf = new Uint8Array(new Array(1_000_000).fill(1));
|
||||
writeAll(file, buf);
|
||||
});
|
|
@ -173,13 +173,16 @@
|
|||
preOp.opsCompletedAsync;
|
||||
|
||||
if (dispatchedDiff > completedDiff) {
|
||||
const [name, hint] = OP_DETAILS[key];
|
||||
const [name, hint] = OP_DETAILS[key] || [key, null];
|
||||
const count = dispatchedDiff - completedDiff;
|
||||
let message = `${count} async operation${
|
||||
count === 1 ? "" : "s"
|
||||
} to ${name} ${
|
||||
count === 1 ? "was" : "were"
|
||||
} started in this test, but never completed. This is often caused by not ${hint}.`;
|
||||
} started in this test, but never completed.`;
|
||||
if (hint) {
|
||||
message += ` This is often caused by not ${hint}.`;
|
||||
}
|
||||
const traces = [];
|
||||
for (const [id, { opName, stack }] of postTraces) {
|
||||
if (opName !== key) continue;
|
||||
|
|
Loading…
Reference in a new issue