test(Utils): Add `skip_slow_tests` function
@@ -18,6 +18,21 @@ pub fn fixtures() -> PathBuf {
home().join("fixtures")
}
+/// Should slow tests be skipped?
+///
+/// Use at the start of slow tests to return early except on CI or when
+/// the env var `RUN_SLOW_TESTS` is set.
+///
+/// Inspired by https://github.com/rust-analyzer/rust-analyzer/pull/2491
+pub fn skip_slow_tests() -> bool {
+ if std::env::var("CI").is_err() && std::env::var("RUN_SLOW_TESTS").is_err() {
+ eprintln!("Skipping slow test");
+ true
+ } else {
+ false
+ }
+}
+
/// Assert that two nodes are equal based on their `Debug` display
///
/// Indented debug display is used as it more easily allows differences to be
