Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tearDown behavior changed between tap@9 and tap@10 #353

Closed
iarna opened this issue Feb 23, 2017 · 1 comment
Closed

tearDown behavior changed between tap@9 and tap@10 #353

iarna opened this issue Feb 23, 2017 · 1 comment

Comments

@iarna
Copy link

iarna commented Feb 23, 2017

Given this code:

var test = require('tap').test

test('step1', function (t) {
  console.log('##############', 'step1 startup')
  t.tearDown(function () {
    console.log('##############', 'step1 teardown')
  })
  setImmediate(t.done)
})
test('step2', function (t) {
  console.log('##############', 'step2 startup')
  t.tearDown(function () {
    console.log('##############', 'step2 teardown')
  })
  setImmediate(t.done)
})

With tap@9 we get:

TAP version 13
# Subtest: step1
############## step1 startup
    1..0
ok 1 - step1 # time=3.156ms

############## step1 teardown
# Subtest: step2
############## step2 startup
    1..0
ok 2 - step2 # time=0.41ms

############## step2 teardown
1..2
# time=28.267ms

Note that step1 teardown runs before step2 startup.

By contrast, under tap@10 we get:

TAP version 13
############## step1 startup
# Subtest: step1
    1..0
ok 1 - step1 # time=6.531ms

############## step2 startup
############## step1 teardown
# Subtest: step2
    1..0
ok 2 - step2 # time=1.262ms

############## step2 teardown
1..2
# time=15.991ms

Note that step2 startup actually runs before step1 teardown now.

Practically, this was causing test failures in npm for test/tap/add-remote-git-submodule.js.

@isaacs
Copy link
Member

isaacs commented Feb 24, 2017

Bona fide bug. Will address soon. Thanks for the report :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants