Increase karma socket timeout

This commit is contained in:
Mike Greiling 2017-06-16 20:40:28 +00:00 committed by Clement Ho
parent f2505eb6ce
commit e5a91870fd
3 changed files with 48 additions and 35 deletions

View file

@ -54,6 +54,7 @@ module.exports = function(config) {
subdir: '.',
fixWebpackSourcePaths: true
};
karmaConfig.browserNoActivityTimeout = 60000; // 60 seconds
}
if (process.env.DEBUG) {

View file

@ -1,4 +1,3 @@
/* eslint-disable space-before-function-paren, no-unused-expressions, no-return-assign, no-param-reassign, no-var, new-cap, wrap-iife, no-unused-vars, quotes, jasmine/no-expect-in-setup-teardown, max-len */
/* global Project */
import 'select2/select2';
@ -7,47 +6,52 @@ import '~/api';
import '~/project_select';
import '~/project';
(function() {
describe('Project Title', function() {
preloadFixtures('issues/open-issue.html.raw');
loadJSONFixtures('projects.json');
describe('Project Title', () => {
preloadFixtures('issues/open-issue.html.raw');
loadJSONFixtures('projects.json');
beforeEach(function() {
loadFixtures('issues/open-issue.html.raw');
beforeEach(() => {
loadFixtures('issues/open-issue.html.raw');
window.gon = {};
window.gon.api_version = 'v3';
window.gon = {};
window.gon.api_version = 'v3';
return this.project = new Project();
});
// eslint-disable-next-line no-new
new Project();
});
describe('project list', function() {
var fakeAjaxResponse = function fakeAjaxResponse(req) {
var d;
expect(req.url).toBe('/api/v3/projects.json?simple=true');
expect(req.data).toEqual({ search: '', order_by: 'last_activity_at', per_page: 20, membership: true });
d = $.Deferred();
d.resolve(this.projects_data);
return d.promise();
};
describe('project list', () => {
let reqUrl;
let reqData;
beforeEach((function(_this) {
return function() {
_this.projects_data = getJSONFixture('projects.json');
return spyOn(jQuery, 'ajax').and.callFake(fakeAjaxResponse.bind(_this));
};
})(this));
it('toggles dropdown', function() {
var menu = $('.js-dropdown-menu-projects');
$('.js-projects-dropdown-toggle').click();
expect(menu).toHaveClass('open');
menu.find('.dropdown-menu-close-icon').click();
expect(menu).not.toHaveClass('open');
beforeEach(() => {
const fakeResponseData = getJSONFixture('projects.json');
spyOn(jQuery, 'ajax').and.callFake((req) => {
const def = $.Deferred();
reqUrl = req.url;
reqData = req.data;
def.resolve(fakeResponseData);
return def.promise();
});
});
afterEach(() => {
window.gon = {};
it('toggles dropdown', () => {
const $menu = $('.js-dropdown-menu-projects');
$('.js-projects-dropdown-toggle').click();
expect($menu).toHaveClass('open');
expect(reqUrl).toBe('/api/v3/projects.json?simple=true');
expect(reqData).toEqual({
search: '',
order_by: 'last_activity_at',
per_page: 20,
membership: true,
});
$menu.find('.dropdown-menu-close-icon').click();
expect($menu).not.toHaveClass('open');
});
});
}).call(window);
afterEach(() => {
window.gon = {};
});
});

View file

@ -16,6 +16,14 @@ window.gl = window.gl || {};
window.gl.TEST_HOST = 'http://test.host';
window.gon = window.gon || {};
// HACK: Chrome 59 disconnects if there are too many synchronous tests in a row
// because it appears to lock up the thread that communicates to Karma's socket
// This async beforeEach gets called on every spec and releases the JS thread long
// enough for the socket to continue to communicate.
// The downside is that it creates a minor performance penalty in the time it takes
// to run our unit tests.
beforeEach(done => done()); // eslint-disable-line jasmine/no-global-setup
// render all of our tests
const testsContext = require.context('.', true, /_spec$/);
testsContext.keys().forEach(function (path) {