Socket
Socket
Sign inDemoInstall

@tapjs/before-each

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/before-each - npm Package Compare versions

Comparing version 0.0.0-15 to 0.0.0-16

6

package.json
{
"name": "@tapjs/before-each",
"version": "0.0.0-15",
"version": "0.0.0-16",
"description": "a built-in tap extension for t.beforeEach()",

@@ -46,3 +46,3 @@ "type": "module",

"peerDependencies": {
"@tapjs/core": "0.0.0-15"
"@tapjs/core": "0.0.0-16"
},

@@ -53,3 +53,3 @@ "dependencies": {

"engines": {
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
"node": ">=16"
},

@@ -56,0 +56,0 @@ "repository": {

# `@tapjs/before-each`
A default tap plugin providing `t.beforeEach()`
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.
```ts
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:
```js
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
```
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