Skip to content

Commit

Permalink
New test262 results format (#783)
Browse files Browse the repository at this point in the history
  • Loading branch information
Razican authored Oct 3, 2020
1 parent 31e3174 commit 2a509de
Show file tree
Hide file tree
Showing 10 changed files with 300 additions and 135 deletions.
172 changes: 168 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion boa/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ num-integer = "0.1.43"
bitflags = "1.2.1"
indexmap = "1.6.0"
ryu-js = "0.2.1"
chrono = "0.4.18"
chrono = "0.4.19"

# Optional Dependencies
serde = { version = "1.0.116", features = ["derive"], optional = true }
Expand Down
2 changes: 2 additions & 0 deletions boa_tester/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ regex = "1.3.9"
once_cell = "1.4.1"
colored = "2.0.0"
fxhash = "0.2.1"
git2 = "0.13.11"
hex = "0.4.2"
50 changes: 34 additions & 16 deletions boa_tester/src/exec.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
//! Execution module for the test runner.

use super::{Harness, Outcome, Phase, SuiteResult, Test, TestFlags, TestResult, TestSuite, CLI};
use super::{
Harness, Outcome, Phase, SuiteResult, Test, TestFlags, TestOutcomeResult, TestResult,
TestSuite, CLI,
};
use boa::{parse, Context};
use colored::Colorize;
use fxhash::FxHashSet;
Expand Down Expand Up @@ -43,10 +46,10 @@ impl TestSuite {
let mut passed = 0;
let mut ignored = 0;
for test in &tests {
if let Some(true) = test.passed {
passed += 1;
} else if test.passed.is_none() {
ignored += 1;
match test.result {
TestOutcomeResult::Passed => passed += 1,
TestOutcomeResult::Ignored => ignored += 1,
_ => {}
}
}

Expand Down Expand Up @@ -74,7 +77,7 @@ impl TestSuite {
passed,
ignored,
suites,
tests: tests.into_boxed_slice(),
tests,
}
}
}
Expand All @@ -84,7 +87,7 @@ impl Test {
pub(crate) fn run(&self, harness: &Harness) -> TestResult {
// println!("Starting `{}`", self.name);

let passed = if !self.flags.intersects(TestFlags::ASYNC | TestFlags::MODULE)
let result = if !self.flags.intersects(TestFlags::ASYNC | TestFlags::MODULE)
&& !IGNORED.contains(&self.name)
{
let res = panic::catch_unwind(|| {
Expand Down Expand Up @@ -138,24 +141,39 @@ impl Test {
}
});

let passed = res.unwrap_or_else(|_| {
eprintln!("last panic was on test \"{}\"", self.name);
false
});

print!("{}", if passed { ".".green() } else { ".".red() });
let result = res
.map(|res| {
if res {
TestOutcomeResult::Passed
} else {
TestOutcomeResult::Failed
}
})
.unwrap_or_else(|_| {
eprintln!("last panic was on test \"{}\"", self.name);
TestOutcomeResult::Panic
});

print!(
"{}",
if let TestOutcomeResult::Passed = result {
".".green()
} else {
".".red()
}
);

Some(passed)
result
} else {
// Ignoring async tests for now.
// TODO: implement async and add `harness/doneprintHandle.js` to the includes.
print!("{}", ".".yellow());
None
TestOutcomeResult::Ignored
};

TestResult {
name: self.name.clone(),
passed,
result,
}
}

Expand Down
Loading

0 comments on commit 2a509de

Please sign in to comment.