Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add WPT as optional tests for boa_runtime #4008

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
189 changes: 124 additions & 65 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ criterion = "0.5.1"
float-cmp = "0.9.0"
futures-lite = "2.4.0"
test-case = "3.3.1"
rstest = "0.23.0"
winapi = { version = "0.3.9", default-features = false }

# ICU4X
Expand Down
11 changes: 10 additions & 1 deletion core/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ boa_engine.workspace = true
boa_gc.workspace = true
boa_interop.workspace = true
rustc-hash = { workspace = true, features = ["std"] }
url = { version = "2.5.2", optional = true }
url = { version = "2.5.3", optional = true }

[dev-dependencies]
boa_interop.workspace = true
indoc.workspace = true
rstest.workspace = true
textwrap.workspace = true

[lints]
Expand All @@ -30,3 +32,10 @@ all-features = true
[features]
default = ["all"]
all = ["url"]
wpt-tests = []
# This feature is used to disable compiling the WPT tests in the CI
# when using `--all-features`. If this feature is enabled, we disable
# the compilation of the WPT tests (since they will panic).
# Clippy will be disabled for those methods as well, but they're one
# line long.
wpt-tests-do-not-use = []
Copy link
Member

@jedel1043 jedel1043 Nov 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, I think it's slightly weird to have tests be enabled by features instead of by only the test cfg. Can we just have a separate crate in the workspace for wpt tests, just like boa_tester? We could also potentially merge them together in the future.

26 changes: 26 additions & 0 deletions core/runtime/src/console/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,32 @@ impl Logger for DefaultLogger {
}
}

/// A logger that drops all logging. Useful for testing.
#[derive(Debug, Trace, Finalize)]
pub struct NullLogger;

impl Logger for NullLogger {
#[inline]
fn log(&self, _: String, _: &ConsoleState, _: &mut Context) -> JsResult<()> {
Ok(())
}

#[inline]
fn info(&self, _: String, _: &ConsoleState, _: &mut Context) -> JsResult<()> {
Ok(())
}

#[inline]
fn warn(&self, _: String, _: &ConsoleState, _: &mut Context) -> JsResult<()> {
Ok(())
}

#[inline]
fn error(&self, _: String, _: &ConsoleState, _: &mut Context) -> JsResult<()> {
Ok(())
}
}

/// This represents the `console` formatter.
fn formatter(data: &[JsValue], context: &mut Context) -> JsResult<String> {
fn to_string(value: &JsValue, context: &mut Context) -> JsResult<String> {
Expand Down
Loading
Loading