mirror of
https://github.com/denoland/deno.git
synced 2025-03-04 01:44:26 -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>,
|
pub cwd: Option<String>,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub tests: BTreeMap<String, JsonMap>,
|
pub tests: BTreeMap<String, JsonMap>,
|
||||||
|
#[serde(default)]
|
||||||
|
pub ignore: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MultiTestMetaData {
|
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());
|
let mut collected_tests = Vec::with_capacity(self.tests.len());
|
||||||
|
@ -125,6 +130,8 @@ struct MultiStepMetaData {
|
||||||
pub repeat: Option<usize>,
|
pub repeat: Option<usize>,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub steps: Vec<StepMetaData>,
|
pub steps: Vec<StepMetaData>,
|
||||||
|
#[serde(default)]
|
||||||
|
pub ignore: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Deserialize)]
|
#[derive(Clone, Deserialize)]
|
||||||
|
@ -138,6 +145,8 @@ struct SingleTestMetaData {
|
||||||
pub repeat: Option<usize>,
|
pub repeat: Option<usize>,
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub step: StepMetaData,
|
pub step: StepMetaData,
|
||||||
|
#[serde(default)]
|
||||||
|
pub ignore: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SingleTestMetaData {
|
impl SingleTestMetaData {
|
||||||
|
@ -149,6 +158,7 @@ impl SingleTestMetaData {
|
||||||
repeat: self.repeat,
|
repeat: self.repeat,
|
||||||
envs: Default::default(),
|
envs: Default::default(),
|
||||||
steps: vec![self.step],
|
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 diagnostic_logger = Rc::new(RefCell::new(Vec::<u8>::new()));
|
||||||
let result = TestResult::from_maybe_panic_or_result(AssertUnwindSafe(|| {
|
let result = TestResult::from_maybe_panic_or_result(AssertUnwindSafe(|| {
|
||||||
let metadata = deserialize_value(metadata_value);
|
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(
|
TestResult::SubTests(
|
||||||
(0..repeat)
|
(0..repeat)
|
||||||
.map(|i| {
|
.map(|i| {
|
||||||
|
|
|
@ -50,6 +50,9 @@
|
||||||
},
|
},
|
||||||
"exitCode": {
|
"exitCode": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"ignore": {
|
||||||
|
"type": "boolean"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -77,6 +80,9 @@
|
||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/definitions/single_test"
|
"$ref": "#/definitions/single_test"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"ignore": {
|
||||||
|
"type": "boolean"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
@ -126,6 +132,9 @@
|
||||||
"additionalProperties": {
|
"additionalProperties": {
|
||||||
"$ref": "#/definitions/single_or_multi_step_test"
|
"$ref": "#/definitions/single_or_multi_step_test"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"ignore": {
|
||||||
|
"type": "boolean"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue