power-assert
power-assert copied to clipboard
Power Assert in JavaScript. Provides descriptive assertion messages through standard assert interface. No API is the best API.
https://github.com/denoland/deno
I'm trying to move from Jest to Ava, and miss the [`toMatchObject`](https://jestjs.io/docs/en/expect#tomatchobjectobject) assertion. Is there a concise way of expressing that with `power-assert`? (That is, other than asserting `object.`).
Added since Node 10. https://nodejs.org/api/assert.html
So, [Mocha provides diffs](http://mochajs.org/#diffs) on test failures, by examining the thrown `AssertionError`'s `.expected` and `.actual` properties. Unfortunately, these are rather redundant, with `power-assert`'s output: It'd be ideal if, in the...
I want to get details at least the passed expression like `() => shouldThrow()` because I don't know which assertion has failed from assertion messages. ``` AssertionError: Missing expected exception.....
as of Node.js v9+, the built-in [assert.throws()](https://nodejs.org/api/assert.html#assert_assert_throws_block_error_message) accepts an object as the "error" parameter. When passed an object, it checks the properties of the error against the properties on the...
[xtend](https://github.com/Raynos/xtend) can easily be replaced with [Object.assign](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) This reduce the dependencies and possible also avoid duplicated versions where some package don't use the same version range for the xtend package...
**EDIT:** I'm using `[email protected]` for babel 6. It's fine using `node v8.1.4`: ``` assert.ok(three * (seven * ten) === three) | | | | | | | | | |...
In the following case, `o` spread parameter should be expanded in the assertion message. ```js it('Object Rest/Spread', () => { expectPowerAssertMessage (() => { var o = { a: 1,...
Would it be possible to powerAssert the return value? something like ``` const functionWhichShouldReturnNumber = (x) => { assertReturn(Number.isNumber) ... return 'bad return type' } ```