mirror of
https://github.com/denoland/deno.git
synced 2024-12-23 15:49:44 -05:00
parent
bc782cee98
commit
1f3c4c9763
4 changed files with 43 additions and 6 deletions
|
@ -792,6 +792,19 @@ async fn run_tests_for_worker_inner(
|
|||
}
|
||||
};
|
||||
|
||||
// Check the result before we check for leaks
|
||||
let result = {
|
||||
let scope = &mut worker.js_runtime.handle_scope();
|
||||
let result = v8::Local::new(scope, result);
|
||||
serde_v8::from_v8::<TestResult>(scope, result)?
|
||||
};
|
||||
if matches!(result, TestResult::Failed(_)) {
|
||||
fail_fast_tracker.add_failure();
|
||||
let elapsed = earlier.elapsed().as_millis();
|
||||
sender.send(TestEvent::Result(desc.id, result, elapsed as u64))?;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Await activity stabilization
|
||||
if let Some(diff) = wait_for_activity_to_stabilize(
|
||||
worker,
|
||||
|
@ -806,6 +819,7 @@ async fn run_tests_for_worker_inner(
|
|||
let (formatted, trailer_notes) = format_sanitizer_diff(diff);
|
||||
if !formatted.is_empty() {
|
||||
let failure = TestFailure::Leaked(formatted, trailer_notes);
|
||||
fail_fast_tracker.add_failure();
|
||||
let elapsed = earlier.elapsed().as_millis();
|
||||
sender.send(TestEvent::Result(
|
||||
desc.id,
|
||||
|
@ -816,12 +830,6 @@ async fn run_tests_for_worker_inner(
|
|||
}
|
||||
}
|
||||
|
||||
let scope = &mut worker.js_runtime.handle_scope();
|
||||
let result = v8::Local::new(scope, result);
|
||||
let result = serde_v8::from_v8::<TestResult>(scope, result)?;
|
||||
if matches!(result, TestResult::Failed(_)) {
|
||||
fail_fast_tracker.add_failure();
|
||||
}
|
||||
let elapsed = earlier.elapsed().as_millis();
|
||||
sender.send(TestEvent::Result(desc.id, result, elapsed as u64))?;
|
||||
}
|
||||
|
|
5
tests/specs/test/sanitizer_with_error/__test__.json
Normal file
5
tests/specs/test/sanitizer_with_error/__test__.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"args": "test --quiet --reload main.js",
|
||||
"output": "main.out",
|
||||
"exitCode": 1
|
||||
}
|
6
tests/specs/test/sanitizer_with_error/main.js
Normal file
6
tests/specs/test/sanitizer_with_error/main.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
Deno.test(function throws() {
|
||||
// Leak
|
||||
setTimeout(() => {}, 60_000);
|
||||
// But the exception should mask the leak
|
||||
throw new Error("Throws");
|
||||
});
|
18
tests/specs/test/sanitizer_with_error/main.out
Normal file
18
tests/specs/test/sanitizer_with_error/main.out
Normal file
|
@ -0,0 +1,18 @@
|
|||
running 1 test from ./main.js
|
||||
throws ... FAILED ([WILDCARD])
|
||||
|
||||
ERRORS
|
||||
|
||||
throws => ./main.js:1:6
|
||||
error: Error: Throws
|
||||
throw new Error("Throws");
|
||||
^
|
||||
at throws ([WILDCARD]/main.js:5:9)
|
||||
|
||||
FAILURES
|
||||
|
||||
throws => ./main.js:1:6
|
||||
|
||||
FAILED | 0 passed | 1 failed ([WILDCARD])
|
||||
|
||||
error: Test failed
|
Loading…
Reference in a new issue