diff --git a/cli/tests/test/exit_sanitizer.out b/cli/tests/test/exit_sanitizer.out index 6be668b867..76d04ddf0b 100644 --- a/cli/tests/test/exit_sanitizer.out +++ b/cli/tests/test/exit_sanitizer.out @@ -15,8 +15,8 @@ AssertionError: Test case attempted to exit with exit code: 0 at asyncOpSanitizer (deno:runtime/js/40_testing.js:35:15) at resourceSanitizer (deno:runtime/js/40_testing.js:72:13) at exitSanitizer (deno:runtime/js/40_testing.js:99:15) - at runTest (deno:runtime/js/40_testing.js:218:13) - at Object.runTests (deno:runtime/js/40_testing.js:264:13) + at runTest (deno:runtime/js/40_testing.js:206:13) + at Object.runTests (deno:runtime/js/40_testing.js:249:28) at [WILDCARD]/$deno$test.js:1:27 exit(1) @@ -28,8 +28,8 @@ AssertionError: Test case attempted to exit with exit code: 1 at asyncOpSanitizer (deno:runtime/js/40_testing.js:35:15) at resourceSanitizer (deno:runtime/js/40_testing.js:72:13) at exitSanitizer (deno:runtime/js/40_testing.js:99:15) - at runTest (deno:runtime/js/40_testing.js:218:13) - at Object.runTests (deno:runtime/js/40_testing.js:264:13) + at runTest (deno:runtime/js/40_testing.js:206:13) + at Object.runTests (deno:runtime/js/40_testing.js:249:28) at async [WILDCARD]/$deno$test.js:1:1 exit(2) @@ -41,8 +41,8 @@ AssertionError: Test case attempted to exit with exit code: 2 at asyncOpSanitizer (deno:runtime/js/40_testing.js:35:15) at resourceSanitizer (deno:runtime/js/40_testing.js:72:13) at exitSanitizer (deno:runtime/js/40_testing.js:99:15) - at runTest (deno:runtime/js/40_testing.js:218:13) - at Object.runTests (deno:runtime/js/40_testing.js:264:13) + at runTest (deno:runtime/js/40_testing.js:206:13) + at Object.runTests (deno:runtime/js/40_testing.js:249:28) at async [WILDCARD]/$deno$test.js:1:1 failures: diff --git a/cli/tests/test/fail.out b/cli/tests/test/fail.out index e919fdddab..0ae4d1dd07 100644 --- a/cli/tests/test/fail.out +++ b/cli/tests/test/fail.out @@ -19,8 +19,8 @@ Error at asyncOpSanitizer (deno:runtime/js/40_testing.js:35:15) at resourceSanitizer (deno:runtime/js/40_testing.js:72:13) at exitSanitizer (deno:runtime/js/40_testing.js:99:15) - at runTest (deno:runtime/js/40_testing.js:218:13) - at Object.runTests (deno:runtime/js/40_testing.js:264:13) + at runTest (deno:runtime/js/40_testing.js:206:13) + at Object.runTests (deno:runtime/js/40_testing.js:249:28) at [WILDCARD]/$deno$test.js:1:27 test 1 @@ -29,8 +29,8 @@ Error at asyncOpSanitizer (deno:runtime/js/40_testing.js:35:15) at resourceSanitizer (deno:runtime/js/40_testing.js:72:13) at exitSanitizer (deno:runtime/js/40_testing.js:99:15) - at runTest (deno:runtime/js/40_testing.js:218:13) - at Object.runTests (deno:runtime/js/40_testing.js:264:13) + at runTest (deno:runtime/js/40_testing.js:206:13) + at Object.runTests (deno:runtime/js/40_testing.js:249:28) at async [WILDCARD]/$deno$test.js:1:1 test 2 @@ -39,8 +39,8 @@ Error at asyncOpSanitizer (deno:runtime/js/40_testing.js:35:15) at resourceSanitizer (deno:runtime/js/40_testing.js:72:13) at exitSanitizer (deno:runtime/js/40_testing.js:99:15) - at runTest (deno:runtime/js/40_testing.js:218:13) - at Object.runTests (deno:runtime/js/40_testing.js:264:13) + at runTest (deno:runtime/js/40_testing.js:206:13) + at Object.runTests (deno:runtime/js/40_testing.js:249:28) at async [WILDCARD]/$deno$test.js:1:1 test 3 @@ -49,8 +49,8 @@ Error at asyncOpSanitizer (deno:runtime/js/40_testing.js:35:15) at resourceSanitizer (deno:runtime/js/40_testing.js:72:13) at exitSanitizer (deno:runtime/js/40_testing.js:99:15) - at runTest (deno:runtime/js/40_testing.js:218:13) - at Object.runTests (deno:runtime/js/40_testing.js:264:13) + at runTest (deno:runtime/js/40_testing.js:206:13) + at Object.runTests (deno:runtime/js/40_testing.js:249:28) at async [WILDCARD]/$deno$test.js:1:1 test 4 @@ -59,8 +59,8 @@ Error at asyncOpSanitizer (deno:runtime/js/40_testing.js:35:15) at resourceSanitizer (deno:runtime/js/40_testing.js:72:13) at exitSanitizer (deno:runtime/js/40_testing.js:99:15) - at runTest (deno:runtime/js/40_testing.js:218:13) - at Object.runTests (deno:runtime/js/40_testing.js:264:13) + at runTest (deno:runtime/js/40_testing.js:206:13) + at Object.runTests (deno:runtime/js/40_testing.js:249:28) at async [WILDCARD]/$deno$test.js:1:1 test 5 @@ -69,8 +69,8 @@ Error at asyncOpSanitizer (deno:runtime/js/40_testing.js:35:15) at resourceSanitizer (deno:runtime/js/40_testing.js:72:13) at exitSanitizer (deno:runtime/js/40_testing.js:99:15) - at runTest (deno:runtime/js/40_testing.js:218:13) - at Object.runTests (deno:runtime/js/40_testing.js:264:13) + at runTest (deno:runtime/js/40_testing.js:206:13) + at Object.runTests (deno:runtime/js/40_testing.js:249:28) at async [WILDCARD]/$deno$test.js:1:1 test 6 @@ -79,8 +79,8 @@ Error at asyncOpSanitizer (deno:runtime/js/40_testing.js:35:15) at resourceSanitizer (deno:runtime/js/40_testing.js:72:13) at exitSanitizer (deno:runtime/js/40_testing.js:99:15) - at runTest (deno:runtime/js/40_testing.js:218:13) - at Object.runTests (deno:runtime/js/40_testing.js:264:13) + at runTest (deno:runtime/js/40_testing.js:206:13) + at Object.runTests (deno:runtime/js/40_testing.js:249:28) at async [WILDCARD]/$deno$test.js:1:1 test 7 @@ -89,8 +89,8 @@ Error at asyncOpSanitizer (deno:runtime/js/40_testing.js:35:15) at resourceSanitizer (deno:runtime/js/40_testing.js:72:13) at exitSanitizer (deno:runtime/js/40_testing.js:99:15) - at runTest (deno:runtime/js/40_testing.js:218:13) - at Object.runTests (deno:runtime/js/40_testing.js:264:13) + at runTest (deno:runtime/js/40_testing.js:206:13) + at Object.runTests (deno:runtime/js/40_testing.js:249:28) at async [WILDCARD]/$deno$test.js:1:1 test 8 @@ -99,8 +99,8 @@ Error at asyncOpSanitizer (deno:runtime/js/40_testing.js:35:15) at resourceSanitizer (deno:runtime/js/40_testing.js:72:13) at exitSanitizer (deno:runtime/js/40_testing.js:99:15) - at runTest (deno:runtime/js/40_testing.js:218:13) - at Object.runTests (deno:runtime/js/40_testing.js:264:13) + at runTest (deno:runtime/js/40_testing.js:206:13) + at Object.runTests (deno:runtime/js/40_testing.js:249:28) at async [WILDCARD]/$deno$test.js:1:1 test 9 @@ -109,8 +109,8 @@ Error at asyncOpSanitizer (deno:runtime/js/40_testing.js:35:15) at resourceSanitizer (deno:runtime/js/40_testing.js:72:13) at exitSanitizer (deno:runtime/js/40_testing.js:99:15) - at runTest (deno:runtime/js/40_testing.js:218:13) - at Object.runTests (deno:runtime/js/40_testing.js:264:13) + at runTest (deno:runtime/js/40_testing.js:206:13) + at Object.runTests (deno:runtime/js/40_testing.js:249:28) at async [WILDCARD]/$deno$test.js:1:1 failures: diff --git a/cli/tests/test/fail_fast.out b/cli/tests/test/fail_fast.out index a2f2e27725..50345a095c 100644 --- a/cli/tests/test/fail_fast.out +++ b/cli/tests/test/fail_fast.out @@ -10,8 +10,8 @@ Error at asyncOpSanitizer (deno:runtime/js/40_testing.js:35:15) at resourceSanitizer (deno:runtime/js/40_testing.js:72:13) at exitSanitizer (deno:runtime/js/40_testing.js:99:15) - at runTest (deno:runtime/js/40_testing.js:218:13) - at Object.runTests (deno:runtime/js/40_testing.js:264:13) + at runTest (deno:runtime/js/40_testing.js:206:13) + at Object.runTests (deno:runtime/js/40_testing.js:249:28) at [WILDCARD]/$deno$test.js:1:27 failures: diff --git a/cli/tests/test/finally_timeout.out b/cli/tests/test/finally_timeout.out index 40fde60f51..b6c997a898 100644 --- a/cli/tests/test/finally_timeout.out +++ b/cli/tests/test/finally_timeout.out @@ -11,8 +11,8 @@ Error: fail at asyncOpSanitizer (deno:runtime/js/40_testing.js:35:15) at resourceSanitizer (deno:runtime/js/40_testing.js:72:13) at exitSanitizer (deno:runtime/js/40_testing.js:99:15) - at runTest (deno:runtime/js/40_testing.js:218:13) - at Object.runTests (deno:runtime/js/40_testing.js:264:13) + at runTest (deno:runtime/js/40_testing.js:206:13) + at Object.runTests (deno:runtime/js/40_testing.js:249:28) at [WILDCARD]/$deno$test.js:1:27 failures: diff --git a/runtime/js/40_testing.js b/runtime/js/40_testing.js index b1adfa9936..3107f70a1d 100644 --- a/runtime/js/40_testing.js +++ b/runtime/js/40_testing.js @@ -191,48 +191,23 @@ finishing test case.`; core.opSync("op_restore_test_permissions", token); } - async function runTest({ name, ignore, fn, permissions }) { + async function runTest({ ignore, fn, permissions }) { let token = null; - const time = DateNow(); try { - postTestMessage("wait", { - name, - }); - if (permissions) { token = pledgeTestPermissions(permissions); } if (ignore) { - const duration = DateNow() - time; - postTestMessage("result", { - name, - duration, - result: "ignored", - }); - - return; + return "ignored"; } await fn(); - const duration = DateNow() - time; - postTestMessage("result", { - name, - duration, - result: "ok", - }); + return "ok"; } catch (error) { - const duration = DateNow() - time; - - postTestMessage("result", { - name, - duration, - result: { - "failed": inspectArgs([error]), - }, - }); + return { "failed": inspectArgs([error]) }; } finally { if (token) { restoreTestPermissions(token); @@ -261,7 +236,24 @@ finishing test case.`; }); for (const test of pending) { - await runTest(test); + const { + name, + } = test; + + const earlier = DateNow(); + + postTestMessage("wait", { + name, + }); + + const result = await runTest(test); + const duration = DateNow() - earlier; + + postTestMessage("result", { + name, + result, + duration, + }); } if (disableLog) {