diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8df1058..d73b519 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,18 +29,6 @@ permissions: jobs: test: - env: - # For some builds, we use cross to test on 32-bit and big-endian - # systems. - CARGO: cargo - # When CARGO is set to CROSS, TARGET is set to `--target matrix.target`. - # Note that we only use cross on Linux, so setting a target on a - # different OS will just use normal cargo. - TARGET: - # Bump this as appropriate. We pin to a version to make sure CI - # continues to work as cross releases in the past have broken things - # in subtle ways. - CROSS_VERSION: v0.2.5 runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -49,22 +37,6 @@ jobs: - build: stable os: ubuntu-latest rust: stable - - build: stable-x86 - os: ubuntu-latest - rust: stable - target: i686-unknown-linux-gnu - - build: stable-aarch64 - os: ubuntu-latest - rust: stable - target: aarch64-unknown-linux-gnu - - build: stable-powerpc64 - os: ubuntu-latest - rust: stable - target: powerpc64-unknown-linux-gnu - - build: stable-s390x - os: ubuntu-latest - rust: stable - target: s390x-unknown-linux-gnu - build: beta os: ubuntu-latest rust: beta @@ -87,38 +59,12 @@ jobs: uses: dtolnay/rust-toolchain@master with: toolchain: ${{ matrix.rust }} - - name: Install and configure Cross - if: matrix.os == 'ubuntu-latest' && matrix.target != '' - run: | - # In the past, new releases of 'cross' have broken CI. So for now, we - # pin it. We also use their pre-compiled binary releases because cross - # has over 100 dependencies and takes a bit to compile. - dir="$RUNNER_TEMP/cross-download" - mkdir "$dir" - echo "$dir" >> $GITHUB_PATH - cd "$dir" - curl -LO "https://github.com/cross-rs/cross/releases/download/$CROSS_VERSION/cross-x86_64-unknown-linux-musl.tar.gz" - tar xf cross-x86_64-unknown-linux-musl.tar.gz - - # We used to install 'cross' from master, but it kept failing. So now - # we build from a known-good version until 'cross' becomes more stable - # or we find an alternative. Notably, between v0.2.1 and current - # master (2022-06-14), the number of Cross's dependencies has doubled. - echo "CARGO=cross" >> $GITHUB_ENV - echo "TARGET=--target ${{ matrix.target }}" >> $GITHUB_ENV - - name: Show command used for Cargo - run: | - echo "cargo command is: ${{ env.CARGO }}" - echo "target flag is: ${{ env.TARGET }}" - - run: ${{ env.CARGO }} build --verbose $TARGET - - run: ${{ env.CARGO }} doc --verbose $TARGET - - if: matrix.build == 'pinned' - run: ${{ env.CARGO }} test - - if: matrix.build != 'pinned' - run: ${{ env.CARGO }} test --all --verbose $TARGET - - if: matrix.build != 'pinned' - run: ${{ env.CARGO }} test -p jiff-cli --verbose $TARGET - - if: matrix.target == '' + - run: cargo build --verbose + - run: cargo doc --verbose + - run: cargo test --verbose --all + - run: cargo test --verbose -p jiff-cli + # Skip on win-gnu because it takes freaking forever. + - if: matrix.build != 'win-gnu' run: ./test # This job runs a stripped down version of CI to test the MSRV. The specific @@ -150,8 +96,44 @@ jobs: - name: Run integration tests run: cargo test --test integration - # Setup and run tests on the wasm32-wasi target via wasmtime. - wasm: + # Generic testing for most cross targets. Some get special treatment in + # other jobs. + cross: + env: + # Bump this as appropriate. We pin to a version to make sure CI + # continues to work as cross releases in the past have broken things + # in subtle ways. + CROSS_VERSION: v0.2.5 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + target: + - i686-unknown-linux-gnu + - aarch64-unknown-linux-gnu + - powerpc-unknown-linux-gnu + - powerpc64-unknown-linux-gnu + - s390x-unknown-linux-gnu + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Install and configure Cross + run: | + # In the past, new releases of 'cross' have broken CI. So for now, we + # pin it. We also use their pre-compiled binary releases because cross + # has over 100 dependencies and takes a bit to compile. + dir="$RUNNER_TEMP/cross-download" + mkdir "$dir" + echo "$dir" >> $GITHUB_PATH + cd "$dir" + curl -LO "https://github.com/cross-rs/cross/releases/download/$CROSS_VERSION/cross-x86_64-unknown-linux-musl.tar.gz" + tar xf cross-x86_64-unknown-linux-musl.tar.gz + - run: cross build --verbose --target ${{ matrix.target }} + - run: cross test -verbose --target ${{ matrix.target }} --all + - run: cross test --verbose --target ${{ matrix.target }} -p jiff-cli + + # Test the wasm32-wasip1 target via wasmtime. + wasm32-wasip1: runs-on: ubuntu-latest env: # The version of wasmtime to download and install. @@ -185,6 +167,56 @@ jobs: - name: Run integration tests run: cargo test --test integration -- --nocapture + # Test the wasm32-unknown-emscripten target. + # + # Regretably, `insta` doesn't work on emscripten, so we just do a basic + # sanity check here. + wasm32-unknown-emscripten: + runs-on: ubuntu-latest + env: + # Bump this as appropriate. We pin to a version to make sure CI + # continues to work as cross releases in the past have broken things + # in subtle ways. + CROSS_VERSION: v0.2.5 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Install Rust + uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + - name: Install and configure Cross + run: | + dir="$RUNNER_TEMP/cross-download" + mkdir "$dir" + echo "$dir" >> $GITHUB_PATH + cd "$dir" + curl -LO "https://github.com/cross-rs/cross/releases/download/$CROSS_VERSION/cross-x86_64-unknown-linux-musl.tar.gz" + tar xf cross-x86_64-unknown-linux-musl.tar.gz + - name: Build jiff + run: cross build --verbose --target wasm32-unknown-emscripten -p jiff + - name: Build jiff-tzdb + run: cargo build --verbose --target wasm32-unknown-emscripten -p jiff-tzdb + - name: Build jiff-tzdb-platform + run: cargo build --verbose --target wasm32-unknown-emscripten -p jiff-tzdb-platform + - name: Run library tests + run: cross test --verbose --target wasm32-unknown-emscripten --features logging --lib now_works -- --nocapture + + # Tests wasm32-unknown-unknown integration via wasm-pack. + wasm32-unknown-uknown: + runs-on: ubuntu-latest + steps: + - uses: dtolnay/rust-toolchain@stable + - uses: actions/checkout@v4 + - name: Install wasm-pack + run: | + curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh + - name: Test wasm-pack project + run: | + cd jiff-wasm + wasm-pack test --node + + # Run benchmarks as tests. testbench: runs-on: ubuntu-latest steps: @@ -198,6 +230,7 @@ jobs: run: | cargo bench --manifest-path bench/Cargo.toml -- --test + # Check that all files are formatted properly. rustfmt: runs-on: ubuntu-latest steps: diff --git a/Cargo.toml b/Cargo.toml index 4758a6d..6c83e79 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -54,6 +54,26 @@ tzdb-bundle-always = ["dep:jiff-tzdb", "alloc"] # database that is typically found at /usr/share/zoneinfo on macOS and Linux. tzdb-zoneinfo = ["std"] +# This enables bindings to web browser APIs for retrieving the current time +# and configured time zone. This ONLY applies on wasm32-unknown-unknown and +# wasm64-unknown-unknown targets. Specifically, *not* on wasm32-wasi or +# wasm32-unknown-emscripten targets. +# +# This is an "ecosystem" compromise due to the fact that there is no general +# way to determine at compile time whether a wasm target is intended for use +# on the "web." In practice, only wasm{32,64}-unknown-unknown targets are used +# on the web, but wasm{32,64}-unknown-unknown targets can be used in non-web +# contexts as well. Thus, the `js` feature should be enabled only by binaries, +# tests or benchmarks when it is *known* that the application will be used in a +# web context. +# +# Libraries that depend on Jiff should not need to define their own `js` +# feature just to forward it to Jiff. Instead, application authors can depend +# on Jiff directly and enable the `js` feature themselves. +# +# (This is the same dependency setup that the `getrandom` crate uses.) +js = ["wasm-bindgen", "js-sys"] + [dependencies] jiff-tzdb = { version = "0.1.0", path = "jiff-tzdb", optional = true } log = { version = "0.4.21", optional = true } @@ -63,7 +83,7 @@ serde = { version = "1.0.203", optional = true } # target gate on this dependency. The intent is that `tzdb-bundle-platform` # is enabled by default, but that the `tzdb-bundle-platform` crate is only # actually used on platforms without a system tzdb (i.e., Windows). -[target.'cfg(windows)'.dependencies] +[target.'cfg(any(windows, target_family = "wasm"))'.dependencies] jiff-tzdb-platform = { version = "0.1.0", path = "jiff-tzdb-platform", optional = true } [target.'cfg(windows)'.dependencies.windows-sys] @@ -72,6 +92,10 @@ default-features = false features = ["Win32_Foundation", "Win32_System_Time"] optional = true +[target.'cfg(all(any(target_arch = "wasm32", target_arch = "wasm64"), target_os = "unknown"))'.dependencies] +js-sys = { version = "0.3.50", optional = true } +wasm-bindgen = { version = "0.2.70", optional = true } + [dev-dependencies] anyhow = "1.0.81" chrono = { version = "0.4.38", features = ["serde"] } @@ -88,9 +112,8 @@ time = { version = "0.3.36", features = ["local-offset", "macros", "parsing"] } tzfile = "0.1.3" walkdir = "2.5.0" -# hifitime doesn't build on wasm32-wasip1 for some reason, so only -# depend on it on Unix or Windows. -[target.'cfg(any(unix, windows))'.dev-dependencies.hifitime] +# hifitime doesn't build on wasm for some reason, so exclude it there. +[target.'cfg(not(target_family = "wasm"))'.dev-dependencies.hifitime] version = "3.9.0" [[test]] diff --git a/Cross.toml b/Cross.toml new file mode 100644 index 0000000..2e063f0 --- /dev/null +++ b/Cross.toml @@ -0,0 +1,6 @@ +[build.env] +passthrough = [ + "TZ", + "RUST_LOG", + "RUST_BACKTRACE", +] diff --git a/PLATFORM.md b/PLATFORM.md new file mode 100644 index 0000000..c6e8a31 --- /dev/null +++ b/PLATFORM.md @@ -0,0 +1,3 @@ +# Platform support + +This document describes Jiff's platform support. diff --git a/jiff-wasm/.gitignore b/jiff-wasm/.gitignore new file mode 100644 index 0000000..6dc3845 --- /dev/null +++ b/jiff-wasm/.gitignore @@ -0,0 +1,3 @@ +/Cargo.lock +/target +/tests diff --git a/jiff-wasm/Cargo.toml b/jiff-wasm/Cargo.toml new file mode 100644 index 0000000..8544ba5 --- /dev/null +++ b/jiff-wasm/Cargo.toml @@ -0,0 +1,26 @@ +[package] +publish = false +name = "jiff-wasm" +version = "0.1.0" +authors = ["Andrew Gallant "] +license = "Unlicense OR MIT" +edition = "2021" + +[workspace] + +[lib] +path = "lib.rs" +crate-type = ["cdylib", "rlib"] + +[dependencies] +jiff = { path = "..", features = ["js"] } +wasm-bindgen = "0.2.84" +wasm-bindgen-test = "0.3.34" +web-sys = { version = "0.3.69", features = ["console"] } + +# The `console_error_panic_hook` crate provides better debugging of panics +# by logging them with `console.error`. +console_error_panic_hook = "0.1.7" + +[profile.release] +opt-level = "s" diff --git a/jiff-wasm/README.md b/jiff-wasm/README.md new file mode 100644 index 0000000..761f0ae --- /dev/null +++ b/jiff-wasm/README.md @@ -0,0 +1,7 @@ +jiff-wasm +========= +This is a small dummy test project for doing a sanity check that getting the +current time and time zone on the `wasm32-unknown-unknown` target with the `js` +Jiff crate feature enabled works as expected. + +This is not a published crate. It is only used in CI testing. diff --git a/jiff-wasm/lib.rs b/jiff-wasm/lib.rs new file mode 100644 index 0000000..b84e3db --- /dev/null +++ b/jiff-wasm/lib.rs @@ -0,0 +1,25 @@ +use wasm_bindgen_test::*; + +macro_rules! eprintln { + ($($tt:tt)*) => {{ + let s = std::format!($($tt)*); + web_sys::console::log_1(&s.into()); + }} +} + +#[wasm_bindgen_test] +fn zoned_now_no_panic() { + let zdt = jiff::Zoned::now(); + eprintln!("{zdt}"); +} + +// Not sure if this is needed? ---AG +pub fn set_panic_hook() { + // When the `console_error_panic_hook` feature is enabled, we can call the + // `set_panic_hook` function at least once during initialization, and then + // we will get better error messages if our code ever panics. + // + // For more details see + // https://github.com/rustwasm/console_error_panic_hook#readme + console_error_panic_hook::set_once(); +} diff --git a/src/lib.rs b/src/lib.rs index 6726d33..e35e241 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -631,6 +631,8 @@ mod logging; pub mod civil; mod error; pub mod fmt; +#[cfg(feature = "std")] +mod now; mod span; mod timestamp; pub mod tz; @@ -643,6 +645,8 @@ pub mod _documentation { pub mod comparison {} #[doc = include_str!("../DESIGN.md")] pub mod design {} + #[doc = include_str!("../PLATFORM.md")] + pub mod platform {} } #[cfg(test)] @@ -673,4 +677,13 @@ mod tests { dbg!((t::SpanMicroseconds::MIN, t::SpanMicroseconds::MAX)); dbg!((t::SpanNanoseconds::MIN, t::SpanNanoseconds::MAX)); } + + #[test] + fn target_info() { + std::println!("{}", cfg!(target_arch = "wasm32")); + std::println!("ARCH: {}", std::env::consts::ARCH); + std::println!("FAMILY: {}", std::env::consts::FAMILY); + std::println!("OS: {}", std::env::consts::OS); + std::println!("{}", Zoned::now()); + } } diff --git a/src/now.rs b/src/now.rs new file mode 100644 index 0000000..68eb21c --- /dev/null +++ b/src/now.rs @@ -0,0 +1,76 @@ +/*! +Provides a centralized helper for getting the current system time. + +We generally rely on the standard library for this, but the standard library +(by design) does not provide this for the `wasm{32,64}-unknown-unknown` +targets. Instead, Jiff provides an opt-in `js` feature that only applies on the +aforementioned target. Specifically, when enabled, it assumes a web context and +runs JavaScript code to get the current time. + +This also exposes a "fallible" API for querying monotonic time. Since we only +use monotonic time for managing expiration for caches, in the case where we +can't get monotonic time (easily), we just consider the cache to always be +expired. ¯\_(ツ)_/¯ +*/ + +pub(crate) use self::sys::*; + +#[cfg(not(all( + feature = "js", + any(target_arch = "wasm32", target_arch = "wasm64"), + target_os = "unknown" +)))] +mod sys { + use std::time::{Instant, SystemTime}; + + pub(crate) fn system_time() -> SystemTime { + SystemTime::now() + } + + pub(crate) fn monotonic_time() -> Option { + Some(Instant::now()) + } +} + +#[cfg(all( + feature = "js", + any(target_arch = "wasm32", target_arch = "wasm64"), + target_os = "unknown" +))] +mod sys { + use std::time::{Instant, SystemTime}; + + pub(crate) fn system_time() -> SystemTime { + use std::time::Duration; + + #[cfg(not(feature = "std"))] + use crate::util::libm::F64; + + let millis = js_sys::Date::new_0().get_time(); + let sign = millis.signum(); + let millis = millis.abs() as u64; + let duration = Duration::from_millis(millis); + let result = if sign >= 0.0 { + SystemTime::UNIX_EPOCH.checked_add(duration) + } else { + SystemTime::UNIX_EPOCH.checked_sub(duration) + }; + // It's a little sad that we have to panic here, but the standard + // SystemTime::now() API is infallible, so we kind of have to match it. + // With that said, a panic here would be highly unusual. It would imply + // that the system time is set to some extreme timestamp very far in the + // future or the past. + let Some(timestamp) = result else { + panic!( + "failed to get current time: \ + subtracting {duration:?} from Unix epoch overflowed" + ) + }; + timestamp + } + + pub(crate) fn monotonic_time() -> Option { + // :-( + None + } +} diff --git a/src/timestamp.rs b/src/timestamp.rs index e2f4e18..3c6412f 100644 --- a/src/timestamp.rs +++ b/src/timestamp.rs @@ -380,6 +380,14 @@ impl Timestamp { /// If you want to get the current Unix time fallibly, use /// [`Timestamp::try_from`] with a `std::time::SystemTime` as input. /// + /// This may also panic when `SystemTime::now()` itself panics. The most + /// common context in which this happens is on the `wasm32-unknown-unknown` + /// target. If you're using that target in the context of the web (for + /// example, via `wasm-pack`), and you're an application, then you should + /// enable Jiff's `js` feature. This will automatically instruct Jiff in + /// this very specific circumstance to execute JavaScript code to determine + /// the current time from the web browser. + /// /// # Example /// /// ``` @@ -389,7 +397,7 @@ impl Timestamp { /// ``` #[cfg(feature = "std")] pub fn now() -> Timestamp { - Timestamp::try_from(std::time::SystemTime::now()) + Timestamp::try_from(crate::now::system_time()) .expect("system time is valid") } diff --git a/src/tz/db/bundled/mod.rs b/src/tz/db/bundled/mod.rs index 0241176..1c8c618 100644 --- a/src/tz/db/bundled/mod.rs +++ b/src/tz/db/bundled/mod.rs @@ -2,13 +2,19 @@ pub(crate) use self::inner::*; #[cfg(not(any( feature = "tzdb-bundle-always", - all(feature = "tzdb-bundle-platform", windows), + all( + feature = "tzdb-bundle-platform", + any(windows, target_family = "wasm"), + ), )))] #[path = "disabled.rs"] mod inner; #[cfg(any( feature = "tzdb-bundle-always", - all(feature = "tzdb-bundle-platform", windows), + all( + feature = "tzdb-bundle-platform", + any(windows, target_family = "wasm"), + ), ))] #[path = "enabled.rs"] mod inner; diff --git a/src/tz/db/mod.rs b/src/tz/db/mod.rs index 7586605..be904cd 100644 --- a/src/tz/db/mod.rs +++ b/src/tz/db/mod.rs @@ -38,7 +38,11 @@ pub fn db() -> &'static TimeZoneDatabase { use std::sync::OnceLock; static DB: OnceLock = OnceLock::new(); - DB.get_or_init(|| TimeZoneDatabase::from_env()) + DB.get_or_init(|| { + let db = TimeZoneDatabase::from_env(); + debug!("initialized global time zone database: {db:?}"); + db + }) } } diff --git a/src/tz/system/mod.rs b/src/tz/system/mod.rs index 28a9f0c..2ea19a3 100644 --- a/src/tz/system/mod.rs +++ b/src/tz/system/mod.rs @@ -13,10 +13,28 @@ use crate::{ #[cfg(unix)] #[path = "unix.rs"] mod sys; + #[cfg(windows)] #[path = "windows/mod.rs"] mod sys; -#[cfg(not(any(unix, windows)))] + +#[cfg(all( + feature = "js", + any(target_arch = "wasm32", target_arch = "wasm64"), + target_os = "unknown" +))] +#[path = "wasm_js.rs"] +mod sys; + +#[cfg(not(any( + unix, + windows, + all( + feature = "js", + any(target_arch = "wasm32", target_arch = "wasm64"), + target_os = "unknown" + ) +)))] mod sys { use crate::tz::{TimeZone, TimeZoneDatabase}; diff --git a/src/tz/system/unix.rs b/src/tz/system/unix.rs index 531284a..8ddb08e 100644 --- a/src/tz/system/unix.rs +++ b/src/tz/system/unix.rs @@ -23,7 +23,16 @@ pub(super) fn get(db: &TimeZoneDatabase) -> Option { "failed to find time zone name using Unix-specific heuristics, \ attempting to read {UNIX_LOCALTIME_PATH} as unnamed time zone", ); - super::read_unnamed_tzif_file(UNIX_LOCALTIME_PATH).ok() + match super::read_unnamed_tzif_file(UNIX_LOCALTIME_PATH) { + Ok(tz) => Some(tz), + Err(_err) => { + trace!( + "failed to read {UNIX_LOCALTIME_PATH} \ + as unnamed time zone: {_err}" + ); + None + } + } } /// Attempt to determine the time zone name from the symlink path given. diff --git a/src/tz/system/wasm_js.rs b/src/tz/system/wasm_js.rs new file mode 100644 index 0000000..a736894 --- /dev/null +++ b/src/tz/system/wasm_js.rs @@ -0,0 +1,47 @@ +use alloc::string::String; + +use crate::tz::{TimeZone, TimeZoneDatabase}; + +pub(super) fn get(db: &TimeZoneDatabase) -> Option { + let fmt = js_sys::Intl::DateTimeFormat::new( + &js_sys::Array::new(), + &js_sys::Object::new(), + ); + let options = fmt.resolved_options(); + // Documented to be an IANA tz ID: + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/resolvedOptions#timezone + let key = wasm_bindgen::JsValue::from("timeZone"); + let val = match js_sys::Reflect::get(&options, &key) { + Ok(val) => val, + Err(_err) => { + trace!( + "failed to get `timeZone` key on \ + Intl.DateTimeFormat options: {_err:?}" + ); + return None; + } + }; + trace!("got `timeZone` value from Intl.DateTimeFormat options: {val:?}"); + let name = match String::try_from(val) { + Ok(string) => string, + Err(_err) => { + trace!( + "failed to convert `timeZone` on \ + Intl.DateTimeFormat to string" + ); + return None; + } + }; + let tz = match db.get(&name) { + Ok(tz) => tz, + Err(_err) => { + trace!( + "got {name:?} as time zone name, \ + but failed to find time zone with that name in \ + zoneinfo database {db:?}", + ); + return None; + } + }; + Some(tz) +} diff --git a/src/util/cache.rs b/src/util/cache.rs index b567904..d20c774 100644 --- a/src/util/cache.rs +++ b/src/util/cache.rs @@ -15,7 +15,9 @@ impl Expiration { /// Returns an expiration time for which `is_expired` returns true after /// the given duration has elapsed from this instant. pub(crate) fn after(ttl: Duration) -> Expiration { - Expiration(MonotonicInstant::now().checked_add(ttl)) + Expiration( + crate::now::monotonic_time().and_then(|now| now.checked_add(ttl)), + ) } /// Returns an expiration time for which `is_expired` always returns true. @@ -25,6 +27,9 @@ impl Expiration { /// Whether expiration has occurred or not. pub(crate) fn is_expired(self) -> bool { - self.0.map_or(true, |t| MonotonicInstant::now() > t) + self.0.map_or(true, |t| { + let Some(now) = crate::now::monotonic_time() else { return true }; + now > t + }) } } diff --git a/src/zoned.rs b/src/zoned.rs index 51026fc..d71a26f 100644 --- a/src/zoned.rs +++ b/src/zoned.rs @@ -391,6 +391,14 @@ impl Zoned { /// If you want to get the current Unix time fallibly, use /// [`Zoned::try_from`] with a `std::time::SystemTime` as input. /// + /// This may also panic when `SystemTime::now()` itself panics. The most + /// common context in which this happens is on the `wasm32-unknown-unknown` + /// target. If you're using that target in the context of the web (for + /// example, via `wasm-pack`), and you're an application, then you should + /// enable Jiff's `js` feature. This will automatically instruct Jiff in + /// this very specific circumstance to execute JavaScript code to determine + /// the current time from the web browser. + /// /// # Example /// /// ``` @@ -401,7 +409,7 @@ impl Zoned { #[cfg(feature = "std")] #[inline] pub fn now() -> Zoned { - Zoned::try_from(std::time::SystemTime::now()) + Zoned::try_from(crate::now::system_time()) .expect("system time is valid") } diff --git a/test-wasm b/test-wasm index 2803343..32d9e3f 100755 --- a/test-wasm +++ b/test-wasm @@ -19,5 +19,5 @@ export CARGO_BUILD_TARGET=wasm32-wasip1 # Not sure exactly why this is needed, but without it, # `insta` tries to run `cargo`, and wasip1 doesn't like that. export INSTA_WORKSPACE_ROOT="$PWD" -export CARGO_TARGET_WASM32_WASIP1_RUNNER="wasmtime run --dir / -S inherit-env" +export CARGO_TARGET_WASM32_WASIP1_RUNNER="wasmtime run -S inherit-env" "$@"