From 5c7f76c570bc099c4e60b38443194c1890808a7f Mon Sep 17 00:00:00 2001 From: David Sherret Date: Thu, 6 Apr 2023 21:41:19 -0400 Subject: 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 --- test_util/src/builders.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'test_util/src/builders.rs') 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, + ) + } } } -- cgit v1.2.3