diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1c9ba3e..14cd99e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,3 +36,13 @@ jobs: run: cargo test --workspace --all-targets --all-features -- --nocapture - name: Run benches run: cargo bench --workspace --all-targets --all-features + + build-wasm: + runs-on: ubuntu-latest + env: + RUST_BACKTRACE: 1 + steps: + - uses: actions/checkout@v2 + - name: Set up toolchains + run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh + - run: wasm-pack test --node diff --git a/Cargo.toml b/Cargo.toml index cdfad14..4e6267b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "minstant" -version = "0.1.4" +version = "0.1.5" authors = ["The TiKV Authors"] edition = "2021" license = "MIT" @@ -25,6 +25,8 @@ atomic = [] criterion = "0.3" quanta = "0.9" rand = "0.8" +wasm-bindgen-test = "0.3" +getrandom = { version = "0.2", features = ["js"] } [[bench]] name = "criterion" diff --git a/README.md b/README.md index cb319cc..e9f3749 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ A drop-in replacement for [`std::time::Instant`](https://doc.rust-lang.org/std/t ```toml [dependencies] -minstant = "0.1.2" +minstant = "0.1" ``` ```rust diff --git a/src/lib.rs b/src/lib.rs index d3151a1..d069405 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -96,13 +96,16 @@ mod tests { use super::*; use rand::Rng; use std::time::{Duration, Instant as StdInstant}; + use wasm_bindgen_test::wasm_bindgen_test; #[test] + #[wasm_bindgen_test] fn test_is_tsc_available() { let _ = is_tsc_available(); } #[test] + #[wasm_bindgen_test] fn test_monotonic() { let mut prev = 0; for _ in 0..10000 { @@ -113,6 +116,7 @@ mod tests { } #[test] + #[wasm_bindgen_test] fn test_nanos_per_cycle() { let _ = nanos_per_cycle(); }