Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including assert-x with all npm packages installed. Try it out:

var assertX = require("assert-x")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

assert-x v3.2.2

A Javascript assertion library.

Travis status Dependency status devDependency status npm version jsDelivr hits bettercodehub score Coverage Status

assert-x

A Javascript assertion library.

See: https://nodejs.org/dist/latest-v12.x/docs/api/assert.html

This is legacy mode by default.

See:https://nodejs.org/dist/latest-v12.x/docs/api/assert.html#assert_legacy_mode

Strict mode is available.

See: https://nodejs.org/dist/latest-v12.x/docs/api/assert.html#assert_strict_mode

assert-x~AssertionError ⇐ Error

Kind: inner class of assert-x
Extends: Error

new AssertionError([message])

Error constructor for test and validation frameworks that implement the standardized AssertionError specification.

ParamTypeDescription
[message]ObjectNeed to document the properties.

assert-x~deepEqual

Tests for deep equality, coercive equality with the equal comparison operator ( == ) and equivalent.

Kind: inner property of assert-x

ParamTypeDescription
actual*The actual value to be tested.
expected*The expected value to compare against actual.
[message]stringText description of test.

assert-x~deepStrictEqual

Tests for deep equality, coercive equality with the equal comparison operator ( === ) and equivalent.

Kind: inner property of assert-x

ParamTypeDescription
actual*The actual value to be tested.
expected*The expected value to compare against actual.
[message]stringText description of test.

assert-x~doesNotThrow

Expects block not to throw an error, see assert~throws for details.

Kind: inner property of assert-x

ParamTypeDescription
blockfunctionThe function block to be executed in testing.
[error]constructorThe comparator.
[message]stringText description of test.

assert-x~equal

Tests shallow, coercive equality with the equal comparison operator ( == ).

Kind: inner property of assert-x

ParamTypeDescription
actual*The actual value to be tested.
expected*The expected value to compare against actual.
[message]stringText description of test.

assert-x~fail

Throws an exception that displays the values for actual and expected separated by the provided operator.

Kind: inner property of assert-x
Throws:

  • Error Throws an AssertionError.
ParamTypeDescription
actual*The actual value to be tested.
expected*The expected value to compare against actual.
[message]stringText description of test.
operatorstringThe compare operator.

assert-x~ifError

Tests if value is not a falsy value, throws if it is a truthy value. Useful when testing the first argument, error in callbacks.

Kind: inner property of assert-x
Throws:

  • * The value err if truthy.
ParamTypeDescription
err*The value to be tested for truthiness.

assert-x~notDeepEqual

Tests for any deep inequality. Opposite of deepEqual.

Kind: inner property of assert-x

ParamTypeDescription
actual*The actual value to be tested.
expected*The expected value to compare against actual.
[message]stringText description of test.

assert-x~notDeepStrictEqual

Tests for deep inequality. Opposite of deepStrictEqual.

Kind: inner property of assert-x

ParamTypeDescription
actual*The actual value to be tested.
expected*The expected value to compare against actual.
[message]stringText description of test.

assert-x~notEqual

Tests shallow, coercive non-equality with the not equal comparison operator ( != ).

Kind: inner property of assert-x

ParamTypeDescription
actual*The actual value to be tested.
expected*The expected value to compare against actual.
[message]stringText description of test.

assert-x~notStrictEqual

Tests strict non-equality, as determined by the strict not equal operator ( !== ).

Kind: inner property of assert-x

ParamTypeDescription
actual*The actual value to be tested.
expected*The expected value to compare against actual.
[message]stringText description of test.

assert-x~ok

Tests if value is truthy, it is equivalent to equal(!!value, true, message).

Kind: inner property of assert-x

ParamTypeDescription
value*The value to be tested.
[message]stringText description of test.

assert-x~strictEqual

Tests strict equality, as determined by the strict equality operator ( === ).

Kind: inner property of assert-x

ParamTypeDescription
actual*The actual value to be tested.
expected*The expected value to compare against actual.
[message]stringText description of test.

assert-x~throws

Expects block to throw an error. error can be constructor, regexp or validation function.

Kind: inner property of assert-x

ParamTypeDescription
blockfunctionThe function block to be executed in testing.
[error]constructor | RegExp | functionThe comparator.
[message]stringText description of test.

assert-x~$assert(value, message)

Tests if value is truthy, it is equivalent to equal(!!value, true, message).

Kind: inner method of assert-x

ParamTypeDescription
value*The value to be tested.
messagestringText description of test.
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free