Skip to content

Commit

Permalink
Rename test Context in JS
Browse files Browse the repository at this point in the history
This will hopefully help avoid symbol collisions with other projects
that have a struct named `Context`
  • Loading branch information
alexcrichton committed Feb 20, 2019
1 parent de85d99 commit 7fbe021
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion crates/cli/src/bin/wasm-bindgen-test-runner/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub fn execute(
const support = require("./{0}");
const wasm = require("./{0}_bg");
cx = new support.Context();
cx = new support.WasmBindgenTestContext();
handlers.on_console_debug = support.__wbgtest_console_debug;
handlers.on_console_log = support.__wbgtest_console_log;
handlers.on_console_info = support.__wbgtest_console_info;
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/bin/wasm-bindgen-test-runner/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub fn spawn(
let mut js_to_execute = format!(
r#"
import {{
Context,
WasmBindgenTestContext as Context,
__wbgtest_console_debug,
__wbgtest_console_log,
__wbgtest_console_info,
Expand Down
4 changes: 2 additions & 2 deletions crates/test/src/rt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ pub mod node;
///
/// The node.js entry script instantiates a `Context` here which is used to
/// drive test execution.
#[wasm_bindgen]
#[wasm_bindgen(js_name = WasmBindgenTestContext)]
pub struct Context {
state: Rc<State>,
}
Expand Down Expand Up @@ -199,7 +199,7 @@ pub fn log(args: &fmt::Arguments) {
js_console_log(&args.to_string());
}

#[wasm_bindgen]
#[wasm_bindgen(js_class = WasmBindgenTestContext)]
impl Context {
/// Creates a new context ready to run tests.
///
Expand Down

0 comments on commit 7fbe021

Please sign in to comment.