add conditionals so wasm tests build / run in the right places

This commit is contained in:
eV 2019-08-16 17:11:30 +00:00
parent 5d38faeb40
commit c284d7364b
2 changed files with 35 additions and 30 deletions

View File

@ -48,6 +48,7 @@ build_and_test() {
channel build -v --no-default-features --features serde,rustc-serialize
TZ=Asia/Katmandu channel test -v --no-default-features --features serde,rustc-serialize --lib
if [ -n "${TRAVIS}" ]; then
# wasm tests
touch tests/wasm.rs # ensure rebuild happens so TZ / NOW take effect
TZ=ACST-9:30 NOW=$(date +%s) wasm-pack test --node
@ -57,6 +58,7 @@ build_and_test() {
TZ=UTC0 NOW=$(date +%s) wasm-pack test --node
touch tests/wasm.rs
TZ=Asia/Katmandu NOW=$(date +%s) wasm-pack test --node
fi
if [[ "$CHANNEL" == stable ]]; then
if [[ -n "$TRAVIS" ]] ; then

View File

@ -1,8 +1,10 @@
#[cfg(target_arch = "wasm32")]
mod test {
extern crate chrono;
extern crate wasm_bindgen_test;
use chrono::prelude::*;
use wasm_bindgen_test::*;
use self::chrono::prelude::*;
use self::wasm_bindgen_test::*;
use std::env;
@ -25,3 +27,4 @@ fn now() {
};
assert_eq!(&expected_offset, local.offset());
}
}