Function extend()
extend<
C>(test:TestAPI<C>,config?:CustomTestConfig):ExtendedTestAPI<C>
Source: test.ts
Extends Vitest's TestAPI with functions from the CustomTestAPI.
Type Parameters
C
C = object
Parameters
test
TestAPI<C>
The Vitest test API.
config?
CustomTestConfig = {}
The configuration options.
Returns
The extended test API.
Example
You can call this function in one file and export the result.
ts
import { test as base } from "vitest";
export const test = extend(base);Then import and use it across your test files.
ts
import { test } from "./index";
test.simpleCases(isEven, [
[0, true],
[1, false],
[2, true],
]);With configuration
ts
import { test as base } from "vitest";
export const test = extend(base, {
format: {
colors: false,
singleQuotes: true,
spaceAfterComma: false,
},
});