Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebStorm Mocha Testing: tests never finish

I'm using WebStorm 2017.2.2 to develop and run some mocha tests.

All is going pretty well, but the tests never finish. It gets done with running all of my test files, then just sits there spinning saying "Running Tests."

If I hover over the red box, it shows a tooltip that says: Stop 'Full Tests' (⌘F2). It also shows "Stop Process" at the bottom of the IDE. So, I click it, and the red box turns into a skull.

Now, if I hover over the skull, it shows a tooltip that says: Stop 'Full Tests' (⌘F2) (same as before). It also shows "Kill Process" (different) at the bottom of the IDE. So, I click it, and the IDE stops saying "Running Tests" and now says "Test Results."

How do I configure WebStorm so that it automatically ties up those loose ends when it reaches the end of my test suite?

like image 866
mbm29414 Avatar asked Oct 20 '17 18:10

mbm29414


People also ask

How do you end a mocha test?

Steps to Reproduce Run with mocha --timeout 1000000 test. js. Do not wait until the test finishes and press Ctrl+C to terminate it.

Is mocha a runner test?

Mocha is a feature-rich JavaScript test framework running on Node. js and in the browser, making asynchronous testing simple and fun. Mocha tests run serially, allowing for flexible and accurate reporting, while mapping uncaught exceptions to the correct test cases.

What are pending tests in mocha?

There cases when you need to perform asynchronous operations before any suites are run, in such case you may want to delay the root suite. You should run mocha with the -delay flag. This attaches to the global context, a special callback function, run(). A pending test is a test that does not have a callback.


1 Answers

To answer this, the mocha docs state that autoexit is not a feature in v4, basically something is stopping the tests from exiting, to revert back to the v3+ way of exiting when your tests pass, use the arg --exit in your test configs under Extra mocha options

https://boneskull.com/mocha-v4-nears-release/#mochawontforceexit

like image 197
dave Avatar answered Oct 03 '22 06:10

dave