tape: "test exited without ending"

Hi!

Probabilistically, I get the following:

not ok 95 test exited without ending
  ---
    operator: fail
  ...
not ok 96 test exited without ending
  ---
    operator: fail
  ...

(more of the same)

    operator: fail
  ...
not ok 112 test exited without ending
  ---
    operator: fail
  ...
not ok 113 test exited without ending
  ---
    operator: fail
  ...

1..113
# tests 113
# pass  94
# fail  19

19 out of 20 runs are OK. I am mostly annoyed by the fact I can not localize/attribute the error.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 1
  • Comments: 65 (11 by maintainers)

Commits related to this issue

Most upvoted comments

I just tried to write a lengthy explanation and found you correct and myself incorrect, @simonhac. I was actually defending tap’s behavior, not tape’s behavior. (I stopped using tape a while ago.) tap hangs until the test completes, which I find more reasonable, since you never know if a SIGINT or something is supposed to fire out of the blue to complete the test. It also ensures that tests run sequentially, should each be setting up and tearing down the same database or directory – no test is done, no subsequent test is run, until the plan count is reached or end() is called.

I’m now siding with you, @simonhac. This appears to be another artifact of tape’s attempt to support a test runner that can run multiple test files simultaneously. (The tape command can complete running a test suite before all the tests have run, because the program will exit if all loaded tests have finished, even if all test files have not yet been loaded.)

Nice plug there @jtlapp 😃 I’ll watch subtap also. Thanks.

Ok, so I gave tap a try. When running my tests using tap it reported errors in my tests I had not seen before. After fixing those errors the tests all ran perfectly. I switched back to tape and got the same error as before: ‘test exited without ending’.

For now I am going to switch to using tap.

Thanks @jtlapp for the suggestion.

Keep up the good work here guys. I’ll keep watching it.

@kgryte Could you try with github:kl0tl/tape#fix/globby instead of tape ? It should work if @Raynos is right. I’ll open a PR if this fixes the issue.

This means your test did not call assert.end().

Probably a race condition in your own code.

Close! This did the trick:

    glob.sync(arg).forEach(function(file) {
        require(resolvePath(cwd, file));
    });

So… should that be a PR? I don’t know what else that might affect. Tape’s tests still pass after that change, though.

thanks @jtlapp – i don’t understand why options 2 & 3 are not possible. at least with option 3, couldn’t tape detect that it has already exited and print out an explanation for failing the async’ly scheduled test?

the current behaviour feels obscure for someone not into the implementation details.

@jtlapp tap also doesn’t work in browsers, which is part of why tape was originally created.

This does sound like a bug given the following conditions:

  • use tape binary and the globs
  • All tests are synchronous.

Looks the race condition is here: https://github.com/substack/tape/blob/master/bin/tape#L28-L34

We really should “resolve” all globs in parallel; and then loop over ALL the files once instead of doing multiple loops.

As a temporary workaround @kgryte can do tape "./test/*.js". By wrapping the expression in quotes bash wont expand them to all of the files.

The tests are of the variety:

test( 'awesome test', function ( t ) {
  t.ok( 5 === 5, 'numbers are equal' );
  t.end();
});

In the last file which occasionally fails, I added additional (synchronous) dummy test cases to see what happens. The result is that either all tests pass or all fail due to the test exited without ending error.