Skip to content

Subtests Recap/Refresh #29

@isaacs

Description

@isaacs

Please do not comment with what you wish subtests would be, but only how they are supported in your actual real-world implementations.

There are three general forms that I see in the discussions of current implementations. (Node-tap interprets all of these, but only generates the "commented" and "buffered" styles.)

Bare Subtest

TAP version 14
1..1
    1..1
    ok 1
ok 1 - subtest name

Commented Subtest

TAP version 14
1..2

# Subtest: subtest name
    1..1
    ok 1
ok 1 - subtest name

# can be unnamed, as well:

# Subtest
    1..1
    ok 1
ok 2

The name doesn't currently have to match, but I've considered adding some strictness around that, like if a name was introduced, then any output at the parent level is considered non-TAP until we get the matching Test Point to end it.

Buffered Subtest

TAP version 14
1..1
ok 1 - subtest name {
    1..1
    ok 1
}

I have some questions about how to attach diags/directives to buffered subtests. Here's what node-tap does:

TAP version 14

ok 1 - todo subtest # TODO {
    1..1
    ok 1 - this is how node-tap generates a buffered directive subtest
}

ok 2 - todo subtest two { # TODO
    1..1
    ok 1 - node-tap supports this, but does not generate it
}

ok 3 - subtest with diags
  ---
  sub: a dub
  ...
{
    1..1
    ok 1
}

ok 4 - subtest with diags and directive # TODO
  ---
  sub: a dub
  ...
{
    1..1
    ok 1
}

1..4

We can make the spec a lot simpler if we pick a direction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions