mirror of
https://github.com/roc-lang/roc.git
synced 2024-11-11 05:34:11 +03:00
repl_wasm: disable console_error_panic_hook for tests
This commit is contained in:
parent
4f7591f963
commit
be72439acc
@ -4,7 +4,7 @@ set -eux
|
||||
# We *could* write a build.rs to do this but we'd have nested cargo processes with different targets.
|
||||
# That can be solved using two separate target direcories with --target-dir but there isn't a huge win.
|
||||
# We need to clear RUSTFLAGS for this command, as CI sets normally some flags that are specific to CPU targets.
|
||||
RUSTFLAGS="" cargo build --target wasm32-unknown-unknown -p roc_repl_wasm --features wasmer --release
|
||||
RUSTFLAGS="" cargo build --target wasm32-unknown-unknown -p roc_repl_wasm --no-default-features --features wasmer --release
|
||||
|
||||
# Build & run the test code on *native* target, not WebAssembly
|
||||
cargo test -p repl_test --features wasm -- --test-threads=1
|
||||
|
@ -11,7 +11,7 @@ roc_builtins = {path = "../compiler/builtins"}
|
||||
|
||||
[dependencies]
|
||||
bumpalo = {version = "3.8.0", features = ["collections"]}
|
||||
console_error_panic_hook = "0.1.7"
|
||||
console_error_panic_hook = {version = "0.1.7", optional = true}
|
||||
futures = {version = "0.3.17", optional = true}
|
||||
js-sys = "0.3.56"
|
||||
wasm-bindgen = "0.2.79"
|
||||
@ -26,6 +26,7 @@ roc_target = {path = "../compiler/roc_target"}
|
||||
roc_types = {path = "../compiler/types"}
|
||||
|
||||
[features]
|
||||
default = ["console_error_panic_hook"]
|
||||
wasmer = ["futures"]
|
||||
|
||||
[package.metadata.wasm-pack.profile.profiling]
|
||||
|
@ -1,10 +1,11 @@
|
||||
extern crate console_error_panic_hook;
|
||||
mod repl;
|
||||
|
||||
//
|
||||
// Interface with external JS in the browser
|
||||
//
|
||||
#[cfg(not(feature = "wasmer"))]
|
||||
extern crate console_error_panic_hook;
|
||||
#[cfg(not(feature = "wasmer"))]
|
||||
mod externs_js;
|
||||
#[cfg(not(feature = "wasmer"))]
|
||||
pub use externs_js::{entrypoint_from_js, js_create_app, js_get_result_and_memory, js_run_app};
|
||||
|
@ -155,6 +155,7 @@ impl<'a> ReplApp<'a> for WasmReplApp<'a> {
|
||||
}
|
||||
|
||||
pub async fn entrypoint_from_js(src: String) -> Result<String, String> {
|
||||
#[cfg(not(feature = "wasmer"))]
|
||||
console_error_panic_hook::set_once();
|
||||
|
||||
let arena = &Bump::new();
|
||||
|
Loading…
Reference in New Issue
Block a user