Skip to content

Commit 9bf2da0

Browse files
committed
Increase functional tests timeout
1 parent 91db1b3 commit 9bf2da0

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

test/cljParser.test.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ import * as assert from 'assert';
22
import * as path from 'path';
33
import * as vscode from 'vscode';
44
import { cljParser } from '../src/cljParser';
5+
import { setLongTimeout } from './utils';
56

67
const testFolderLocation = '/../../test/documents/';
78

8-
suite('cljParser.getNamespace', () => {
9+
suite('cljParser.getNamespace', function() {
910
let cases = [
1011
['user', ''],
1112
['foo', '(ns foo)'],
@@ -34,8 +35,9 @@ suite('cljParser.getNamespace', () => {
3435
}
3536
});
3637

37-
suite('cljParser.getCurrentBlock', () => {
38+
suite('cljParser.getCurrentBlock', function() {
3839
// title, line, character, expected
40+
setLongTimeout(this);
3941
let cases: [string, number, number, string | undefined][] = [
4042
['Position on the same line', 16, 9, '(prn "test")'],
4143
['Position at the middle of multiline block', 22, 5,
@@ -67,8 +69,9 @@ suite('cljParser.getCurrentBlock', () => {
6769
testBlockSelection('Eval current block', cljParser.getCurrentBlock, 'evalBlock.clj', cases);
6870
});
6971

70-
suite('cljParser.getOuterBlock', () => {
72+
suite('cljParser.getOuterBlock', function() {
7173
// title, line, character, expected
74+
setLongTimeout(this);
7275
let cases: [string, number, number, string | undefined][] = [
7376
['Get outermost block of function definition', 11, 20,
7477
'(defn new-system-dev\n' +

test/utils.ts

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const LONG_TIMEOUT: number = 5000;
2+
3+
/**
4+
* Some functional tests that run the editor may require longer time to finish
5+
* than the default Mocha's timeout. Been called from a test suite body, this
6+
* helper increases the timeout to {@link LONG_TIMEOUT}.
7+
*
8+
* @param suite: A test suite instance.
9+
*/
10+
const setLongTimeout = (suite: Mocha.IContextDefinition): void => {
11+
suite.timeout(LONG_TIMEOUT);
12+
}
13+
14+
export const utils = {
15+
setLongTimeout,
16+
}

0 commit comments

Comments
 (0)