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

Hangs when grep results in no tests #3

Closed
Mr0grog opened this issue Oct 11, 2017 · 4 comments
Closed

Hangs when grep results in no tests #3

Mr0grog opened this issue Oct 11, 2017 · 4 comments

Comments

@Mr0grog
Copy link

Mr0grog commented Oct 11, 2017

If the grep query argument causes no tests to be run, the test runner’s end event is fired synchronously and can’t be caught as line 69 of runner.js. The tests output “0 passing”, but then they just hang instead of closing.

For example, if I have the following in browsertest.html:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>In-Browser Mocha Tests</title>
        <link rel="stylesheet" href="../node_modules/mocha/mocha.css">
    </head>
    <body>
        <div id="mocha"></div>
        <script src="../node_modules/mocha/mocha.js"></script>
        <script>
            mocha.setup({ui: 'bdd'});

            describe('Test suite', function () {
                it('A single passing test', function() {
                    // this passes
                });
            });

            mocha.run();
        </script>
    </body>
</html>

Running this hangs:

mocha-headless-chrome --file test-plugins/browsertest.html?grep=unmatchable

If you pass a callback directly to mocha.run(), that seems to reliably get called in this scenario.

@Mr0grog
Copy link
Author

Mr0grog commented Oct 11, 2017

The underlying cause is mochajs/mocha#3065, but that may be considered working as intended.

@dima117
Copy link
Contributor

dima117 commented Oct 11, 2017

Hi,

I will fix it today.

@dima117
Copy link
Contributor

dima117 commented Oct 12, 2017

Done! [email protected]

@dima117 dima117 closed this as completed Oct 12, 2017
@Mr0grog
Copy link
Author

Mr0grog commented Oct 12, 2017

Works great! Thanks so much for the quick response :)

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