function afterEach | Node.js node:test module | Bun
BuildDocsReferenceGuidesBlogDiscord/
node:test/
default/
afterEachFafterEach
Search the reference...
/
BuildDocsReferenceGuidesBlogDiscord/
node:test/
default/
afterEachFafterEach
function
test.default.afterEach {
afterEach(() => console.log('finished running a test'));
it('is a subtest', () => {
// Some relevant assertion here
});
});
```" data-algolia-static="false" data-algolia-merged="false" data-type="Function">function
afterEach(fn?:
HookFn,options?:
HookOptions): void;
This function creates a hook that runs after each test in the current suite. The afterEach() hook is run even if the test fails.
describe('tests', async () => {
afterEach(() => console.log('finished running a test'));
it('is a subtest', () => {
// Some relevant assertion here
});
});
@param fn
The hook function. If the hook uses callbacks, the callback function is passed as the second argument.
@param options
Configuration options for the hook.
Resources
ReferenceDocsGuidesDiscordMerch StoreGitHubBlog Toolkit
RuntimePackage managerTest runnerBundlerPackage runnerProject
Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicenseBaked with ❤️ in San Francisco
We're hiring →