Skip to content
Snippets Groups Projects
Commit e5a91870 authored by Mike Greiling's avatar Mike Greiling Committed by Clement Ho
Browse files

Increase karma socket timeout

parent f2505eb6
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -54,6 +54,7 @@ module.exports = function(config) {
subdir: '.',
fixWebpackSourcePaths: true
};
karmaConfig.browserNoActivityTimeout = 60000; // 60 seconds
}
 
if (process.env.DEBUG) {
Loading
Loading
/* 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';
Loading
Loading
@@ -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();
};
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');
describe('project list', () => {
let reqUrl;
let reqData;
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 = {};
});
});
Loading
Loading
@@ -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) {
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment