@tapjs/before
a built-in tap extension for t.before()
Last updated 2 years ago by isaacs .
BlueOak-1.0.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @tapjs/before 
SYNC missed versions from official npm registry.

@tapjs/before

A default tap plugin providing t.before().

USAGE

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

import t from 'tap'
t.before(() => {
  // this will run before the tests in this file start
})

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

A t.before() method will run prior to any subsequent child tests. If it's called before any child tests have started, then it will be run right away.

So, this test:

import t from 'tap'

t.before(() => {
  console.error('before initial')
})

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

t.before(() => {
  console.error('before between')
})

t.test('second test', t => {
  console.error('in second test')
  t.end()
})

will print:

before initial
in first test
before in first test
child of first test
before between
in second test

Essentially, t.before() is a bit like a child test method that doesn't get a Test object as an argument.

Current Tags

  • 4.0.1                                ...           latest (a year ago)
  • 1.0.0                                ...           pre (3 years ago)

69 Versions

  • 4.0.1                                ...           a year ago
  • 4.0.0                                ...           2 years ago
  • 3.0.3                                ...           2 years ago
  • 3.0.2                                ...           2 years ago
  • 3.0.1                                ...           2 years ago
  • 3.0.0                                ...           2 years ago
  • 2.0.8                                ...           2 years ago
  • 2.0.7                                ...           2 years ago
  • 2.0.6                                ...           2 years ago
  • 2.0.5                                ...           2 years ago
  • 2.0.4                                ...           2 years ago
  • 2.0.3                                ...           2 years ago
  • 2.0.2                                ...           2 years ago
  • 2.0.1                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
  • 1.1.22                                ...           2 years ago
  • 1.1.21                                ...           2 years ago
  • 1.1.20                                ...           2 years ago
  • 1.1.19                                ...           2 years ago
  • 1.1.18                                ...           2 years ago
  • 1.1.17                                ...           2 years ago
  • 1.1.16                                ...           2 years ago
  • 1.1.15                                ...           2 years ago
  • 1.1.14                                ...           2 years ago
  • 1.1.13                                ...           2 years ago
  • 1.1.12                                ...           2 years ago
  • 1.1.11                                ...           3 years ago
  • 1.1.10                                ...           3 years ago
  • 1.1.9                                ...           3 years ago
  • 1.1.8                                ...           3 years ago
  • 1.1.7                                ...           3 years ago
  • 1.1.6                                ...           3 years ago
  • 1.1.5                                ...           3 years ago
  • 1.1.4                                ...           3 years ago
  • 1.1.3                                ...           3 years ago
  • 1.1.2                                ...           3 years ago
  • 1.1.1                                ...           3 years ago
  • 1.1.0                                ...           3 years ago
  • 1.0.7                                ...           3 years ago
  • 1.0.6                                ...           3 years ago
  • 1.0.5                                ...           3 years ago
  • 1.0.4                                ...           3 years ago
  • 1.0.3                                ...           3 years ago
  • 1.0.2                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
  • 0.0.0-22                                ...           3 years ago
  • 0.0.0-21                                ...           3 years ago
  • 0.0.0-20                                ...           3 years ago
  • 0.0.0-19                                ...           3 years ago
  • 0.0.0-18                                ...           3 years ago
  • 0.0.0-17                                ...           3 years ago
  • 0.0.0-16                                ...           3 years ago
  • 0.0.0-15                                ...           3 years ago
  • 0.0.0-14                                ...           3 years ago
  • 0.0.0-13                                ...           3 years ago
  • 0.0.0-12                                ...           3 years ago
  • 0.0.0-11                                ...           3 years ago
  • 0.0.0-10                                ...           3 years ago
  • 0.0.0-9                                ...           3 years ago
  • 0.0.0-8                                ...           3 years ago
  • 0.0.0-7                                ...           3 years ago
  • 0.0.0-6                                ...           3 years ago
  • 0.0.0-5                                ...           3 years ago
  • 0.0.0-4                                ...           3 years ago
  • 0.0.0-3                                ...           3 years ago
  • 0.0.0-2                                ...           3 years ago
  • 0.0.0-1                                ...           3 years ago
  • 0.0.0-0                                ...           3 years ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 2
Last Month 2
Dependencies (1)
Dev Dependencies (0)
None
Dependents (3)

Copyright 2013 - present © cnpmjs.org | Home |