pub struct Context { /* private fields */ }
Expand description
Runtime test harness support instantiated in JS.
The node.js entry script instantiates a Context
here which is used to
drive test execution.
Implementations§
source§impl Context
impl Context
sourcepub fn new() -> Context
pub fn new() -> Context
Creates a new context ready to run tests.
A Context
is the main structure through which test execution is
coordinated, and this will collect output and results for all executed
tests.
sourcepub fn args(&mut self, args: Vec<JsValue>)
pub fn args(&mut self, args: Vec<JsValue>)
Inform this context about runtime arguments passed to the test harness.
sourcepub fn run(&self, tests: Vec<JsValue>) -> Promise
pub fn run(&self, tests: Vec<JsValue>) -> Promise
Executes a list of tests, returning a promise representing their eventual completion.
This is the main entry point for executing tests. All the tests passed
in are the JS Function
object that was plucked off the
WebAssembly.Instance
exports list.
The promise returned resolves to either true
if all tests passed or
false
if at least one test failed.
source§impl Context
impl Context
sourcepub fn execute_sync<T: Termination>(
&self,
name: &str,
f: impl 'static + FnOnce() -> T,
should_panic: Option<Option<&'static str>>,
ignore: Option<Option<&'static str>>,
)
pub fn execute_sync<T: Termination>( &self, name: &str, f: impl 'static + FnOnce() -> T, should_panic: Option<Option<&'static str>>, ignore: Option<Option<&'static str>>, )
Entry point for a synchronous test in wasm. The #[wasm_bindgen_test]
macro generates invocations of this method.
Trait Implementations§
source§impl FromWasmAbi for Context
impl FromWasmAbi for Context
source§impl IntoWasmAbi for Context
impl IntoWasmAbi for Context
source§impl LongRefFromWasmAbi for Context
impl LongRefFromWasmAbi for Context
source§impl OptionFromWasmAbi for Context
impl OptionFromWasmAbi for Context
source§impl OptionIntoWasmAbi for Context
impl OptionIntoWasmAbi for Context
source§impl RefFromWasmAbi for Context
impl RefFromWasmAbi for Context
source§impl RefMutFromWasmAbi for Context
impl RefMutFromWasmAbi for Context
source§impl TryFromJsValue for Context
impl TryFromJsValue for Context
source§impl VectorFromWasmAbi for Context
impl VectorFromWasmAbi for Context
source§impl VectorIntoWasmAbi for Context
impl VectorIntoWasmAbi for Context
Auto Trait Implementations§
impl Freeze for Context
impl !RefUnwindSafe for Context
impl !Send for Context
impl !Sync for Context
impl Unpin for Context
impl !UnwindSafe for Context
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::Abi
source§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi
, except that it may throw and never
return in the case of Err
.