wasm_bindgen_test/rt/
node.rsuse alloc::format;
use alloc::string::String;
use wasm_bindgen::prelude::*;
use super::TestResult;
pub struct Node {}
#[wasm_bindgen]
extern "C" {
type NodeError;
#[wasm_bindgen(method, getter, js_class = "Error", structural)]
fn stack(this: &NodeError) -> String;
#[wasm_bindgen(js_name = __wbgtest_og_console_log)]
fn og_console_log(s: &str);
}
impl Node {
pub fn new() -> Node {
Node {}
}
}
impl super::Formatter for Node {
fn writeln(&self, line: &str) {
og_console_log(line);
}
fn log_test(&self, name: &str, result: &TestResult) {
self.writeln(&format!("test {} ... {}", name, result));
}
fn stringify_error(&self, err: &JsValue) -> String {
NodeError::from(err.clone()).stack()
}
}