diff --git a/.gitignore b/.gitignore index 84de0b9..5927951 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,5 @@ Cargo.lock # Pycharm /.idea -pkg/* +/pkg wasm-pack.log \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index a2c0d06..e3c4e1b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,9 +10,10 @@ crate-type = ["cdylib"] [dependencies] -seed = "^0.3.2" +seed = "^0.3.3" wasm-bindgen = "^0.2.42" web-sys = "^0.3.19" # For serialization, eg sending requests to a server. Otherwise, not required. serde = { version = "^1.0.85", features = ['derive'] } +futures = "^0.1.26" diff --git a/Makefile.toml b/Makefile.toml index 4718478..3799dc5 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -16,7 +16,6 @@ workspace = false command = "cargo" args = ["build", "--release"] - [tasks.create_wasms] description = "Build with wasm-pack" workspace = false @@ -40,6 +39,32 @@ workspace = false command = "microserver" args = ["--port", "${PORT}"] +# ---- TEST ---- + +[tasks.test] +description = "Run tests. Ex: 'cargo make test firefox'. Test envs: [chrome, firefox, safari]" +clear = true +workspace = false +install_crate = { crate_name = "wasm-pack", binary = "wasm-pack", test_arg = "-V" } +command = "wasm-pack" +args = ["test", "--${@}"] + +[tasks.test_release] +extend = "test" +description = "Run tests in release mode. Ex: 'cargo make test firefox'. Test envs: [chrome, firefox, safari]" +args = ["test", "--${@}", "--release"] + +[tasks.test_h] +description = "Run headless tests. Ex: 'cargo make test_h firefox'. Test envs: [chrome, firefox, safari]" +extend = "test" +args = ["test", "--headless", "--${@}"] + +[tasks.test_h_release] +extend = "test_h" +description = "Run headless tests in release mode. Ex: 'cargo make test_h firefox'. Test envs: [chrome, firefox, safari]" +args = ["test", "--headless", "--${@}", "--release"] + + # ---- PRIVATE TASKS - run only inside another task ---- # private atribute is ignored (bug?) diff --git a/README.md b/README.md index c4b0f41..dccbfff 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ `rustup target add wasm32-unknown-unknown` -`cargo install cargo-make` +`cargo install --force cargo-make` Run `cargo make all` in a terminal to build the app, and `cargo make serve` to start a dev server on `127.0.0.0:8000`.