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

ci: Enable test with wasm-bindgen-test and wasm-pack #20

Merged
merged 1 commit into from
Jan 7, 2019
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 7 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ rust:
os:
- linux
- osx
- windows
#- windows
addons:
firefox: latest
cache: cargo
before_script:
- rustup target add wasm32-unknown-unknown
- cargo install wasm-bindgen-cli
- cargo install wasm-bindgen-cli --vers 0.2.29 || true
- cargo install wasm-pack --vers 0.5.1 || true
script:
- cargo build --tests --target wasm32-unknown-unknown
- wasm-pack test --headless --firefox
8 changes: 6 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ keywords = ["wasm", "webassembly", "frontend", "framework", "web"]
categories = ["wasm", "web-programming"]
edition = "2018"

#[lib]
[lib]
crate-type = ["cdylib", "rlib"]
#proc-macro = true

[dev-dependencies]
wasm-bindgen-test = "^0.2.29" # NOTE: keep in sync with wasm-bindgen version

[dependencies]
wasm-bindgen = {version = "^0.2.29", features = ["serde-serialize"]}
js-sys = "0.3.6"
Expand Down Expand Up @@ -72,4 +76,4 @@ members = [
exclude = [
# We experience compile-target incompatibility if including in a workspace.
"examples/server_integration"
]
]
11 changes: 8 additions & 3 deletions src/vdom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,12 @@ pub trait DomEl<Tg, At, Sty, Tx, Ls, E>

#[cfg(test)]
pub mod tests {
use super::*;
#![feature(custom_attribute)]
use wasm_bindgen_test::wasm_bindgen_test_configure;
wasm_bindgen_test_configure!(run_in_browser);

use wasm_bindgen_test::*;
use super::*;

use crate as seed; // required for macros to work.
use crate::dom_types::{UpdateEl};
Expand All @@ -533,7 +538,7 @@ pub mod tests {
enum Msg {}


#[test]
#[wasm_bindgen_test]
fn el_added() {
// todo macros not working here.
let old_vdom: El<Msg> = div![ "text", vec![
Expand Down Expand Up @@ -566,4 +571,4 @@ pub mod tests {

assert_eq!(2 + 2, 4);
}
}
}