Skip to content

Instantly share code, notes, and snippets.

@patoi
Created April 3, 2018 09:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patoi/81255d2a14413e31fbdde772f9220ee1 to your computer and use it in GitHub Desktop.
Save patoi/81255d2a14413e31fbdde772f9220ee1 to your computer and use it in GitHub Desktop.
it('your test', async function() {
let args = ... // your test data
let result, error // variables: test and guard in the finally block
try {
result = await testFunction(args)
} catch (err) {
error = err
} finally {
expect(error).to.be.undefined() // guard: error (or result)
expect(result).to.be... // test: result (or error)
// ... more test
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment