karma-runner / grunt-karma

Grunt plugin for Karma.
MIT License
468 stars 116 forks source link

No tests causes the "Executed 0 of 0 ERROR" message #139

Closed moneytree-doug closed 8 years ago

moneytree-doug commented 9 years ago

I was moving my project to a different repo, and noticed that it fails when there aren't any tests in the folder. I tested it further by just deleting the whole test folder incase there was a special character and it still throws this error. As soon as I add one test, it works. And all my tests does is this following:

'use strict'

describe('Hacky tests to stop karma failing with that silly message', function() {
    it("should make a POST request", function() {
        expect(1).toEqual(1)
    })
})

Any thoughts on how to fix this?

Edit: Using the latest karma 0.12.31

gampleman commented 8 years ago

Isn't that expected behavior? Surely, (especially on CI) you want your test runner to fail if they don't find any tests to execute. Otherwise you could merge a PR where the build is green but somebody accidentally modified the configuration for the path to the spec folder...

moneytree-doug commented 8 years ago

@gampleman It makes sense if you contextualize it that way, but I really wouldn't expect my test runner to fail when there are no tests. I would suggest a different message, at least, to make it more clear on what is happening. It doesn't make sense why running 0 tests would fail. How could you fail a test if there isn't test to begin with?

lazd commented 8 years ago

@moneytree-doug there is a new options, failOnEmptyTestSuite, that you can set to false. That will likely solve your problem.

See http://karma-runner.github.io/1.0/config/configuration-file.html