Start migrating wasm_bindgen tests to wasm_bindgen_test (#602)

This commit starts migrating the `wasm_bindgen` tests to the `wasm_bindgen_test`
framework, starting to assemble the coffin for
`wasm-bindgen-test-project-builder`. Over time all of the tests in
`tests/all/*.rs` should be migrated to `wasm_bindgen_test`, although they may
not all want to go into a monolithic test suite so we can continue to test for
some more subtle situations with `#[wasm_bindgen]`.

In the meantime those, the `tests/all/api.rs` tests can certainly migrate!
This commit is contained in:
Alex Crichton
2018-08-01 14:19:19 -05:00
committed by GitHub
parent bbfdcc833f
commit 4181afea45
9 changed files with 196 additions and 238 deletions

View File

@ -80,9 +80,7 @@ fn rmain() -> Result<(), Error> {
fs::create_dir(&tmpdir)
.context("creating temporary directory")?;
let module = wasm_file_to_test.file_stem()
.and_then(|s| s.to_str())
.ok_or_else(|| format_err!("invalid filename passed in"))?;
let module = "wasm-bindgen-test";
// Collect all tests that the test harness is supposed to run. We assume
// that any exported function with the prefix `__wbg_test` is a test we need

View File

@ -76,6 +76,7 @@ pub fn execute(module: &str, tmpdir: &Path, args: &[OsString], tests: &[String])
let path = env::var("NODE_PATH").unwrap_or_default();
let mut path = env::split_paths(&path).collect::<Vec<_>>();
path.push(env::current_dir().unwrap());
path.push(tmpdir.to_path_buf());
exec(
Command::new("node")
.env("NODE_PATH", env::join_paths(&path).unwrap())