Skip to content

Commit a7605de

Browse files
committed
Add t.assert() to type definitions
1 parent 20db474 commit a7605de

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

index.d.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ export type SnapshotOptions = {
2929
};
3030

3131
export interface Assertions {
32+
/** Assert that `actual` is [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy). Comes with power-assert. */
33+
assert: AssertAssertion;
34+
3235
/** Assert that `actual` is [deeply equal](https://github.com/concordancejs/concordance#comparison-details) to `expected`. */
3336
deepEqual: DeepEqualAssertion;
3437

@@ -96,6 +99,14 @@ export interface Assertions {
9699
truthy: TruthyAssertion;
97100
}
98101

102+
export interface AssertAssertion {
103+
/** Assert that `actual` is [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy). Comes with power-assert. */
104+
(actual: any, message?: string): void;
105+
106+
/** Skip this assertion. */
107+
skip(actual: any, message?: string): void;
108+
}
109+
99110
export interface DeepEqualAssertion {
100111
/** Assert that `actual` is [deeply equal](https://github.com/concordancejs/concordance#comparison-details) to `expected`. */
101112
<ValueType = any>(actual: ValueType, expected: ValueType, message?: string): void;

index.js.flow

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ export type SnapshotOptions = {
4242
};
4343

4444
export interface Assertions {
45+
/** Assert that `actual` is [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy). Comes with power-assert. */
46+
assert: AssertAssertion;
47+
4548
/** Assert that `actual` is [deeply equal](https://github.com/concordancejs/concordance#comparison-details) to `expected`. */
4649
deepEqual: DeepEqualAssertion;
4750

@@ -109,6 +112,14 @@ export interface Assertions {
109112
truthy: TruthyAssertion;
110113
}
111114

115+
export interface AssertAssertion {
116+
/** Assert that `actual` is [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy). Comes with power-assert. */
117+
(actual: any, message?: string): void;
118+
119+
/** Skip this assertion. */
120+
skip(actual: any, message?: string): void;
121+
}
122+
112123
export interface DeepEqualAssertion {
113124
/** Assert that `actual` is [deeply equal](https://github.com/concordancejs/concordance#comparison-details) to `expected`. */
114125
(actual: any, expected: any, message?: string): void;

0 commit comments

Comments
 (0)