Socket
Socket
Sign inDemoInstall

@tapjs/after-each

Package Overview
Dependencies
121
Maintainers
2
Versions
53
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @tapjs/after-each

a built-in tap extension for t.afterEach()


Version published
Maintainers
2
Created

Readme

Source

@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

Keywords

FAQs

Last updated on 06 May 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc