mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
test: add supporting for ignoring spec tests (#25242)
You can now specify `"ignore": true` for either the whole file, concrete test, or concrete step.
This commit is contained in:
parent
bb26fef494
commit
b1b72a8a49
2 changed files with 22 additions and 1 deletions
|
@ -56,6 +56,8 @@ struct MultiTestMetaData {
|
|||
pub cwd: Option<String>,
|
||||
#[serde(default)]
|
||||
pub tests: BTreeMap<String, JsonMap>,
|
||||
#[serde(default)]
|
||||
pub ignore: bool,
|
||||
}
|
||||
|
||||
impl MultiTestMetaData {
|
||||
|
@ -90,6 +92,9 @@ impl MultiTestMetaData {
|
|||
}
|
||||
}
|
||||
}
|
||||
if multi_test_meta_data.ignore && !value.contains_key("ignore") {
|
||||
value.insert("ignore".to_string(), true.into());
|
||||
}
|
||||
}
|
||||
|
||||
let mut collected_tests = Vec::with_capacity(self.tests.len());
|
||||
|
@ -125,6 +130,8 @@ struct MultiStepMetaData {
|
|||
pub repeat: Option<usize>,
|
||||
#[serde(default)]
|
||||
pub steps: Vec<StepMetaData>,
|
||||
#[serde(default)]
|
||||
pub ignore: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Deserialize)]
|
||||
|
@ -138,6 +145,8 @@ struct SingleTestMetaData {
|
|||
pub repeat: Option<usize>,
|
||||
#[serde(flatten)]
|
||||
pub step: StepMetaData,
|
||||
#[serde(default)]
|
||||
pub ignore: bool,
|
||||
}
|
||||
|
||||
impl SingleTestMetaData {
|
||||
|
@ -149,6 +158,7 @@ impl SingleTestMetaData {
|
|||
repeat: self.repeat,
|
||||
envs: Default::default(),
|
||||
steps: vec![self.step],
|
||||
ignore: self.ignore,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -236,7 +246,9 @@ fn run_test(test: &CollectedTest<serde_json::Value>) -> TestResult {
|
|||
let diagnostic_logger = Rc::new(RefCell::new(Vec::<u8>::new()));
|
||||
let result = TestResult::from_maybe_panic_or_result(AssertUnwindSafe(|| {
|
||||
let metadata = deserialize_value(metadata_value);
|
||||
if let Some(repeat) = metadata.repeat {
|
||||
if metadata.ignore {
|
||||
TestResult::Ignored
|
||||
} else if let Some(repeat) = metadata.repeat {
|
||||
TestResult::SubTests(
|
||||
(0..repeat)
|
||||
.map(|i| {
|
||||
|
|
|
@ -50,6 +50,9 @@
|
|||
},
|
||||
"exitCode": {
|
||||
"type": "integer"
|
||||
},
|
||||
"ignore": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -77,6 +80,9 @@
|
|||
"items": {
|
||||
"$ref": "#/definitions/single_test"
|
||||
}
|
||||
},
|
||||
"ignore": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}, {
|
||||
|
@ -126,6 +132,9 @@
|
|||
"additionalProperties": {
|
||||
"$ref": "#/definitions/single_or_multi_step_test"
|
||||
}
|
||||
},
|
||||
"ignore": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue