@tapjs/asserts
Advanced tools
Comparing version 0.0.0-15 to 0.0.0-16
@@ -275,2 +275,23 @@ /// <reference types="node" resolution-mode="require"/> | ||
emits(emitter: EventEmitter | EventTarget, event: string, ...[msg, extra]: MessageExtra): Promise<void>; | ||
/** | ||
* Assert that an error object is not provided. | ||
* | ||
* Like with {@link @tapjs/asserts!index.Assertions#doesNotThrow}, you | ||
* can also usually just throw the error, and tap will handle that | ||
* reasonably. | ||
* | ||
* This is useful in cases where you just want to assert that a callback did | ||
* not receive an error, without necessarily aborting the callback function | ||
* entirely. Both the origin of the error and the location of the failed | ||
* assertion will be printed in the test results. | ||
* | ||
* It is also used internally in | ||
* {@link @tapjs/asserts!index.Assertions#resolves}, | ||
* {@link @tapjs/asserts!index.Assertions#doesNotThrow}, | ||
* and {@link @tapjs/asserts!index.Assertions#resolveMatch} to show both | ||
* the source of a raised error as well as the callsite where the assertion | ||
* failed. | ||
* | ||
* @group Assertion Methods | ||
*/ | ||
error(er: unknown, ...[msg, extra]: MessageExtra): boolean; | ||
@@ -277,0 +298,0 @@ } |
@@ -841,2 +841,23 @@ "use strict"; | ||
} | ||
/** | ||
* Assert that an error object is not provided. | ||
* | ||
* Like with {@link @tapjs/asserts!index.Assertions#doesNotThrow}, you | ||
* can also usually just throw the error, and tap will handle that | ||
* reasonably. | ||
* | ||
* This is useful in cases where you just want to assert that a callback did | ||
* not receive an error, without necessarily aborting the callback function | ||
* entirely. Both the origin of the error and the location of the failed | ||
* assertion will be printed in the test results. | ||
* | ||
* It is also used internally in | ||
* {@link @tapjs/asserts!index.Assertions#resolves}, | ||
* {@link @tapjs/asserts!index.Assertions#doesNotThrow}, | ||
* and {@link @tapjs/asserts!index.Assertions#resolveMatch} to show both | ||
* the source of a raised error as well as the callsite where the assertion | ||
* failed. | ||
* | ||
* @group Assertion Methods | ||
*/ | ||
error(er, ...[msg, extra]) { | ||
@@ -843,0 +864,0 @@ const args = [msg, extra]; |
@@ -275,2 +275,23 @@ /// <reference types="node" resolution-mode="require"/> | ||
emits(emitter: EventEmitter | EventTarget, event: string, ...[msg, extra]: MessageExtra): Promise<void>; | ||
/** | ||
* Assert that an error object is not provided. | ||
* | ||
* Like with {@link @tapjs/asserts!index.Assertions#doesNotThrow}, you | ||
* can also usually just throw the error, and tap will handle that | ||
* reasonably. | ||
* | ||
* This is useful in cases where you just want to assert that a callback did | ||
* not receive an error, without necessarily aborting the callback function | ||
* entirely. Both the origin of the error and the location of the failed | ||
* assertion will be printed in the test results. | ||
* | ||
* It is also used internally in | ||
* {@link @tapjs/asserts!index.Assertions#resolves}, | ||
* {@link @tapjs/asserts!index.Assertions#doesNotThrow}, | ||
* and {@link @tapjs/asserts!index.Assertions#resolveMatch} to show both | ||
* the source of a raised error as well as the callsite where the assertion | ||
* failed. | ||
* | ||
* @group Assertion Methods | ||
*/ | ||
error(er: unknown, ...[msg, extra]: MessageExtra): boolean; | ||
@@ -277,0 +298,0 @@ } |
@@ -812,2 +812,23 @@ import { extraFromError, normalizeMessageExtra, } from '@tapjs/core'; | ||
} | ||
/** | ||
* Assert that an error object is not provided. | ||
* | ||
* Like with {@link @tapjs/asserts!index.Assertions#doesNotThrow}, you | ||
* can also usually just throw the error, and tap will handle that | ||
* reasonably. | ||
* | ||
* This is useful in cases where you just want to assert that a callback did | ||
* not receive an error, without necessarily aborting the callback function | ||
* entirely. Both the origin of the error and the location of the failed | ||
* assertion will be printed in the test results. | ||
* | ||
* It is also used internally in | ||
* {@link @tapjs/asserts!index.Assertions#resolves}, | ||
* {@link @tapjs/asserts!index.Assertions#doesNotThrow}, | ||
* and {@link @tapjs/asserts!index.Assertions#resolveMatch} to show both | ||
* the source of a raised error as well as the callsite where the assertion | ||
* failed. | ||
* | ||
* @group Assertion Methods | ||
*/ | ||
error(er, ...[msg, extra]) { | ||
@@ -814,0 +835,0 @@ const args = [msg, extra]; |
{ | ||
"name": "@tapjs/asserts", | ||
"version": "0.0.0-15", | ||
"version": "0.0.0-16", | ||
"description": "", | ||
@@ -40,11 +40,11 @@ "author": "Isaac Z. Schlueter <i@izs.me> (https://blog.izs.me)", | ||
"peerDependencies": { | ||
"@tapjs/core": "0.0.0-15" | ||
"@tapjs/core": "0.0.0-16" | ||
}, | ||
"dependencies": { | ||
"is-actual-promise": "^1.0.0", | ||
"tcompare": "6.0.1-3", | ||
"tcompare": "6.0.1-4", | ||
"trivial-deferred": "^2.0.0" | ||
}, | ||
"engines": { | ||
"node": ">=14" | ||
"node": ">=16" | ||
}, | ||
@@ -51,0 +51,0 @@ "funding": { |
# `@tapjs/asserts` | ||
Tap plugin that adds a heaping pile of assertion methods. | ||
Tap plugin that adds a heaping pile of assertion methods. Pretty | ||
much all of the "test" methods other than `t.pass`, `t.fail`, and | ||
[snapshot | ||
methods](https://tapjs.github.io/tapjs/modules/_tapjs_snapshot.html) | ||
come from this plugin. | ||
## USAGE | ||
This plugin is installed with tap by default. If you had | ||
previously removed it, you can `tap plugin add @tapjs/asserts` to | ||
bring it back. | ||
### `compareOptions` | ||
This plugin adds the `compareOptions` option to the set of fields | ||
that can be passed to child tests. You can also set | ||
`t.compareOptions` after the fact. | ||
`compareOptions` lets you pass options to | ||
[tcompare](https://tapjs.github.io/tapjs/modules/tcompare.html) | ||
to specify the formatting style, diff context lines, and so on. | ||
It can contain the following fields: | ||
* `sort` - boolean, sort items alphabetically by key. | ||
* `bufferChunkSize` - number of bytes to show on each line when | ||
printing buffers, default `32` | ||
* `includeEnumerable` - boolean, include any and all enumerable | ||
properties, including those inherited on the prototype chain. | ||
By default, only `own` properties are shown. | ||
* `includeGetters` - boolean, include getter properties. | ||
* `diffContext` - how many lines of context to print around | ||
changes in diffs, default `10`. Note that the test reporter | ||
might use more or less than this value when displaying pretty | ||
colored diffs. | ||
### Assertion Methods | ||
All of the assertion methods are documented [on the `Assertions` | ||
class](https://tapjs.github.io/tapjs/classes/_tapjs_asserts.index.Assertions.html). | ||
When this plugin is loaded, these are all present on `Test` | ||
objects. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
235453
2399
45
+ Added@tapjs/core@0.0.0-16(transitive)
+ Added@tapjs/stack@0.0.0-5(transitive)
+ Added@tapjs/test@0.0.0-16(transitive)
+ Addedtcompare@6.0.1-4(transitive)
- Removed@tapjs/core@0.0.0-15(transitive)
- Removed@tapjs/stack@0.0.0-4(transitive)
- Removed@tapjs/test@0.0.0-15(transitive)
- Removedtcompare@6.0.1-3(transitive)
Updatedtcompare@6.0.1-4