Skip to content

Migrate wasm_bindgen crate's tests to wasm_bindgen_test #603

@alexcrichton

Description

@alexcrichton

The test framework is shaping up quite nicely now, so we should purge the last and final use of wasm-bindgen-test-project-builder! The steps for this will be to:

  • First, wait for Start migrating wasm_bindgen tests to wasm_bindgen_test #602 to merge
  • Next, select a test module (for example tests/all/foo.rs) to migrate. Comment here so make sure work isn't duplicated!
  • Move the file to tests/wasm/foo.rs
  • Add pub mod foo; to tests/wasm/main.rs
  • Copy all JS into tests/wasm/foo.js
  • Migrate #[test] to #[wasm_bindgen_test]
  • Copy all Rust directly into #[wasm_bindgen_test] functions, or leave them as separate exported functions
  • Run cargo test --target wasm32-unknown-unknown until tests pass!

All tests currently live in their own namespace so there's a lot of name conflicts (lots of class Foo classes in JS). When copying out JS and Rust exports they may need to be renamed appropriately to avoid conflicting with other names throughout the test suite.

An example of how tests/all/api.rs was moved can be found at #602

Tests to migrate:

  • api.rs
  • char.rs
  • classes.rs
  • closures.rs
  • comments.rs
  • dependencies.rs
  • duplicates.rs
  • enums.rs
  • import_class.rs
  • imports.rs
  • jsobjects.rs
  • math.rs
  • node.rs
  • non_debug.rs
  • non_wasm.rs
  • simple.rs
  • slice.rs
  • structural.rs
  • typescript.rs
  • u64.rs
  • validate_prt.rs

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedWe could use some help fixing this issue!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions