You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
assert(expression, message) @param { Mixed } expression to test for truthiness @param { String } message to display on error
Write your own test expressions.
assert('foo' !== 'bar', 'foo is not bar');
assert(Array.isArray([]), 'empty arrays are arrays');
however...
describe('assert', () => {
it('swallows the second argument silently', () => {
assert(true,'this string will be swallowed silently and will not be displayed in terminal')
})
})
// assert
// (passes) swallows the second argument silently
and I could not run assert() by itself ie in a describe block outside of it() or some equivalence
The text was updated successfully, but these errors were encountered:
@HumanSprout Custom messages are only displayed if the assertion fails.
const{assert, expect}=require("chai");describe('assert',()=>{it('passing assertion',()=>{assert(true,'this string is never displayed because assertion passes')})it('failing assertion',()=>{assert(false,'this string is displayed because assertion fails')})})
assert
✓ passing assertion
1) failing assertion
1 passing (9ms)
1 failing
assert
failing assertion:
AssertionError: this string is displayed because assertion fails
at Context.it (test/index.js:8:5)
according to the api ref...
assert(expression, message)
@param { Mixed } expression to test for truthiness
@param { String } message to display on error
Write your own test expressions.
assert('foo' !== 'bar', 'foo is not bar');
assert(Array.isArray([]), 'empty arrays are arrays');
however...
describe('assert', () => {
it('swallows the second argument silently', () => {
assert(true,'this string will be swallowed silently and will not be displayed in terminal')
})
})
// assert
// (passes) swallows the second argument silently
and I could not run assert() by itself ie in a describe block outside of it() or some equivalence
The text was updated successfully, but these errors were encountered: