Skip to content

Failure due to plan != count causes all other tests to fail as 'exited without ending' #550

Open
@sh4r1k7

Description

@sh4r1k7

Howdy, this is a peculiar one:

test = require('tape');
test('failed plan', function(t){
  t.plan(1);
});

test('not even called', function(t){
  t.comment('------------ not called');
  t.plan(1);
  t.pass();
  // t.end();
});

Expected the 2nd test to pass but it doesn't even get called. Whether the 2nd test uses t.plan or t.end makes no difference. Additionally, all tests in other files also fail in the same fashion when run as tape test/*.js (the above is the minimal necessary to reproduce the issue).

Output below:

TAP version 13
# failed plan
not ok 1 plan != count
  ---
    operator: fail
    expected: 1
    actual:   0
    at: process.<anonymous> (/home/pechkin/data/kb/node_modules/tape/index.js:85:19)
    stack: |-
      Error: plan != count
          at Test.assert [as _assert] (/home/pechkin/data/kb/node_modules/tape/lib/test.js:310:54)
          at Test.bound [as _assert] (/home/pechkin/data/kb/node_modules/tape/lib/test.js:91:32)
          at Test.fail (/home/pechkin/data/kb/node_modules/tape/lib/test.js:404:10)
          at Test.bound [as fail] (/home/pechkin/data/kb/node_modules/tape/lib/test.js:91:32)
          at Test._exit (/home/pechkin/data/kb/node_modules/tape/lib/test.js:261:14)
          at Test.bound [as _exit] (/home/pechkin/data/kb/node_modules/tape/lib/test.js:91:32)
          at process.<anonymous> (/home/pechkin/data/kb/node_modules/tape/index.js:85:19)
          at process.emit (node:events:376:20)
  ...
not ok 2 test exited without ending: not even called
  ---
    operator: fail
    at: process.<anonymous> (/home/pechkin/data/kb/node_modules/tape/index.js:85:19)
    stack: |-
      Error: test exited without ending: not even called
          at Test.assert [as _assert] (/home/pechkin/data/kb/node_modules/tape/lib/test.js:310:54)
          at Test.bound [as _assert] (/home/pechkin/data/kb/node_modules/tape/lib/test.js:91:32)
          at Test.fail (/home/pechkin/data/kb/node_modules/tape/lib/test.js:404:10)
          at Test.bound [as fail] (/home/pechkin/data/kb/node_modules/tape/lib/test.js:91:32)
          at Test._exit (/home/pechkin/data/kb/node_modules/tape/lib/test.js:267:14)
          at Test.bound [as _exit] (/home/pechkin/data/kb/node_modules/tape/lib/test.js:91:32)
          at process.<anonymous> (/home/pechkin/data/kb/node_modules/tape/index.js:85:19)
          at process.emit (node:events:376:20)
  ...

1..2
# tests 2
# pass  0
# fail  2

The event emitted at the bottom of the stack is exit from the async trampoline.

Reproduced here.
Note that the codepen doesn't capture the same output as when running the same code locally.

Tested against tape v5.1.0 and v5.2.0.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions