Skip to content

Commit

Permalink
Disable if setting == or grtr to upper
Browse files Browse the repository at this point in the history
  • Loading branch information
craigtaub committed May 3, 2020
1 parent 673af52 commit efc80a8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
10 changes: 8 additions & 2 deletions lib/runnable.js
Expand Up @@ -80,8 +80,14 @@ Runnable.prototype.timeout = function(ms) {
var range = [0, INT_MAX];
ms = utils.clamp(ms, range);

debug('timeout %d', ms);
this._timeout = ms;
// see #1652 for reasoning
if (ms === range[0] || ms === range[1]) {
this._timeout = 0;
} else {
this._timeout = ms;
}
debug('timeout %d', this._timeout);

if (this.timer) {
this.resetTimeout();
}
Expand Down
20 changes: 4 additions & 16 deletions test/unit/runnable.spec.js
Expand Up @@ -74,14 +74,8 @@ describe('Runnable(title, fn)', function() {
run.timeout(MAX_TIMEOUT);
});
describe('given numeric value', function() {
it('should set the timeout value', function() {
expect(run.timeout(), 'to be', MAX_TIMEOUT);
});
});

describe('given string timestamp', function() {
it('should set the timeout value', function() {
expect(run.timeout(), 'to be', MAX_TIMEOUT);
it('should set the disabled timeout value', function() {
expect(run.timeout(), 'to be', 0);
});
});
});
Expand All @@ -96,14 +90,8 @@ describe('Runnable(title, fn)', function() {
});

describe('given numeric value', function() {
it('should clamp the value to max timeout', function() {
expect(run.timeout(), 'to be', MAX_TIMEOUT);
});
});

describe('given string timestamp', function() {
it('should clamp the value to max timeout', function() {
expect(run.timeout(), 'to be', MAX_TIMEOUT);
it('should set the disabled timeout value', function() {
expect(run.timeout(), 'to be', 0);
});
});
});
Expand Down

0 comments on commit efc80a8

Please sign in to comment.