After successfully setting up an AngularJS project in WebStorm, I encountered an issue with the Karma testing suite.
The model setup looks like this:
beforeEach(module('[modulename]'));
My tests are as follows:
it('should work', ((function() {
//spec body
expect(true).toBe(true);
})));
This test works and passes, however,
it('should work, does it?', (inject(function(_$http_) {
//spec body
$http=_$http_;
expect(true).toBe(true);
})));
The second test not only fails but also causes my module to stop loading.
Error: [$injector:modulerr] Failed to instantiate [modulename] due to: Error: [$injector:nomod] Module '[modulename]' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
Even though both tests seem to work fine individually, running them together results in the error mentioned above.
It's worth noting that everything functions correctly when running the application in a browser window, indicating that the issue lies within the test file or another area.
As someone new to AngularJS and Karma, I hope this isn't too naive of a question.