Skip to content

Loading…

Subtests don't Run #14

Closed
ashb opened this Issue · 3 comments

4 participants

@ashb

Best illustrated by an example:

var test = require("tap").test;
test("parent", function (t) {
  t.plan(1)
  t.test("subtest", function (t) {
    t.ok()
    t.end()
  })
  t.end()
})

The output of running this via node foo.t.js is:

# parent

1..0
# tests 0

# ok

(This is basically a cut down version of the example from the README.md)

@jdeal

same here, from an npm install today

@stevemolitor

I get a different error:

tap ta.test.js
not ok ta.test.js ................... 0/1
   Command: "node" "ta.test.js"
   not ok 1 test count != plan

But it's the same basic problem: it's not running the subtest, so the actual assertion count count doesn't equal the plan.

I can get it to work by removing the plan line:

var test = require("tap").test;
test("parent", function (t) {
  t.test("subtest", function (t) {
    t.ok(1)
    t.end()
  })
  t.end()
})
tap ta.test.js
ok ta.test.js ....................... 1/1
total ............................... 2/2

ok

It seems like t.plan() doesn't always work right with subtests.

@isaacs
TAP in JavaScript member

Yes, there are gremlins there. Nested tests are wonky;.

@isaacs isaacs closed this in 78c6594
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.