1. @tapjs/after-each
a built-in tap extension for t.afterEach()
@tapjs/after-each
Package: @tapjs/after-each
Created by: tapjs
Last modified: Tue, 26 Mar 2024 23:27:23 GMT
Version: 1.1.20
License: BlueOak-1.0.0
Downloads: 120,437
Repository: https://github.com/tapjs/tapjs

Install

npm install @tapjs/after-each
yarn add @tapjs/after-each

@tapjs/after-each

A default tap plugin providing t.afterEach().

USAGE

This plugin is installed with tap by default. If you had
previously removed it, you can tap plugin add @tapjs/after-each to
bring it back.

 import t from 'tap'
t.afterEach(t => {
  // this will run after each child test, all of their child
  // tests, and so on
  // the parameter is the child test that just ended.
})

If the method returns a promise, it will be awaited before moving
on to the next test.

The afterEach method is called for all child tests, not just
direct children. "Closer" ancestor afterEach methods are called
before further ancestors.

For example, this test:

 import t from 'tap'
t.afterEach(t => {
  console.error('root after each', t.name)
})

t.test('parent test', t => {
  t.afterEach(t => {
    console.error('parent after each', t.name)
  })
  t.test('child test', t => t.end())
  t.end()
})

will print:

parent after each child test
root after each child test
root after each parent test

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code