Socket
Socket
Sign inDemoInstall

@tapjs/before-each

Package Overview
Dependencies
127
Maintainers
2
Versions
63
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @tapjs/before-each

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


Version published
Maintainers
2
Install size
27.0 kB
Created

Readme

Source

@tapjs/before-each

A default tap plugin providing t.beforeEach().

USAGE

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

import t from 'tap'
t.beforeEach(t => {
  // this will run before each child test, all of their child
  // tests, and so on
  // the parameter is the child test that is about to start.
})

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

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

For example, this test:

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

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

will print:

root before each parent test
root before each child test
parent before each child 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