Skip to content
This repository was archived by the owner on Sep 19, 2025. It is now read-only.

Commit d4165dd

Browse files
Fix java test timeouts to make tests less flaky
1 parent cc25f34 commit d4165dd

File tree

4 files changed

+42
-0
lines changed

4 files changed

+42
-0
lines changed

packages/google-closure-compiler/test/cli.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,17 @@ describe('command line interface', () => {
5151

5252
platforms.forEach((platform) => {
5353
describe(`${platform} version`, () => {
54+
let originalTimeout;
55+
beforeEach(() => {
56+
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
57+
if (platform === 'java') {
58+
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
59+
}
60+
});
61+
afterEach(() => {
62+
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
63+
});
64+
5465
it('--help flag', async () => {
5566
const retVal =
5667
await runCommand(`${cliPath} --platform=${platform} --help`, {stdio: 'pipe'});

packages/google-closure-compiler/test/grunt.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,17 @@ describe('grunt-google-closure-compiler', () => {
114114
platforms.forEach((platform) => {
115115
describe(`${platform} version`, () => {
116116
let closureCompiler;
117+
let originalTimeout;
117118
beforeEach(() => {
118119
closureCompiler = gruntPlugin(mockGrunt, {platform});
120+
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
121+
if (platform === 'java') {
122+
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
123+
}
124+
});
125+
126+
afterEach(() => {
127+
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
119128
});
120129

121130
const ensureCorrectPlatformUtilized = () => {

packages/google-closure-compiler/test/gulp.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,17 @@ describe('gulp-google-closure-compiler', function() {
8989
'for(var a in window)this.props.push(a)};WindowInfo.prototype.list=function(){' +
9090
'log(this.props.join(", "))};(new WindowInfo).list();\n';
9191

92+
let originalTimeout;
93+
beforeEach(() => {
94+
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
95+
if (platform === 'java') {
96+
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
97+
}
98+
});
99+
afterEach(() => {
100+
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
101+
});
102+
92103
it('should emit an error for invalid flag', async () => {
93104
let resolvePromise;
94105
const complete = new Promise((resolve) => {

packages/google-closure-compiler/test/node.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,17 @@ describe('closure-compiler node bindings', () => {
3838
});
3939

4040
describe('java version', () => {
41+
let originalTimeout;
42+
beforeEach(() => {
43+
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
44+
if (platform === 'java') {
45+
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
46+
}
47+
});
48+
afterEach(() => {
49+
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
50+
});
51+
4152
it('should error when java is not in the path', async () => {
4253
const compiler = new Compiler({version: true});
4354
compiler.javaPath = 'DOES_NOT_EXIST';

0 commit comments

Comments
 (0)