Skip to content

Commit

Permalink
ci: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
appflowy committed Jan 23, 2024
1 parent 8d446fb commit d4a9d8e
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@ jobs:
working-directory: ./libs/wasm-test
run: |
cargo install wasm-pack
wasm-pack test --headless --firefox
wasm-pack test --headless --firefox --features="wasm_test"
5 changes: 4 additions & 1 deletion libs/client-api-test-util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,7 @@ reqwest = "0.11.23"
gotrue.workspace = true

[target.'cfg(target_arch = "wasm32")'.dependencies]
web-sys = { version = "0.3", features = ["console"] }
web-sys = { version = "0.3", features = ["console"] }

[features]
wasm_test = []
9 changes: 9 additions & 0 deletions libs/client-api-test-util/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::borrow::Cow;
use std::env;
use tracing::warn;

#[cfg(not(feature = "wasm_test"))]
lazy_static! {
pub static ref LOCALHOST_URL: Cow<'static, str> =
get_env_var("LOCALHOST_URL", "http://localhost:8000");
Expand All @@ -14,6 +15,14 @@ lazy_static! {
get_env_var("LOCALHOST_GOTRUE", "http://localhost:9999");
}

// The env vars are not available in wasm32-unknown-unknown
#[cfg(feature = "wasm_test")]
lazy_static! {
pub static ref LOCALHOST_URL: Cow<'static, str> = Cow::Owned("http://localhost");
pub static ref LOCALHOST_WS: Cow<'static, str> = Cow::Owned("ws://localhost/ws");
pub static ref LOCALHOST_GOTRUE: Cow<'static, str> = Cow::Owned("http://localhost/gotrue");
}

fn get_env_var<'default>(key: &str, default: &'default str) -> Cow<'default, str> {
dotenv().ok();
match env::var(key) {
Expand Down
1 change: 0 additions & 1 deletion libs/client-api-test-util/src/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use crate::log::setup_log;
use client_api::Client;
use dotenv::dotenv;
use lazy_static::lazy_static;
use tracing_subscriber::fmt::format;
use uuid::Uuid;

lazy_static! {
Expand Down
2 changes: 1 addition & 1 deletion libs/client-api/src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::notify::{ClientToken, TokenStateReceiver};
use anyhow::Context;
use brotli::CompressorReader;
use gotrue_entity::dto::AuthProvider;
use std::fmt::{Display, Formatter, Write};
use std::fmt::{Display, Formatter};
use std::io::Read;

use app_error::AppError;
Expand Down
3 changes: 3 additions & 0 deletions libs/wasm-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ client-api-test-util = { path = "../client-api-test-util" }
client-api = { path = "../client-api" }
tokio = { version = "1", features = ["sync", "macros"] }
wasm-bindgen-futures = "0.4"

[features]
wasm_test = ["client-api-test-util/wasm_test"]

0 comments on commit d4a9d8e

Please sign in to comment.