4.0.1 • Published 4 months ago

@tapjs/before v4.0.1

Weekly downloads
-
License
BlueOak-1.0.0
Repository
github
Last release
4 months ago

@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.

4.0.1

4 months ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.7

1 year ago

2.0.6

1 year ago

2.0.8

1 year ago

2.0.1

1 year ago

3.0.3

12 months ago

3.0.2

12 months ago

3.0.1

12 months ago

3.0.0

12 months ago

4.0.0

12 months ago

2.0.0

1 year ago

1.1.22

1 year ago

1.1.21

1 year ago

1.1.20

1 year ago

1.1.19

1 year ago

1.1.18

1 year 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

2 years ago

1.1.10

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.0.0-22

2 years ago

0.0.0-21

2 years ago

0.0.0-20

2 years ago

0.0.0-19

2 years ago

0.0.0-18

2 years ago

0.0.0-17

2 years ago

0.0.0-16

2 years ago

0.0.0-15

2 years ago

0.0.0-14

2 years ago

0.0.0-13

2 years ago

0.0.0-12

2 years ago

0.0.0-11

2 years ago

0.0.0-10

2 years ago

0.0.0-9

2 years ago

0.0.0-8

2 years ago

0.0.0-7

2 years ago

0.0.0-6

2 years ago

0.0.0-5

2 years ago

0.0.0-4

2 years ago

0.0.0-3

2 years ago

0.0.0-2

2 years ago

0.0.0-1

2 years ago

0.0.0-0

2 years ago