MithrilJS / ospec

Noiseless testing framework
MIT License
48 stars 13 forks source link

transition towards local assertions #58

Closed pygy closed 1 year ago

pygy commented 1 year ago

This introduces an opt-in way to have local assertions and spies, that are aware of potential timeouts in async context.

o("some test", o=> {
  o(true).equals(true)
})

To be able to use this, you need to wrap the code in

o.localAssertions(()=>{
  /*specs and tests come here*/
})

... or have o.localAssertions() called before any spec is registered if you want it globally (using the --preload CLI options).

This will become the default API in v6, and the old one will be reachable through o.globalAssertions().

This fixes #50 and #54.