summaryrefslogtreecommitdiff
path: root/test_util/src/builders.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2023-04-06 21:41:19 -0400
committerGitHub <noreply@github.com>2023-04-06 21:41:19 -0400
commit5c7f76c570bc099c4e60b38443194c1890808a7f (patch)
tree99d5ebed160929d6812346f60ec902284e8f83af /test_util/src/builders.rs
parent0dca0c5196249c5f947de9ced572967872c0ad6e (diff)
fix(npm): reload an npm package's dependency's information when version not found (#18622)
This reloads an npm package's dependency's information when a version/version req/tag is not found. This PR applies only to dependencies of npm packages. It does NOT yet cause npm specifiers to have their dependency information cache busted. That requires a different solution, but this should help cache bust in more scenarios. Part of #16901, but doesn't close it yet
Diffstat (limited to 'test_util/src/builders.rs')
-rw-r--r--test_util/src/builders.rs16
1 files changed, 9 insertions, 7 deletions
diff --git a/test_util/src/builders.rs b/test_util/src/builders.rs
index 254490073..a5f192b73 100644
--- a/test_util/src/builders.rs
+++ b/test_util/src/builders.rs
@@ -455,6 +455,7 @@ pub struct TestCommandOutput {
}
impl Drop for TestCommandOutput {
+ // assert the output and exit code was asserted
fn drop(&mut self) {
fn panic_unasserted_output(text: &str) {
println!("OUTPUT\n{text}\nOUTPUT");
@@ -467,13 +468,6 @@ impl Drop for TestCommandOutput {
if std::thread::panicking() {
return;
}
- // force the caller to assert these
- if !*self.asserted_exit_code.borrow() && self.exit_code != Some(0) {
- panic!(
- "The non-zero exit code of the command was not asserted: {:?}",
- self.exit_code,
- )
- }
// either the combined output needs to be asserted or both stdout and stderr
if let Some(combined) = &self.combined {
@@ -489,6 +483,14 @@ impl Drop for TestCommandOutput {
panic_unasserted_output(stderr);
}
}
+
+ // now ensure the exit code was asserted
+ if !*self.asserted_exit_code.borrow() && self.exit_code != Some(0) {
+ panic!(
+ "The non-zero exit code of the command was not asserted: {:?}",
+ self.exit_code,
+ )
+ }
}
}