Merge branch '3.99' into 4.0
This commit is contained in:
@@ -192,7 +192,7 @@ workflows:
|
|||||||
filters:
|
filters:
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
- main
|
- browser-flakes
|
||||||
jobs:
|
jobs:
|
||||||
- build:
|
- build:
|
||||||
executor: node14
|
executor: node14
|
||||||
|
|||||||
14
Gruntfile.js
14
Gruntfile.js
@@ -34,17 +34,11 @@ module.exports = function(grunt) {
|
|||||||
jasmine = new Jasmine({jasmineCore: jasmineCore});
|
jasmine = new Jasmine({jasmineCore: jasmineCore});
|
||||||
|
|
||||||
jasmine.loadConfigFile('./spec/support/jasmine.json');
|
jasmine.loadConfigFile('./spec/support/jasmine.json');
|
||||||
|
jasmine.onComplete(function(passed) {
|
||||||
|
done(passed);
|
||||||
|
});
|
||||||
|
|
||||||
jasmine.exitOnCompletion = false;
|
jasmine.execute();
|
||||||
jasmine.execute().then(
|
|
||||||
result => {
|
|
||||||
done(result.overallStatus === 'passed');
|
|
||||||
},
|
|
||||||
err => {
|
|
||||||
console.error(err);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -169,6 +169,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
* Maximum object depth the pretty printer will print to.
|
* Maximum object depth the pretty printer will print to.
|
||||||
* Set this to a lower value to speed up pretty printing if you have large objects.
|
* Set this to a lower value to speed up pretty printing if you have large objects.
|
||||||
* @name jasmine.MAX_PRETTY_PRINT_DEPTH
|
* @name jasmine.MAX_PRETTY_PRINT_DEPTH
|
||||||
|
* @default 8
|
||||||
* @since 1.3.0
|
* @since 1.3.0
|
||||||
*/
|
*/
|
||||||
j$.MAX_PRETTY_PRINT_DEPTH = 8;
|
j$.MAX_PRETTY_PRINT_DEPTH = 8;
|
||||||
@@ -177,6 +178,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
* This will also limit the number of keys and values displayed for an object.
|
* This will also limit the number of keys and values displayed for an object.
|
||||||
* Elements past this number will be ellipised.
|
* Elements past this number will be ellipised.
|
||||||
* @name jasmine.MAX_PRETTY_PRINT_ARRAY_LENGTH
|
* @name jasmine.MAX_PRETTY_PRINT_ARRAY_LENGTH
|
||||||
|
* @default 50
|
||||||
* @since 2.7.0
|
* @since 2.7.0
|
||||||
*/
|
*/
|
||||||
j$.MAX_PRETTY_PRINT_ARRAY_LENGTH = 50;
|
j$.MAX_PRETTY_PRINT_ARRAY_LENGTH = 50;
|
||||||
@@ -184,15 +186,35 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
* Maximum number of characters to display when pretty printing objects.
|
* Maximum number of characters to display when pretty printing objects.
|
||||||
* Characters past this number will be ellipised.
|
* Characters past this number will be ellipised.
|
||||||
* @name jasmine.MAX_PRETTY_PRINT_CHARS
|
* @name jasmine.MAX_PRETTY_PRINT_CHARS
|
||||||
|
* @default 100
|
||||||
* @since 2.9.0
|
* @since 2.9.0
|
||||||
*/
|
*/
|
||||||
j$.MAX_PRETTY_PRINT_CHARS = 1000;
|
j$.MAX_PRETTY_PRINT_CHARS = 1000;
|
||||||
/**
|
/**
|
||||||
* Default number of milliseconds Jasmine will wait for an asynchronous spec to complete.
|
* Default number of milliseconds Jasmine will wait for an asynchronous spec,
|
||||||
|
* before, or after function to complete. This can be overridden on a case by
|
||||||
|
* case basis by passing a time limit as the third argument to {@link it},
|
||||||
|
* {@link beforeEach}, {@link afterEach}, {@link beforeAll}, or
|
||||||
|
* {@link afterAll}. The value must be no greater than the largest number of
|
||||||
|
* milliseconds supported by setTimeout, which is usually 2147483647.
|
||||||
|
*
|
||||||
|
* While debugging tests, you may want to set this to a large number (or pass
|
||||||
|
* a large number to one of the functions mentioned above) so that Jasmine
|
||||||
|
* does not move on to after functions or the next spec while you're debugging.
|
||||||
* @name jasmine.DEFAULT_TIMEOUT_INTERVAL
|
* @name jasmine.DEFAULT_TIMEOUT_INTERVAL
|
||||||
|
* @default 5000
|
||||||
* @since 1.3.0
|
* @since 1.3.0
|
||||||
*/
|
*/
|
||||||
j$.DEFAULT_TIMEOUT_INTERVAL = 5000;
|
var DEFAULT_TIMEOUT_INTERVAL = 5000;
|
||||||
|
Object.defineProperty(j$, 'DEFAULT_TIMEOUT_INTERVAL', {
|
||||||
|
get: function() {
|
||||||
|
return DEFAULT_TIMEOUT_INTERVAL;
|
||||||
|
},
|
||||||
|
set: function(newValue) {
|
||||||
|
j$.util.validateTimeout(newValue, 'jasmine.DEFAULT_TIMEOUT_INTERVAL');
|
||||||
|
DEFAULT_TIMEOUT_INTERVAL = newValue;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
j$.getGlobal = function() {
|
j$.getGlobal = function() {
|
||||||
return jasmineGlobal;
|
return jasmineGlobal;
|
||||||
@@ -668,6 +690,21 @@ getJasmineRequireObj().util = function(j$) {
|
|||||||
StopIteration.prototype = Object.create(Error.prototype);
|
StopIteration.prototype = Object.create(Error.prototype);
|
||||||
StopIteration.prototype.constructor = StopIteration;
|
StopIteration.prototype.constructor = StopIteration;
|
||||||
|
|
||||||
|
util.validateTimeout = function(timeout, msgPrefix) {
|
||||||
|
// Timeouts are implemented with setTimeout, which only supports a limited
|
||||||
|
// range of values. The limit is unspecified, as is the behavior when it's
|
||||||
|
// exceeded. But on all currently supported JS runtimes, setTimeout calls
|
||||||
|
// the callback immediately when the timeout is greater than 2147483647
|
||||||
|
// (the maximum value of a signed 32 bit integer).
|
||||||
|
var max = 2147483647;
|
||||||
|
|
||||||
|
if (timeout > max) {
|
||||||
|
throw new Error(
|
||||||
|
(msgPrefix || 'Timeout value') + ' cannot be greater than ' + max
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return util;
|
return util;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2101,6 +2138,11 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
if (arguments.length > 1 && typeof fn !== 'undefined') {
|
if (arguments.length > 1 && typeof fn !== 'undefined') {
|
||||||
ensureIsFunctionOrAsync(fn, 'it');
|
ensureIsFunctionOrAsync(fn, 'it');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (timeout) {
|
||||||
|
j$.util.validateTimeout(timeout);
|
||||||
|
}
|
||||||
|
|
||||||
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
|
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
|
||||||
if (currentDeclarationSuite.markedPending) {
|
if (currentDeclarationSuite.markedPending) {
|
||||||
spec.pend();
|
spec.pend();
|
||||||
@@ -2130,6 +2172,10 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
this.fit = function(description, fn, timeout) {
|
this.fit = function(description, fn, timeout) {
|
||||||
ensureIsNotNested('fit');
|
ensureIsNotNested('fit');
|
||||||
ensureIsFunctionOrAsync(fn, 'fit');
|
ensureIsFunctionOrAsync(fn, 'fit');
|
||||||
|
|
||||||
|
if (timeout) {
|
||||||
|
j$.util.validateTimeout(timeout);
|
||||||
|
}
|
||||||
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
|
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
|
||||||
currentDeclarationSuite.addChild(spec);
|
currentDeclarationSuite.addChild(spec);
|
||||||
focusedRunnables.push(spec.id);
|
focusedRunnables.push(spec.id);
|
||||||
@@ -2194,6 +2240,11 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
this.beforeEach = function(beforeEachFunction, timeout) {
|
this.beforeEach = function(beforeEachFunction, timeout) {
|
||||||
ensureIsNotNested('beforeEach');
|
ensureIsNotNested('beforeEach');
|
||||||
ensureIsFunctionOrAsync(beforeEachFunction, 'beforeEach');
|
ensureIsFunctionOrAsync(beforeEachFunction, 'beforeEach');
|
||||||
|
|
||||||
|
if (timeout) {
|
||||||
|
j$.util.validateTimeout(timeout);
|
||||||
|
}
|
||||||
|
|
||||||
currentDeclarationSuite.beforeEach({
|
currentDeclarationSuite.beforeEach({
|
||||||
fn: beforeEachFunction,
|
fn: beforeEachFunction,
|
||||||
timeout: timeout || 0
|
timeout: timeout || 0
|
||||||
@@ -2203,6 +2254,11 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
this.beforeAll = function(beforeAllFunction, timeout) {
|
this.beforeAll = function(beforeAllFunction, timeout) {
|
||||||
ensureIsNotNested('beforeAll');
|
ensureIsNotNested('beforeAll');
|
||||||
ensureIsFunctionOrAsync(beforeAllFunction, 'beforeAll');
|
ensureIsFunctionOrAsync(beforeAllFunction, 'beforeAll');
|
||||||
|
|
||||||
|
if (timeout) {
|
||||||
|
j$.util.validateTimeout(timeout);
|
||||||
|
}
|
||||||
|
|
||||||
currentDeclarationSuite.beforeAll({
|
currentDeclarationSuite.beforeAll({
|
||||||
fn: beforeAllFunction,
|
fn: beforeAllFunction,
|
||||||
timeout: timeout || 0
|
timeout: timeout || 0
|
||||||
@@ -2212,6 +2268,11 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
this.afterEach = function(afterEachFunction, timeout) {
|
this.afterEach = function(afterEachFunction, timeout) {
|
||||||
ensureIsNotNested('afterEach');
|
ensureIsNotNested('afterEach');
|
||||||
ensureIsFunctionOrAsync(afterEachFunction, 'afterEach');
|
ensureIsFunctionOrAsync(afterEachFunction, 'afterEach');
|
||||||
|
|
||||||
|
if (timeout) {
|
||||||
|
j$.util.validateTimeout(timeout);
|
||||||
|
}
|
||||||
|
|
||||||
afterEachFunction.isCleanup = true;
|
afterEachFunction.isCleanup = true;
|
||||||
currentDeclarationSuite.afterEach({
|
currentDeclarationSuite.afterEach({
|
||||||
fn: afterEachFunction,
|
fn: afterEachFunction,
|
||||||
@@ -2222,6 +2283,11 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
this.afterAll = function(afterAllFunction, timeout) {
|
this.afterAll = function(afterAllFunction, timeout) {
|
||||||
ensureIsNotNested('afterAll');
|
ensureIsNotNested('afterAll');
|
||||||
ensureIsFunctionOrAsync(afterAllFunction, 'afterAll');
|
ensureIsFunctionOrAsync(afterAllFunction, 'afterAll');
|
||||||
|
|
||||||
|
if (timeout) {
|
||||||
|
j$.util.validateTimeout(timeout);
|
||||||
|
}
|
||||||
|
|
||||||
currentDeclarationSuite.afterAll({
|
currentDeclarationSuite.afterAll({
|
||||||
fn: afterAllFunction,
|
fn: afterAllFunction,
|
||||||
timeout: timeout || 0
|
timeout: timeout || 0
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
"grunt-contrib-concat": "^1.0.1",
|
"grunt-contrib-concat": "^1.0.1",
|
||||||
"grunt-css-url-embed": "^1.11.1",
|
"grunt-css-url-embed": "^1.11.1",
|
||||||
"grunt-sass": "^3.0.2",
|
"grunt-sass": "^3.0.2",
|
||||||
"jasmine": "github:jasmine/jasmine-npm#main",
|
"jasmine": "^3.4.0",
|
||||||
"jasmine-browser-runner": "github:jasmine/jasmine-browser#main",
|
"jasmine-browser-runner": "github:jasmine/jasmine-browser#main",
|
||||||
"jsdom": "^15.0.0",
|
"jsdom": "^15.0.0",
|
||||||
"load-grunt-tasks": "^4.0.0",
|
"load-grunt-tasks": "^4.0.0",
|
||||||
|
|||||||
@@ -295,6 +295,12 @@ describe('Env', function() {
|
|||||||
env.it('async', async function() {});
|
env.it('async', async function() {});
|
||||||
}).not.toThrow();
|
}).not.toThrow();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('throws an error when the timeout value is too large for setTimeout', function() {
|
||||||
|
expect(function() {
|
||||||
|
env.it('huge timeout', function() {}, 2147483648);
|
||||||
|
}).toThrowError('Timeout value cannot be greater than 2147483647');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('#xit', function() {
|
describe('#xit', function() {
|
||||||
@@ -340,6 +346,12 @@ describe('Env', function() {
|
|||||||
/fit expects a function argument; received \[object (Undefined|DOMWindow|Object)\]/
|
/fit expects a function argument; received \[object (Undefined|DOMWindow|Object)\]/
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('throws an error when the timeout value is too large for setTimeout', function() {
|
||||||
|
expect(function() {
|
||||||
|
env.fit('huge timeout', function() {}, 2147483648);
|
||||||
|
}).toThrowError('Timeout value cannot be greater than 2147483647');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('#beforeEach', function() {
|
describe('#beforeEach', function() {
|
||||||
@@ -356,6 +368,12 @@ describe('Env', function() {
|
|||||||
env.beforeEach(async function() {});
|
env.beforeEach(async function() {});
|
||||||
}).not.toThrow();
|
}).not.toThrow();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('throws an error when the timeout value is too large for setTimeout', function() {
|
||||||
|
expect(function() {
|
||||||
|
env.beforeEach(function() {}, 2147483648);
|
||||||
|
}).toThrowError('Timeout value cannot be greater than 2147483647');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('#beforeAll', function() {
|
describe('#beforeAll', function() {
|
||||||
@@ -372,6 +390,12 @@ describe('Env', function() {
|
|||||||
env.beforeAll(async function() {});
|
env.beforeAll(async function() {});
|
||||||
}).not.toThrow();
|
}).not.toThrow();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('throws an error when the timeout value is too large for setTimeout', function() {
|
||||||
|
expect(function() {
|
||||||
|
env.beforeAll(function() {}, 2147483648);
|
||||||
|
}).toThrowError('Timeout value cannot be greater than 2147483647');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('#afterEach', function() {
|
describe('#afterEach', function() {
|
||||||
@@ -388,6 +412,12 @@ describe('Env', function() {
|
|||||||
env.afterEach(async function() {});
|
env.afterEach(async function() {});
|
||||||
}).not.toThrow();
|
}).not.toThrow();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('throws an error when the timeout value is too large for setTimeout', function() {
|
||||||
|
expect(function() {
|
||||||
|
env.afterEach(function() {}, 2147483648);
|
||||||
|
}).toThrowError('Timeout value cannot be greater than 2147483647');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('#afterAll', function() {
|
describe('#afterAll', function() {
|
||||||
@@ -404,6 +434,12 @@ describe('Env', function() {
|
|||||||
env.afterAll(async function() {});
|
env.afterAll(async function() {});
|
||||||
}).not.toThrow();
|
}).not.toThrow();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('throws an error when the timeout value is too large for setTimeout', function() {
|
||||||
|
expect(function() {
|
||||||
|
env.afterAll(function() {}, 2147483648);
|
||||||
|
}).toThrowError('Timeout value cannot be greater than 2147483647');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when not constructed with suppressLoadErrors: true', function() {
|
describe('when not constructed with suppressLoadErrors: true', function() {
|
||||||
|
|||||||
@@ -153,4 +153,49 @@ describe('base helpers', function() {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('DEFAULT_TIMEOUT_INTERVAL setter', function() {
|
||||||
|
var max = 2147483647;
|
||||||
|
|
||||||
|
beforeEach(function() {
|
||||||
|
this.initialValue = jasmineUnderTest.DEFAULT_TIMEOUT_INTERVAL;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(function() {
|
||||||
|
jasmineUnderTest.DEFAULT_TIMEOUT_INTERVAL = this.initialValue;
|
||||||
|
});
|
||||||
|
|
||||||
|
it('accepts only values <= ' + max, function() {
|
||||||
|
expect(function() {
|
||||||
|
jasmineUnderTest.DEFAULT_TIMEOUT_INTERVAL = max + 1;
|
||||||
|
}).toThrowError(
|
||||||
|
'jasmine.DEFAULT_TIMEOUT_INTERVAL cannot be greater than ' + max
|
||||||
|
);
|
||||||
|
|
||||||
|
jasmineUnderTest.DEFAULT_TIMEOUT_INTERVAL = max;
|
||||||
|
expect(jasmineUnderTest.DEFAULT_TIMEOUT_INTERVAL).toEqual(max);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('is consistent with setTimeout in this environment', function(done) {
|
||||||
|
var f1 = jasmine.createSpy('setTimeout callback for ' + max),
|
||||||
|
f2 = jasmine.createSpy('setTimeout callback for ' + (max + 1)),
|
||||||
|
id;
|
||||||
|
|
||||||
|
// Suppress printing of TimeoutOverflowWarning in node
|
||||||
|
spyOn(console, 'error');
|
||||||
|
|
||||||
|
id = setTimeout(f1, max);
|
||||||
|
setTimeout(function() {
|
||||||
|
clearTimeout(id);
|
||||||
|
expect(f1).not.toHaveBeenCalled();
|
||||||
|
|
||||||
|
id = setTimeout(f2, max + 1);
|
||||||
|
setTimeout(function() {
|
||||||
|
clearTimeout(id);
|
||||||
|
expect(f2).toHaveBeenCalled();
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1069,6 +1069,11 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
if (arguments.length > 1 && typeof fn !== 'undefined') {
|
if (arguments.length > 1 && typeof fn !== 'undefined') {
|
||||||
ensureIsFunctionOrAsync(fn, 'it');
|
ensureIsFunctionOrAsync(fn, 'it');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (timeout) {
|
||||||
|
j$.util.validateTimeout(timeout);
|
||||||
|
}
|
||||||
|
|
||||||
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
|
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
|
||||||
if (currentDeclarationSuite.markedPending) {
|
if (currentDeclarationSuite.markedPending) {
|
||||||
spec.pend();
|
spec.pend();
|
||||||
@@ -1098,6 +1103,10 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
this.fit = function(description, fn, timeout) {
|
this.fit = function(description, fn, timeout) {
|
||||||
ensureIsNotNested('fit');
|
ensureIsNotNested('fit');
|
||||||
ensureIsFunctionOrAsync(fn, 'fit');
|
ensureIsFunctionOrAsync(fn, 'fit');
|
||||||
|
|
||||||
|
if (timeout) {
|
||||||
|
j$.util.validateTimeout(timeout);
|
||||||
|
}
|
||||||
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
|
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
|
||||||
currentDeclarationSuite.addChild(spec);
|
currentDeclarationSuite.addChild(spec);
|
||||||
focusedRunnables.push(spec.id);
|
focusedRunnables.push(spec.id);
|
||||||
@@ -1162,6 +1171,11 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
this.beforeEach = function(beforeEachFunction, timeout) {
|
this.beforeEach = function(beforeEachFunction, timeout) {
|
||||||
ensureIsNotNested('beforeEach');
|
ensureIsNotNested('beforeEach');
|
||||||
ensureIsFunctionOrAsync(beforeEachFunction, 'beforeEach');
|
ensureIsFunctionOrAsync(beforeEachFunction, 'beforeEach');
|
||||||
|
|
||||||
|
if (timeout) {
|
||||||
|
j$.util.validateTimeout(timeout);
|
||||||
|
}
|
||||||
|
|
||||||
currentDeclarationSuite.beforeEach({
|
currentDeclarationSuite.beforeEach({
|
||||||
fn: beforeEachFunction,
|
fn: beforeEachFunction,
|
||||||
timeout: timeout || 0
|
timeout: timeout || 0
|
||||||
@@ -1171,6 +1185,11 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
this.beforeAll = function(beforeAllFunction, timeout) {
|
this.beforeAll = function(beforeAllFunction, timeout) {
|
||||||
ensureIsNotNested('beforeAll');
|
ensureIsNotNested('beforeAll');
|
||||||
ensureIsFunctionOrAsync(beforeAllFunction, 'beforeAll');
|
ensureIsFunctionOrAsync(beforeAllFunction, 'beforeAll');
|
||||||
|
|
||||||
|
if (timeout) {
|
||||||
|
j$.util.validateTimeout(timeout);
|
||||||
|
}
|
||||||
|
|
||||||
currentDeclarationSuite.beforeAll({
|
currentDeclarationSuite.beforeAll({
|
||||||
fn: beforeAllFunction,
|
fn: beforeAllFunction,
|
||||||
timeout: timeout || 0
|
timeout: timeout || 0
|
||||||
@@ -1180,6 +1199,11 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
this.afterEach = function(afterEachFunction, timeout) {
|
this.afterEach = function(afterEachFunction, timeout) {
|
||||||
ensureIsNotNested('afterEach');
|
ensureIsNotNested('afterEach');
|
||||||
ensureIsFunctionOrAsync(afterEachFunction, 'afterEach');
|
ensureIsFunctionOrAsync(afterEachFunction, 'afterEach');
|
||||||
|
|
||||||
|
if (timeout) {
|
||||||
|
j$.util.validateTimeout(timeout);
|
||||||
|
}
|
||||||
|
|
||||||
afterEachFunction.isCleanup = true;
|
afterEachFunction.isCleanup = true;
|
||||||
currentDeclarationSuite.afterEach({
|
currentDeclarationSuite.afterEach({
|
||||||
fn: afterEachFunction,
|
fn: afterEachFunction,
|
||||||
@@ -1190,6 +1214,11 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
this.afterAll = function(afterAllFunction, timeout) {
|
this.afterAll = function(afterAllFunction, timeout) {
|
||||||
ensureIsNotNested('afterAll');
|
ensureIsNotNested('afterAll');
|
||||||
ensureIsFunctionOrAsync(afterAllFunction, 'afterAll');
|
ensureIsFunctionOrAsync(afterAllFunction, 'afterAll');
|
||||||
|
|
||||||
|
if (timeout) {
|
||||||
|
j$.util.validateTimeout(timeout);
|
||||||
|
}
|
||||||
|
|
||||||
currentDeclarationSuite.afterAll({
|
currentDeclarationSuite.afterAll({
|
||||||
fn: afterAllFunction,
|
fn: afterAllFunction,
|
||||||
timeout: timeout || 0
|
timeout: timeout || 0
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
* Maximum object depth the pretty printer will print to.
|
* Maximum object depth the pretty printer will print to.
|
||||||
* Set this to a lower value to speed up pretty printing if you have large objects.
|
* Set this to a lower value to speed up pretty printing if you have large objects.
|
||||||
* @name jasmine.MAX_PRETTY_PRINT_DEPTH
|
* @name jasmine.MAX_PRETTY_PRINT_DEPTH
|
||||||
|
* @default 8
|
||||||
* @since 1.3.0
|
* @since 1.3.0
|
||||||
*/
|
*/
|
||||||
j$.MAX_PRETTY_PRINT_DEPTH = 8;
|
j$.MAX_PRETTY_PRINT_DEPTH = 8;
|
||||||
@@ -15,6 +16,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
* This will also limit the number of keys and values displayed for an object.
|
* This will also limit the number of keys and values displayed for an object.
|
||||||
* Elements past this number will be ellipised.
|
* Elements past this number will be ellipised.
|
||||||
* @name jasmine.MAX_PRETTY_PRINT_ARRAY_LENGTH
|
* @name jasmine.MAX_PRETTY_PRINT_ARRAY_LENGTH
|
||||||
|
* @default 50
|
||||||
* @since 2.7.0
|
* @since 2.7.0
|
||||||
*/
|
*/
|
||||||
j$.MAX_PRETTY_PRINT_ARRAY_LENGTH = 50;
|
j$.MAX_PRETTY_PRINT_ARRAY_LENGTH = 50;
|
||||||
@@ -22,15 +24,35 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
* Maximum number of characters to display when pretty printing objects.
|
* Maximum number of characters to display when pretty printing objects.
|
||||||
* Characters past this number will be ellipised.
|
* Characters past this number will be ellipised.
|
||||||
* @name jasmine.MAX_PRETTY_PRINT_CHARS
|
* @name jasmine.MAX_PRETTY_PRINT_CHARS
|
||||||
|
* @default 100
|
||||||
* @since 2.9.0
|
* @since 2.9.0
|
||||||
*/
|
*/
|
||||||
j$.MAX_PRETTY_PRINT_CHARS = 1000;
|
j$.MAX_PRETTY_PRINT_CHARS = 1000;
|
||||||
/**
|
/**
|
||||||
* Default number of milliseconds Jasmine will wait for an asynchronous spec to complete.
|
* Default number of milliseconds Jasmine will wait for an asynchronous spec,
|
||||||
|
* before, or after function to complete. This can be overridden on a case by
|
||||||
|
* case basis by passing a time limit as the third argument to {@link it},
|
||||||
|
* {@link beforeEach}, {@link afterEach}, {@link beforeAll}, or
|
||||||
|
* {@link afterAll}. The value must be no greater than the largest number of
|
||||||
|
* milliseconds supported by setTimeout, which is usually 2147483647.
|
||||||
|
*
|
||||||
|
* While debugging tests, you may want to set this to a large number (or pass
|
||||||
|
* a large number to one of the functions mentioned above) so that Jasmine
|
||||||
|
* does not move on to after functions or the next spec while you're debugging.
|
||||||
* @name jasmine.DEFAULT_TIMEOUT_INTERVAL
|
* @name jasmine.DEFAULT_TIMEOUT_INTERVAL
|
||||||
|
* @default 5000
|
||||||
* @since 1.3.0
|
* @since 1.3.0
|
||||||
*/
|
*/
|
||||||
j$.DEFAULT_TIMEOUT_INTERVAL = 5000;
|
var DEFAULT_TIMEOUT_INTERVAL = 5000;
|
||||||
|
Object.defineProperty(j$, 'DEFAULT_TIMEOUT_INTERVAL', {
|
||||||
|
get: function() {
|
||||||
|
return DEFAULT_TIMEOUT_INTERVAL;
|
||||||
|
},
|
||||||
|
set: function(newValue) {
|
||||||
|
j$.util.validateTimeout(newValue, 'jasmine.DEFAULT_TIMEOUT_INTERVAL');
|
||||||
|
DEFAULT_TIMEOUT_INTERVAL = newValue;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
j$.getGlobal = function() {
|
j$.getGlobal = function() {
|
||||||
return jasmineGlobal;
|
return jasmineGlobal;
|
||||||
|
|||||||
@@ -127,5 +127,20 @@ getJasmineRequireObj().util = function(j$) {
|
|||||||
StopIteration.prototype = Object.create(Error.prototype);
|
StopIteration.prototype = Object.create(Error.prototype);
|
||||||
StopIteration.prototype.constructor = StopIteration;
|
StopIteration.prototype.constructor = StopIteration;
|
||||||
|
|
||||||
|
util.validateTimeout = function(timeout, msgPrefix) {
|
||||||
|
// Timeouts are implemented with setTimeout, which only supports a limited
|
||||||
|
// range of values. The limit is unspecified, as is the behavior when it's
|
||||||
|
// exceeded. But on all currently supported JS runtimes, setTimeout calls
|
||||||
|
// the callback immediately when the timeout is greater than 2147483647
|
||||||
|
// (the maximum value of a signed 32 bit integer).
|
||||||
|
var max = 2147483647;
|
||||||
|
|
||||||
|
if (timeout > max) {
|
||||||
|
throw new Error(
|
||||||
|
(msgPrefix || 'Timeout value') + ' cannot be greater than ' + max
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return util;
|
return util;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user