Describes a group of related tests.
Symbol
Describe
interface Describe
function sum(a, b) {
return a + b;
}
describe("sum()", () => {
test("can sum two values", () => {
expect(sum(1, 1)).toBe(2);
});
});
- each<T extends readonly [any, any]>(table: readonly T[]): (label: string, fn: (...args: [...T[]]) => void | Promise<unknown>, options?: number | TestOptions) => void
Returns a function that runs for each item in
table
.@param tableArray of Arrays with the arguments that are passed into the test fn for each row.
each<T extends any[]>(table: readonly T[]): (label: string, fn: (...args: Readonly<T>) => void | Promise<unknown>, options?: number | TestOptions) => voideach<T>(table: T[]): (label: string, fn: (...args: T[]) => void | Promise<unknown>, options?: number | TestOptions) => void Runs this group of tests, only if
condition
is true.This is the opposite of
describe.skipIf()
.@param conditionif these tests should run
Skips all other tests, except this group of tests.
@param labelthe label for the tests
@param fnthe function that defines the tests
Skips this group of tests.
@param labelthe label for the tests
@param fnthe function that defines the tests
Skips this group of tests, if
condition
is true.@param conditionif these tests should be skipped
Marks this group of tests as to be written or to be fixed.
@param labelthe label for the tests
@param fnthe function that defines the tests
Marks this group of tests as to be written or to be fixed, if
condition
is true.@param conditionif these tests should be skipped