1
0
mirror of https://github.com/fluencelabs/wasm-bindgen synced 2025-03-16 18:20:51 +00:00

Merge pull request from alexcrichton/only-node-tests

Add env vars to filter `wasm-bindgen-test-runner` tests
This commit is contained in:
Alex Crichton 2019-04-16 12:42:27 -05:00 committed by GitHub
commit 5ebfa27b62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -103,6 +103,30 @@ fn rmain() -> Result<(), Error> {
let headless = env::var("NO_HEADLESS").is_err(); let headless = env::var("NO_HEADLESS").is_err();
let debug = env::var("WASM_BINDGEN_NO_DEBUG").is_err(); let debug = env::var("WASM_BINDGEN_NO_DEBUG").is_err();
// Gracefully handle requests to execute only node or only web tests.
if env::var_os("WASM_BINDGEN_TEST_ONLY_NODE").is_some() {
if !node {
println!("this test suite is only configured to run in a browser, \
but we're only testing node.js tests so skipping");
return Ok(());
}
}
if env::var_os("WASM_BINDGEN_TEST_ONLY_WEB").is_some() {
if node {
println!("\
This test suite is only configured to run in node.js, but we're only running
browser tests so skipping. If you'd like to run the tests in a browser
include this in your crate when testing:
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
You'll likely want to put that in a `#[cfg(test)]` module or at the top of an
integration test.\
");
return Ok(());
}
}
// Make the generated bindings available for the tests to execute against. // Make the generated bindings available for the tests to execute against.
shell.status("Executing bindgen..."); shell.status("Executing bindgen...");
let mut b = Bindgen::new(); let mut b = Bindgen::new();