问题
I started without knowing much in AngularJS. When I run :
.\node_modules\.bin\karma start karma.conf.js --no-auto-watch --single-run --reporters=dots --browsers=PhantomJS
I get the following message :
WARN [PhantomJS 1.9.8 (Windows 7 0.0.0)]: Disconnected (1 times), because no message in 10000 ms.
I started with the angular-seed project, from there I made adjustment for my needs. I want to use jasmine as my testing framework. So I made my test case based on the current angular-seed one:
describe('sputnikApp.view1 module', function () {
beforeEach(module('sputnikApp.view1'));
describe('view1 controller', function () {
var scope;
beforeEach(inject(function($rootScope, $controller) {
scope = $rootScope.$new();
$controller('View1Ctrl', {$scope: scope});
}));
it("it should have has default selected priority Normal", function() {
expect(input("select.value1").val()).toBe('2');
})
});
});
The part with the expect(input(... I think the input thing is part of jasmine framework. I added jasmine, and apparently I had an error because something wasn't loading. I fixed it by adding RequireJS. Now here I am, almost done I think, and the test cases aren't running.
I give you the repository and the travis, it might help.
I suspect it's something to do with RequireJS
I looked at the others questions that looks related to this one, but it doesn't work. I think I might have overcomplicated things with requireJS. If I don't need it that would be better I think...
https://github.com/Lorac/sputnik-angularjs
https://travis-ci.org/Lorac/sputnik-angularjs
回答1:
You can set the browser timeout in your karma config. I fixed the problem by extending my timeout to 30000 instead of the default 10000. browserNoActivityTimeout is the setting you want in this case however there are other timeouts you may want to change as well:
browserNoActivityTimeout : 60000, //default 10000
browserDisconnectTimeout : 10000, // default 2000
browserDisconnectTolerance : 1, // default 0
captureTimeout: 60000
回答2:
Rework my dependencies + removing requireJS and it works.
来源:https://stackoverflow.com/questions/31083916/no-message-in-10000-ms-jasmine-karma-requirejss