Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tapjs/after

Package Overview
Dependencies
Maintainers
2
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tapjs/after

a built-in tap extension for t.after() and t.teardown()

  • 0.0.0-16
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
149K
decreased by-15.11%
Maintainers
2
Weekly downloads
 
Created
Source

@tapjs/after

A default tap plugin providing t.after() and t.teardown().

USAGE

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

import t from 'tap'
t.after(() => {
  // this will run after all the tests in this file are done
})

The method can be called as either t.teardown() or t.after(). In an earlier version of tap, these had slightly different behaviors, but they are now the same.

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

So, this test:

import t from 'tap'

t.test('first test', t => {
  t.teardown(async () => {
    // this will wait before moving on
    await new Promise(res => setTimeout(res, 100))
    console.error('end of first test teardown')
  })
  console.error('in first test')
  t.end()
})
t.test('second test', t => {
  console.error('in second test')
  t.end()
})

will print:

in first test
end of first test teardown
in second test

Keywords

FAQs

Package last updated on 27 Aug 2023

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc