test(testrunner): fix the 'timeout: 0' test runner setting (#1561)

This commit is contained in:
Andrey Lushnikov 2017-12-08 16:44:24 -08:00 committed by GitHub
parent 391d1abaa7
commit fc1f15e251
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,8 +34,6 @@ class UserCallback {
async run(...args) { async run(...args) {
const timeoutPromise = new Promise(resolve => { const timeoutPromise = new Promise(resolve => {
if (!this.timeout)
return;
setTimeout(resolve.bind(null, TimeoutError), this.timeout); setTimeout(resolve.bind(null, TimeoutError), this.timeout);
}); });
try { try {
@ -264,7 +262,8 @@ class TestRunner extends EventEmitter {
this._rootSuite = new Suite(null, '', TestMode.Run); this._rootSuite = new Suite(null, '', TestMode.Run);
this._currentSuite = this._rootSuite; this._currentSuite = this._rootSuite;
this._tests = []; this._tests = [];
this._timeout = options.timeout || 10 * 1000; // 10 seconds. // Default timeout is 10 seconds.
this._timeout = options.timeout === 0 ? 2147483647 : options.timeout || 10 * 1000;
this._parallel = options.parallel || 1; this._parallel = options.parallel || 1;
this._retryFailures = !!options.retryFailures; this._retryFailures = !!options.retryFailures;