add prettier and eslint
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
getJasmineRequireObj().CallTracker = function(j$) {
|
||||
|
||||
/**
|
||||
* @namespace Spy#calls
|
||||
*/
|
||||
@@ -8,7 +7,7 @@ getJasmineRequireObj().CallTracker = function(j$) {
|
||||
var opts = {};
|
||||
|
||||
this.track = function(context) {
|
||||
if(opts.cloneArgs) {
|
||||
if (opts.cloneArgs) {
|
||||
context.args = j$.util.cloneArgs(context.args);
|
||||
}
|
||||
calls.push(context);
|
||||
@@ -64,7 +63,7 @@ getJasmineRequireObj().CallTracker = function(j$) {
|
||||
*/
|
||||
this.allArgs = function() {
|
||||
var callArgs = [];
|
||||
for(var i = 0; i < calls.length; i++) {
|
||||
for (var i = 0; i < calls.length; i++) {
|
||||
callArgs.push(calls[i].args);
|
||||
}
|
||||
|
||||
@@ -108,7 +107,6 @@ getJasmineRequireObj().CallTracker = function(j$) {
|
||||
this.saveArgumentsByValue = function() {
|
||||
opts.cloneArgs = true;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
return CallTracker;
|
||||
|
||||
@@ -3,8 +3,8 @@ getJasmineRequireObj().clearStack = function(j$) {
|
||||
|
||||
function messageChannelImpl(global, setTimeout) {
|
||||
var channel = new global.MessageChannel(),
|
||||
head = {},
|
||||
tail = head;
|
||||
head = {},
|
||||
tail = head;
|
||||
|
||||
var taskRunning = false;
|
||||
channel.port1.onmessage = function() {
|
||||
@@ -42,7 +42,7 @@ getJasmineRequireObj().clearStack = function(j$) {
|
||||
var currentCallCount = 0;
|
||||
var realSetTimeout = global.setTimeout;
|
||||
var setTimeoutImpl = function clearStack(fn) {
|
||||
Function.prototype.apply.apply(realSetTimeout, [global, [fn, 0]]);
|
||||
Function.prototype.apply.apply(realSetTimeout, [global, [fn, 0]]);
|
||||
};
|
||||
|
||||
if (j$.isFunction_(global.setImmediate)) {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
getJasmineRequireObj().Clock = function() {
|
||||
|
||||
/* global process */
|
||||
var NODE_JS = typeof process !== 'undefined' && process.versions && typeof process.versions.node === 'string';
|
||||
var NODE_JS =
|
||||
typeof process !== 'undefined' &&
|
||||
process.versions &&
|
||||
typeof process.versions.node === 'string';
|
||||
|
||||
/**
|
||||
* _Note:_ Do not construct this directly, Jasmine will make one during booting. You can get the current clock with {@link jasmine.clock}.
|
||||
@@ -35,8 +37,10 @@ getJasmineRequireObj().Clock = function() {
|
||||
* @return {Clock}
|
||||
*/
|
||||
self.install = function() {
|
||||
if(!originalTimingFunctionsIntact()) {
|
||||
throw new Error('Jasmine Clock was unable to install over custom global timer functions. Is the clock already installed?');
|
||||
if (!originalTimingFunctionsIntact()) {
|
||||
throw new Error(
|
||||
'Jasmine Clock was unable to install over custom global timer functions. Is the clock already installed?'
|
||||
);
|
||||
}
|
||||
replace(global, fakeTimingFunctions);
|
||||
timer = fakeTimingFunctions;
|
||||
@@ -88,11 +92,17 @@ getJasmineRequireObj().Clock = function() {
|
||||
};
|
||||
|
||||
self.setTimeout = function(fn, delay, params) {
|
||||
return Function.prototype.apply.apply(timer.setTimeout, [global, arguments]);
|
||||
return Function.prototype.apply.apply(timer.setTimeout, [
|
||||
global,
|
||||
arguments
|
||||
]);
|
||||
};
|
||||
|
||||
self.setInterval = function(fn, delay, params) {
|
||||
return Function.prototype.apply.apply(timer.setInterval, [global, arguments]);
|
||||
return Function.prototype.apply.apply(timer.setInterval, [
|
||||
global,
|
||||
arguments
|
||||
]);
|
||||
};
|
||||
|
||||
self.clearTimeout = function(id) {
|
||||
@@ -111,19 +121,25 @@ getJasmineRequireObj().Clock = function() {
|
||||
*/
|
||||
self.tick = function(millis) {
|
||||
if (installed) {
|
||||
delayedFunctionScheduler.tick(millis, function(millis) { mockDate.tick(millis); });
|
||||
delayedFunctionScheduler.tick(millis, function(millis) {
|
||||
mockDate.tick(millis);
|
||||
});
|
||||
} else {
|
||||
throw new Error('Mock clock is not installed, use jasmine.clock().install()');
|
||||
throw new Error(
|
||||
'Mock clock is not installed, use jasmine.clock().install()'
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
return self;
|
||||
|
||||
function originalTimingFunctionsIntact() {
|
||||
return global.setTimeout === realTimingFunctions.setTimeout &&
|
||||
return (
|
||||
global.setTimeout === realTimingFunctions.setTimeout &&
|
||||
global.clearTimeout === realTimingFunctions.clearTimeout &&
|
||||
global.setInterval === realTimingFunctions.setInterval &&
|
||||
global.clearInterval === realTimingFunctions.clearInterval;
|
||||
global.clearInterval === realTimingFunctions.clearInterval
|
||||
);
|
||||
}
|
||||
|
||||
function replace(dest, source) {
|
||||
@@ -134,12 +150,22 @@ getJasmineRequireObj().Clock = function() {
|
||||
|
||||
function setTimeout(fn, delay) {
|
||||
if (!NODE_JS) {
|
||||
return delayedFunctionScheduler.scheduleFunction(fn, delay, argSlice(arguments, 2));
|
||||
return delayedFunctionScheduler.scheduleFunction(
|
||||
fn,
|
||||
delay,
|
||||
argSlice(arguments, 2)
|
||||
);
|
||||
}
|
||||
|
||||
var timeout = new FakeTimeout();
|
||||
|
||||
delayedFunctionScheduler.scheduleFunction(fn, delay, argSlice(arguments, 2), false, timeout);
|
||||
delayedFunctionScheduler.scheduleFunction(
|
||||
fn,
|
||||
delay,
|
||||
argSlice(arguments, 2),
|
||||
false,
|
||||
timeout
|
||||
);
|
||||
|
||||
return timeout;
|
||||
}
|
||||
@@ -150,12 +176,23 @@ getJasmineRequireObj().Clock = function() {
|
||||
|
||||
function setInterval(fn, interval) {
|
||||
if (!NODE_JS) {
|
||||
return delayedFunctionScheduler.scheduleFunction(fn, interval, argSlice(arguments, 2), true);
|
||||
return delayedFunctionScheduler.scheduleFunction(
|
||||
fn,
|
||||
interval,
|
||||
argSlice(arguments, 2),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
var timeout = new FakeTimeout();
|
||||
|
||||
delayedFunctionScheduler.scheduleFunction(fn, interval, argSlice(arguments, 2), true, timeout);
|
||||
delayedFunctionScheduler.scheduleFunction(
|
||||
fn,
|
||||
interval,
|
||||
argSlice(arguments, 2),
|
||||
true,
|
||||
timeout
|
||||
);
|
||||
|
||||
return timeout;
|
||||
}
|
||||
@@ -174,11 +211,11 @@ getJasmineRequireObj().Clock = function() {
|
||||
*/
|
||||
function FakeTimeout() {}
|
||||
|
||||
FakeTimeout.prototype.ref = function () {
|
||||
FakeTimeout.prototype.ref = function() {
|
||||
return this;
|
||||
};
|
||||
|
||||
FakeTimeout.prototype.unref = function () {
|
||||
FakeTimeout.prototype.unref = function() {
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
@@ -15,11 +15,20 @@ getJasmineRequireObj().DelayedFunctionScheduler = function(j$) {
|
||||
currentTime = endTime;
|
||||
};
|
||||
|
||||
self.scheduleFunction = function(funcToCall, millis, params, recurring, timeoutKey, runAtMillis) {
|
||||
self.scheduleFunction = function(
|
||||
funcToCall,
|
||||
millis,
|
||||
params,
|
||||
recurring,
|
||||
timeoutKey,
|
||||
runAtMillis
|
||||
) {
|
||||
var f;
|
||||
if (typeof(funcToCall) === 'string') {
|
||||
if (typeof funcToCall === 'string') {
|
||||
/* jshint evil: true */
|
||||
f = function() { return eval(funcToCall); };
|
||||
f = function() {
|
||||
return eval(funcToCall);
|
||||
};
|
||||
/* jshint evil: false */
|
||||
} else {
|
||||
f = funcToCall;
|
||||
@@ -27,7 +36,7 @@ getJasmineRequireObj().DelayedFunctionScheduler = function(j$) {
|
||||
|
||||
millis = millis || 0;
|
||||
timeoutKey = timeoutKey || ++delayedFnCount;
|
||||
runAtMillis = runAtMillis || (currentTime + millis);
|
||||
runAtMillis = runAtMillis || currentTime + millis;
|
||||
|
||||
var funcToSchedule = {
|
||||
runAtMillis: runAtMillis,
|
||||
@@ -43,7 +52,7 @@ getJasmineRequireObj().DelayedFunctionScheduler = function(j$) {
|
||||
} else {
|
||||
scheduledFunctions[runAtMillis] = [funcToSchedule];
|
||||
scheduledLookup.push(runAtMillis);
|
||||
scheduledLookup.sort(function (a, b) {
|
||||
scheduledLookup.sort(function(a, b) {
|
||||
return a - b;
|
||||
});
|
||||
}
|
||||
@@ -56,7 +65,7 @@ getJasmineRequireObj().DelayedFunctionScheduler = function(j$) {
|
||||
|
||||
for (var runAtMillis in scheduledFunctions) {
|
||||
var funcs = scheduledFunctions[runAtMillis];
|
||||
var i = indexOfFirstToPass(funcs, function (func) {
|
||||
var i = indexOfFirstToPass(funcs, function(func) {
|
||||
return func.timeoutKey === timeoutKey;
|
||||
});
|
||||
|
||||
@@ -92,7 +101,7 @@ getJasmineRequireObj().DelayedFunctionScheduler = function(j$) {
|
||||
|
||||
function deleteFromLookup(key) {
|
||||
var value = Number(key);
|
||||
var i = indexOfFirstToPass(scheduledLookup, function (millis) {
|
||||
var i = indexOfFirstToPass(scheduledLookup, function(millis) {
|
||||
return millis === value;
|
||||
});
|
||||
|
||||
@@ -102,12 +111,14 @@ getJasmineRequireObj().DelayedFunctionScheduler = function(j$) {
|
||||
}
|
||||
|
||||
function reschedule(scheduledFn) {
|
||||
self.scheduleFunction(scheduledFn.funcToCall,
|
||||
self.scheduleFunction(
|
||||
scheduledFn.funcToCall,
|
||||
scheduledFn.millis,
|
||||
scheduledFn.params,
|
||||
true,
|
||||
scheduledFn.timeoutKey,
|
||||
scheduledFn.runAtMillis + scheduledFn.millis);
|
||||
scheduledFn.runAtMillis + scheduledFn.millis
|
||||
);
|
||||
}
|
||||
|
||||
function forEachFunction(funcsToRun, callback) {
|
||||
@@ -148,11 +159,13 @@ getJasmineRequireObj().DelayedFunctionScheduler = function(j$) {
|
||||
funcToRun.funcToCall.apply(null, funcToRun.params || []);
|
||||
});
|
||||
deletedKeys = [];
|
||||
} while (scheduledLookup.length > 0 &&
|
||||
// checking first if we're out of time prevents setTimeout(0)
|
||||
// scheduled in a funcToRun from forcing an extra iteration
|
||||
currentTime !== endTime &&
|
||||
scheduledLookup[0] <= endTime);
|
||||
} while (
|
||||
scheduledLookup.length > 0 &&
|
||||
// checking first if we're out of time prevents setTimeout(0)
|
||||
// scheduled in a funcToRun from forcing an extra iteration
|
||||
currentTime !== endTime &&
|
||||
scheduledLookup[0] <= endTime
|
||||
);
|
||||
|
||||
// ran out of functions to call, but still time left on the clock
|
||||
if (currentTime !== endTime) {
|
||||
|
||||
416
src/core/Env.js
416
src/core/Env.js
@@ -17,7 +17,13 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
var realSetTimeout = global.setTimeout;
|
||||
var realClearTimeout = global.clearTimeout;
|
||||
var clearStack = j$.getClearStack(global);
|
||||
this.clock = new j$.Clock(global, function () { return new j$.DelayedFunctionScheduler(); }, new j$.MockDate(global));
|
||||
this.clock = new j$.Clock(
|
||||
global,
|
||||
function() {
|
||||
return new j$.DelayedFunctionScheduler();
|
||||
},
|
||||
new j$.MockDate(global)
|
||||
);
|
||||
|
||||
var runnableResources = {};
|
||||
|
||||
@@ -110,7 +116,13 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
|
||||
if (!options.suppressLoadErrors) {
|
||||
installGlobalErrors();
|
||||
globalErrors.pushListener(function(message, filename, lineno, colNo, err) {
|
||||
globalErrors.pushListener(function(
|
||||
message,
|
||||
filename,
|
||||
lineno,
|
||||
colNo,
|
||||
err
|
||||
) {
|
||||
topSuite.result.failedExpectations.push({
|
||||
passed: false,
|
||||
globalErrorType: 'load',
|
||||
@@ -154,11 +166,15 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
}
|
||||
|
||||
if (configuration.hasOwnProperty('Promise')) {
|
||||
if (typeof configuration.Promise.resolve === 'function' &&
|
||||
typeof configuration.Promise.reject === 'function') {
|
||||
if (
|
||||
typeof configuration.Promise.resolve === 'function' &&
|
||||
typeof configuration.Promise.reject === 'function'
|
||||
) {
|
||||
customPromise = configuration.Promise;
|
||||
} else {
|
||||
throw new Error('Custom promise library missing `resolve`/`reject` functions');
|
||||
throw new Error(
|
||||
'Custom promise library missing `resolve`/`reject` functions'
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -179,34 +195,47 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
|
||||
Object.defineProperty(this, 'specFilter', {
|
||||
get: function() {
|
||||
self.deprecated('Getting specFilter directly from Env is deprecated and will be removed in a future version of Jasmine, please check the specFilter option from `configuration`');
|
||||
self.deprecated(
|
||||
'Getting specFilter directly from Env is deprecated and will be removed in a future version of Jasmine, please check the specFilter option from `configuration`'
|
||||
);
|
||||
return config.specFilter;
|
||||
},
|
||||
set: function(val) {
|
||||
self.deprecated('Setting specFilter directly on Env is deprecated and will be removed in a future version of Jasmine, please use the specFilter option in `configure`');
|
||||
self.deprecated(
|
||||
'Setting specFilter directly on Env is deprecated and will be removed in a future version of Jasmine, please use the specFilter option in `configure`'
|
||||
);
|
||||
config.specFilter = val;
|
||||
}
|
||||
});
|
||||
|
||||
this.addSpyStrategy = function(name, fn) {
|
||||
if(!currentRunnable()) {
|
||||
throw new Error('Custom spy strategies must be added in a before function or a spec');
|
||||
if (!currentRunnable()) {
|
||||
throw new Error(
|
||||
'Custom spy strategies must be added in a before function or a spec'
|
||||
);
|
||||
}
|
||||
runnableResources[currentRunnable().id].customSpyStrategies[name] = fn;
|
||||
};
|
||||
|
||||
this.addCustomEqualityTester = function(tester) {
|
||||
if(!currentRunnable()) {
|
||||
throw new Error('Custom Equalities must be added in a before function or a spec');
|
||||
if (!currentRunnable()) {
|
||||
throw new Error(
|
||||
'Custom Equalities must be added in a before function or a spec'
|
||||
);
|
||||
}
|
||||
runnableResources[currentRunnable().id].customEqualityTesters.push(tester);
|
||||
runnableResources[currentRunnable().id].customEqualityTesters.push(
|
||||
tester
|
||||
);
|
||||
};
|
||||
|
||||
this.addMatchers = function(matchersToAdd) {
|
||||
if(!currentRunnable()) {
|
||||
throw new Error('Matchers must be added in a before function or a spec');
|
||||
if (!currentRunnable()) {
|
||||
throw new Error(
|
||||
'Matchers must be added in a before function or a spec'
|
||||
);
|
||||
}
|
||||
var customMatchers = runnableResources[currentRunnable().id].customMatchers;
|
||||
var customMatchers =
|
||||
runnableResources[currentRunnable().id].customMatchers;
|
||||
for (var matcherName in matchersToAdd) {
|
||||
customMatchers[matcherName] = matchersToAdd[matcherName];
|
||||
}
|
||||
@@ -253,19 +282,28 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
};
|
||||
|
||||
var defaultResourcesForRunnable = function(id, parentRunnableId) {
|
||||
var resources = {spies: [], customEqualityTesters: [], customMatchers: {}, customSpyStrategies: {}};
|
||||
var resources = {
|
||||
spies: [],
|
||||
customEqualityTesters: [],
|
||||
customMatchers: {},
|
||||
customSpyStrategies: {}
|
||||
};
|
||||
|
||||
if(runnableResources[parentRunnableId]) {
|
||||
resources.customEqualityTesters = j$.util.clone(runnableResources[parentRunnableId].customEqualityTesters);
|
||||
resources.customMatchers = j$.util.clone(runnableResources[parentRunnableId].customMatchers);
|
||||
if (runnableResources[parentRunnableId]) {
|
||||
resources.customEqualityTesters = j$.util.clone(
|
||||
runnableResources[parentRunnableId].customEqualityTesters
|
||||
);
|
||||
resources.customMatchers = j$.util.clone(
|
||||
runnableResources[parentRunnableId].customMatchers
|
||||
);
|
||||
}
|
||||
|
||||
runnableResources[id] = resources;
|
||||
};
|
||||
|
||||
var clearResourcesForRunnable = function(id) {
|
||||
spyRegistry.clearSpies();
|
||||
delete runnableResources[id];
|
||||
spyRegistry.clearSpies();
|
||||
delete runnableResources[id];
|
||||
};
|
||||
|
||||
var beforeAndAfterFns = function(suite) {
|
||||
@@ -273,7 +311,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
var befores = [],
|
||||
afters = [];
|
||||
|
||||
while(suite) {
|
||||
while (suite) {
|
||||
befores = befores.concat(suite.beforeFns);
|
||||
afters = afters.concat(suite.afterFns);
|
||||
|
||||
@@ -289,7 +327,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
|
||||
var getSpecName = function(spec, suite) {
|
||||
var fullName = [spec.description],
|
||||
suiteFullName = suite.getFullName();
|
||||
suiteFullName = suite.getFullName();
|
||||
|
||||
if (suiteFullName !== '') {
|
||||
fullName.unshift(suiteFullName);
|
||||
@@ -299,13 +337,13 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
|
||||
// TODO: we may just be able to pass in the fn instead of wrapping here
|
||||
var buildExpectationResult = j$.buildExpectationResult,
|
||||
exceptionFormatter = new j$.ExceptionFormatter(),
|
||||
expectationResultFactory = function(attrs) {
|
||||
attrs.messageFormatter = exceptionFormatter.message;
|
||||
attrs.stackFormatter = exceptionFormatter.stack;
|
||||
exceptionFormatter = new j$.ExceptionFormatter(),
|
||||
expectationResultFactory = function(attrs) {
|
||||
attrs.messageFormatter = exceptionFormatter.message;
|
||||
attrs.stackFormatter = exceptionFormatter.stack;
|
||||
|
||||
return buildExpectationResult(attrs);
|
||||
};
|
||||
return buildExpectationResult(attrs);
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets whether Jasmine should throw an Error when an expectation fails.
|
||||
@@ -316,12 +354,16 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
* @deprecated Use the `oneFailurePerSpec` option with {@link Env#configure}
|
||||
*/
|
||||
this.throwOnExpectationFailure = function(value) {
|
||||
this.deprecated('Setting throwOnExpectationFailure directly on Env is deprecated and will be removed in a future version of Jasmine, please use the oneFailurePerSpec option in `configure`');
|
||||
this.configure({oneFailurePerSpec: !!value});
|
||||
this.deprecated(
|
||||
'Setting throwOnExpectationFailure directly on Env is deprecated and will be removed in a future version of Jasmine, please use the oneFailurePerSpec option in `configure`'
|
||||
);
|
||||
this.configure({ oneFailurePerSpec: !!value });
|
||||
};
|
||||
|
||||
this.throwingExpectationFailures = function() {
|
||||
this.deprecated('Getting throwingExpectationFailures directly from Env is deprecated and will be removed in a future version of Jasmine, please check the oneFailurePerSpec option from `configuration`');
|
||||
this.deprecated(
|
||||
'Getting throwingExpectationFailures directly from Env is deprecated and will be removed in a future version of Jasmine, please check the oneFailurePerSpec option from `configuration`'
|
||||
);
|
||||
return config.oneFailurePerSpec;
|
||||
};
|
||||
|
||||
@@ -333,12 +375,16 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
* @deprecated Use the `failFast` option with {@link Env#configure}
|
||||
*/
|
||||
this.stopOnSpecFailure = function(value) {
|
||||
this.deprecated('Setting stopOnSpecFailure directly is deprecated and will be removed in a future version of Jasmine, please use the failFast option in `configure`');
|
||||
this.configure({failFast: !!value});
|
||||
this.deprecated(
|
||||
'Setting stopOnSpecFailure directly is deprecated and will be removed in a future version of Jasmine, please use the failFast option in `configure`'
|
||||
);
|
||||
this.configure({ failFast: !!value });
|
||||
};
|
||||
|
||||
this.stoppingOnSpecFailure = function() {
|
||||
this.deprecated('Getting stoppingOnSpecFailure directly from Env is deprecated and will be removed in a future version of Jasmine, please check the failFast option from `configuration`');
|
||||
this.deprecated(
|
||||
'Getting stoppingOnSpecFailure directly from Env is deprecated and will be removed in a future version of Jasmine, please check the failFast option from `configuration`'
|
||||
);
|
||||
return config.failFast;
|
||||
};
|
||||
|
||||
@@ -350,12 +396,16 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
* @deprecated Use the `random` option with {@link Env#configure}
|
||||
*/
|
||||
this.randomizeTests = function(value) {
|
||||
this.deprecated('Setting randomizeTests directly is deprecated and will be removed in a future version of Jasmine, please use the random option in `configure`');
|
||||
this.deprecated(
|
||||
'Setting randomizeTests directly is deprecated and will be removed in a future version of Jasmine, please use the random option in `configure`'
|
||||
);
|
||||
config.random = !!value;
|
||||
};
|
||||
|
||||
this.randomTests = function() {
|
||||
this.deprecated('Getting randomTests directly from Env is deprecated and will be removed in a future version of Jasmine, please check the random option from `configuration`');
|
||||
this.deprecated(
|
||||
'Getting randomTests directly from Env is deprecated and will be removed in a future version of Jasmine, please check the random option from `configuration`'
|
||||
);
|
||||
return config.random;
|
||||
};
|
||||
|
||||
@@ -367,7 +417,9 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
* @deprecated Use the `seed` option with {@link Env#configure}
|
||||
*/
|
||||
this.seed = function(value) {
|
||||
this.deprecated('Setting seed directly is deprecated and will be removed in a future version of Jasmine, please use the seed option in `configure`');
|
||||
this.deprecated(
|
||||
'Setting seed directly is deprecated and will be removed in a future version of Jasmine, please use the seed option in `configure`'
|
||||
);
|
||||
if (value) {
|
||||
config.seed = value;
|
||||
}
|
||||
@@ -375,7 +427,9 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
};
|
||||
|
||||
this.hidingDisabled = function(value) {
|
||||
this.deprecated('Getting hidingDisabled directly from Env is deprecated and will be removed in a future version of Jasmine, please check the hideDisabled option from `configuration`');
|
||||
this.deprecated(
|
||||
'Getting hidingDisabled directly from Env is deprecated and will be removed in a future version of Jasmine, please check the hideDisabled option from `configuration`'
|
||||
);
|
||||
return config.hideDisabled;
|
||||
};
|
||||
|
||||
@@ -384,14 +438,19 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
* @function
|
||||
*/
|
||||
this.hideDisabled = function(value) {
|
||||
this.deprecated('Setting hideDisabled directly is deprecated and will be removed in a future version of Jasmine, please use the hideDisabled option in `configure`');
|
||||
this.deprecated(
|
||||
'Setting hideDisabled directly is deprecated and will be removed in a future version of Jasmine, please use the hideDisabled option in `configure`'
|
||||
);
|
||||
config.hideDisabled = !!value;
|
||||
};
|
||||
|
||||
this.deprecated = function(deprecation) {
|
||||
var runnable = currentRunnable() || topSuite;
|
||||
runnable.addDeprecationWarning(deprecation);
|
||||
if(typeof console !== 'undefined' && typeof console.error === 'function') {
|
||||
if (
|
||||
typeof console !== 'undefined' &&
|
||||
typeof console.error === 'function'
|
||||
) {
|
||||
console.error('DEPRECATION:', deprecation);
|
||||
}
|
||||
};
|
||||
@@ -404,13 +463,18 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
failFast = config.failFast;
|
||||
}
|
||||
options.clearStack = options.clearStack || clearStack;
|
||||
options.timeout = {setTimeout: realSetTimeout, clearTimeout: realClearTimeout};
|
||||
options.timeout = {
|
||||
setTimeout: realSetTimeout,
|
||||
clearTimeout: realClearTimeout
|
||||
};
|
||||
options.fail = self.fail;
|
||||
options.globalErrors = globalErrors;
|
||||
options.completeOnFirstError = failFast;
|
||||
options.onException = options.onException || function(e) {
|
||||
(currentRunnable() || topSuite).onException(e);
|
||||
};
|
||||
options.onException =
|
||||
options.onException ||
|
||||
function(e) {
|
||||
(currentRunnable() || topSuite).onException(e);
|
||||
};
|
||||
options.deprecated = self.deprecated;
|
||||
|
||||
new j$.QueueRunner(options).execute(args);
|
||||
@@ -436,78 +500,80 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
* @interface Reporter
|
||||
* @see custom_reporter
|
||||
*/
|
||||
var reporter = new j$.ReportDispatcher([
|
||||
/**
|
||||
* `jasmineStarted` is called after all of the specs have been loaded, but just before execution starts.
|
||||
* @function
|
||||
* @name Reporter#jasmineStarted
|
||||
* @param {JasmineStartedInfo} suiteInfo Information about the full Jasmine suite that is being run
|
||||
* @param {Function} [done] Used to specify to Jasmine that this callback is asynchronous and Jasmine should wait until it has been called before moving on.
|
||||
* @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion.
|
||||
* @see async
|
||||
*/
|
||||
'jasmineStarted',
|
||||
/**
|
||||
* When the entire suite has finished execution `jasmineDone` is called
|
||||
* @function
|
||||
* @name Reporter#jasmineDone
|
||||
* @param {JasmineDoneInfo} suiteInfo Information about the full Jasmine suite that just finished running.
|
||||
* @param {Function} [done] Used to specify to Jasmine that this callback is asynchronous and Jasmine should wait until it has been called before moving on.
|
||||
* @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion.
|
||||
* @see async
|
||||
*/
|
||||
'jasmineDone',
|
||||
/**
|
||||
* `suiteStarted` is invoked when a `describe` starts to run
|
||||
* @function
|
||||
* @name Reporter#suiteStarted
|
||||
* @param {SuiteResult} result Information about the individual {@link describe} being run
|
||||
* @param {Function} [done] Used to specify to Jasmine that this callback is asynchronous and Jasmine should wait until it has been called before moving on.
|
||||
* @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion.
|
||||
* @see async
|
||||
*/
|
||||
'suiteStarted',
|
||||
/**
|
||||
* `suiteDone` is invoked when all of the child specs and suites for a given suite have been run
|
||||
*
|
||||
* While jasmine doesn't require any specific functions, not defining a `suiteDone` will make it impossible for a reporter to know when a suite has failures in an `afterAll`.
|
||||
* @function
|
||||
* @name Reporter#suiteDone
|
||||
* @param {SuiteResult} result
|
||||
* @param {Function} [done] Used to specify to Jasmine that this callback is asynchronous and Jasmine should wait until it has been called before moving on.
|
||||
* @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion.
|
||||
* @see async
|
||||
*/
|
||||
'suiteDone',
|
||||
/**
|
||||
* `specStarted` is invoked when an `it` starts to run (including associated `beforeEach` functions)
|
||||
* @function
|
||||
* @name Reporter#specStarted
|
||||
* @param {SpecResult} result Information about the individual {@link it} being run
|
||||
* @param {Function} [done] Used to specify to Jasmine that this callback is asynchronous and Jasmine should wait until it has been called before moving on.
|
||||
* @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion.
|
||||
* @see async
|
||||
*/
|
||||
'specStarted',
|
||||
/**
|
||||
* `specDone` is invoked when an `it` and its associated `beforeEach` and `afterEach` functions have been run.
|
||||
*
|
||||
* While jasmine doesn't require any specific functions, not defining a `specDone` will make it impossible for a reporter to know when a spec has failed.
|
||||
* @function
|
||||
* @name Reporter#specDone
|
||||
* @param {SpecResult} result
|
||||
* @param {Function} [done] Used to specify to Jasmine that this callback is asynchronous and Jasmine should wait until it has been called before moving on.
|
||||
* @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion.
|
||||
* @see async
|
||||
*/
|
||||
'specDone'
|
||||
], queueRunnerFactory);
|
||||
var reporter = new j$.ReportDispatcher(
|
||||
[
|
||||
/**
|
||||
* `jasmineStarted` is called after all of the specs have been loaded, but just before execution starts.
|
||||
* @function
|
||||
* @name Reporter#jasmineStarted
|
||||
* @param {JasmineStartedInfo} suiteInfo Information about the full Jasmine suite that is being run
|
||||
* @param {Function} [done] Used to specify to Jasmine that this callback is asynchronous and Jasmine should wait until it has been called before moving on.
|
||||
* @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion.
|
||||
* @see async
|
||||
*/
|
||||
'jasmineStarted',
|
||||
/**
|
||||
* When the entire suite has finished execution `jasmineDone` is called
|
||||
* @function
|
||||
* @name Reporter#jasmineDone
|
||||
* @param {JasmineDoneInfo} suiteInfo Information about the full Jasmine suite that just finished running.
|
||||
* @param {Function} [done] Used to specify to Jasmine that this callback is asynchronous and Jasmine should wait until it has been called before moving on.
|
||||
* @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion.
|
||||
* @see async
|
||||
*/
|
||||
'jasmineDone',
|
||||
/**
|
||||
* `suiteStarted` is invoked when a `describe` starts to run
|
||||
* @function
|
||||
* @name Reporter#suiteStarted
|
||||
* @param {SuiteResult} result Information about the individual {@link describe} being run
|
||||
* @param {Function} [done] Used to specify to Jasmine that this callback is asynchronous and Jasmine should wait until it has been called before moving on.
|
||||
* @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion.
|
||||
* @see async
|
||||
*/
|
||||
'suiteStarted',
|
||||
/**
|
||||
* `suiteDone` is invoked when all of the child specs and suites for a given suite have been run
|
||||
*
|
||||
* While jasmine doesn't require any specific functions, not defining a `suiteDone` will make it impossible for a reporter to know when a suite has failures in an `afterAll`.
|
||||
* @function
|
||||
* @name Reporter#suiteDone
|
||||
* @param {SuiteResult} result
|
||||
* @param {Function} [done] Used to specify to Jasmine that this callback is asynchronous and Jasmine should wait until it has been called before moving on.
|
||||
* @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion.
|
||||
* @see async
|
||||
*/
|
||||
'suiteDone',
|
||||
/**
|
||||
* `specStarted` is invoked when an `it` starts to run (including associated `beforeEach` functions)
|
||||
* @function
|
||||
* @name Reporter#specStarted
|
||||
* @param {SpecResult} result Information about the individual {@link it} being run
|
||||
* @param {Function} [done] Used to specify to Jasmine that this callback is asynchronous and Jasmine should wait until it has been called before moving on.
|
||||
* @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion.
|
||||
* @see async
|
||||
*/
|
||||
'specStarted',
|
||||
/**
|
||||
* `specDone` is invoked when an `it` and its associated `beforeEach` and `afterEach` functions have been run.
|
||||
*
|
||||
* While jasmine doesn't require any specific functions, not defining a `specDone` will make it impossible for a reporter to know when a spec has failed.
|
||||
* @function
|
||||
* @name Reporter#specDone
|
||||
* @param {SpecResult} result
|
||||
* @param {Function} [done] Used to specify to Jasmine that this callback is asynchronous and Jasmine should wait until it has been called before moving on.
|
||||
* @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion.
|
||||
* @see async
|
||||
*/
|
||||
'specDone'
|
||||
],
|
||||
queueRunnerFactory
|
||||
);
|
||||
|
||||
this.execute = function(runnablesToRun) {
|
||||
var self = this;
|
||||
installGlobalErrors();
|
||||
|
||||
if(!runnablesToRun) {
|
||||
if (!runnablesToRun) {
|
||||
if (focusedRunnables.length) {
|
||||
runnablesToRun = focusedRunnables;
|
||||
} else {
|
||||
@@ -552,8 +618,10 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
}
|
||||
});
|
||||
|
||||
if(!processor.processTree().valid) {
|
||||
throw new Error('Invalid order: would cause a beforeAll or afterAll to be run multiple times');
|
||||
if (!processor.processTree().valid) {
|
||||
throw new Error(
|
||||
'Invalid order: would cause a beforeAll or afterAll to be run multiple times'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -562,47 +630,53 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
* @property {Int} totalSpecsDefined - The total number of specs defined in this suite.
|
||||
* @property {Order} order - Information about the ordering (random or not) of this execution of the suite.
|
||||
*/
|
||||
reporter.jasmineStarted({
|
||||
totalSpecsDefined: totalSpecsDefined,
|
||||
order: order
|
||||
}, function() {
|
||||
currentlyExecutingSuites.push(topSuite);
|
||||
reporter.jasmineStarted(
|
||||
{
|
||||
totalSpecsDefined: totalSpecsDefined,
|
||||
order: order
|
||||
},
|
||||
function() {
|
||||
currentlyExecutingSuites.push(topSuite);
|
||||
|
||||
processor.execute(function () {
|
||||
clearResourcesForRunnable(topSuite.id);
|
||||
currentlyExecutingSuites.pop();
|
||||
var overallStatus, incompleteReason;
|
||||
processor.execute(function() {
|
||||
clearResourcesForRunnable(topSuite.id);
|
||||
currentlyExecutingSuites.pop();
|
||||
var overallStatus, incompleteReason;
|
||||
|
||||
if (hasFailures || topSuite.result.failedExpectations.length > 0) {
|
||||
overallStatus = 'failed';
|
||||
} else if (focusedRunnables.length > 0) {
|
||||
overallStatus = 'incomplete';
|
||||
incompleteReason = 'fit() or fdescribe() was found';
|
||||
} else if (totalSpecsDefined === 0) {
|
||||
overallStatus = 'incomplete';
|
||||
incompleteReason = 'No specs found';
|
||||
} else {
|
||||
overallStatus = 'passed';
|
||||
}
|
||||
if (hasFailures || topSuite.result.failedExpectations.length > 0) {
|
||||
overallStatus = 'failed';
|
||||
} else if (focusedRunnables.length > 0) {
|
||||
overallStatus = 'incomplete';
|
||||
incompleteReason = 'fit() or fdescribe() was found';
|
||||
} else if (totalSpecsDefined === 0) {
|
||||
overallStatus = 'incomplete';
|
||||
incompleteReason = 'No specs found';
|
||||
} else {
|
||||
overallStatus = 'passed';
|
||||
}
|
||||
|
||||
/**
|
||||
* Information passed to the {@link Reporter#jasmineDone} event.
|
||||
* @typedef JasmineDoneInfo
|
||||
* @property {OverallStatus} overallStatus - The overall result of the suite: 'passed', 'failed', or 'incomplete'.
|
||||
* @property {IncompleteReason} incompleteReason - Explanation of why the suite was incomplete.
|
||||
* @property {Order} order - Information about the ordering (random or not) of this execution of the suite.
|
||||
* @property {Expectation[]} failedExpectations - List of expectations that failed in an {@link afterAll} at the global level.
|
||||
* @property {Expectation[]} deprecationWarnings - List of deprecation warnings that occurred at the global level.
|
||||
*/
|
||||
reporter.jasmineDone({
|
||||
overallStatus: overallStatus,
|
||||
incompleteReason: incompleteReason,
|
||||
order: order,
|
||||
failedExpectations: topSuite.result.failedExpectations,
|
||||
deprecationWarnings: topSuite.result.deprecationWarnings
|
||||
}, function() {});
|
||||
});
|
||||
});
|
||||
/**
|
||||
* Information passed to the {@link Reporter#jasmineDone} event.
|
||||
* @typedef JasmineDoneInfo
|
||||
* @property {OverallStatus} overallStatus - The overall result of the suite: 'passed', 'failed', or 'incomplete'.
|
||||
* @property {IncompleteReason} incompleteReason - Explanation of why the suite was incomplete.
|
||||
* @property {Order} order - Information about the ordering (random or not) of this execution of the suite.
|
||||
* @property {Expectation[]} failedExpectations - List of expectations that failed in an {@link afterAll} at the global level.
|
||||
* @property {Expectation[]} deprecationWarnings - List of deprecation warnings that occurred at the global level.
|
||||
*/
|
||||
reporter.jasmineDone(
|
||||
{
|
||||
overallStatus: overallStatus,
|
||||
incompleteReason: incompleteReason,
|
||||
order: order,
|
||||
failedExpectations: topSuite.result.failedExpectations,
|
||||
deprecationWarnings: topSuite.result.deprecationWarnings
|
||||
},
|
||||
function() {}
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -653,8 +727,10 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
|
||||
var spyRegistry = new j$.SpyRegistry({
|
||||
currentSpies: function() {
|
||||
if(!currentRunnable()) {
|
||||
throw new Error('Spies must be created in a before function or a spec');
|
||||
if (!currentRunnable()) {
|
||||
throw new Error(
|
||||
'Spies must be created in a before function or a spec'
|
||||
);
|
||||
}
|
||||
return runnableResources[currentRunnable().id].spies;
|
||||
},
|
||||
@@ -694,20 +770,26 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
|
||||
var ensureIsFunction = function(fn, caller) {
|
||||
if (!j$.isFunction_(fn)) {
|
||||
throw new Error(caller + ' expects a function argument; received ' + j$.getType_(fn));
|
||||
throw new Error(
|
||||
caller + ' expects a function argument; received ' + j$.getType_(fn)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
var ensureIsFunctionOrAsync = function(fn, caller) {
|
||||
if (!j$.isFunction_(fn) && !j$.isAsyncFunction_(fn)) {
|
||||
throw new Error(caller + ' expects a function argument; received ' + j$.getType_(fn));
|
||||
throw new Error(
|
||||
caller + ' expects a function argument; received ' + j$.getType_(fn)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
function ensureIsNotNested(method) {
|
||||
var runnable = currentRunnable();
|
||||
if (runnable !== null && runnable !== undefined) {
|
||||
throw new Error('\'' + method + '\' should only be used in \'describe\' function');
|
||||
throw new Error(
|
||||
"'" + method + "' should only be used in 'describe' function"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -821,7 +903,9 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
description: description,
|
||||
expectationResultFactory: expectationResultFactory,
|
||||
queueRunnerFactory: queueRunnerFactory,
|
||||
userContext: function() { return suite.clonedSharedUserContext(); },
|
||||
userContext: function() {
|
||||
return suite.clonedSharedUserContext();
|
||||
},
|
||||
queueableFn: {
|
||||
fn: fn,
|
||||
timeout: timeout || 0
|
||||
@@ -888,7 +972,9 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
|
||||
this.expect = function(actual) {
|
||||
if (!currentRunnable()) {
|
||||
throw new Error('\'expect\' was used when there was no current spec, this could be because an asynchronous test timed out');
|
||||
throw new Error(
|
||||
"'expect' was used when there was no current spec, this could be because an asynchronous test timed out"
|
||||
);
|
||||
}
|
||||
|
||||
return currentRunnable().expect(actual);
|
||||
@@ -896,7 +982,9 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
|
||||
this.expectAsync = function(actual) {
|
||||
if (!currentRunnable()) {
|
||||
throw new Error('\'expectAsync\' was used when there was no current spec, this could be because an asynchronous test timed out');
|
||||
throw new Error(
|
||||
"'expectAsync' was used when there was no current spec, this could be because an asynchronous test timed out"
|
||||
);
|
||||
}
|
||||
|
||||
return currentRunnable().expectAsync(actual);
|
||||
@@ -941,7 +1029,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
|
||||
this.pending = function(message) {
|
||||
var fullMessage = j$.Spec.pendingSpecExceptionMessage;
|
||||
if(message) {
|
||||
if (message) {
|
||||
fullMessage += message;
|
||||
}
|
||||
throw fullMessage;
|
||||
@@ -949,7 +1037,9 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
|
||||
this.fail = function(error) {
|
||||
if (!currentRunnable()) {
|
||||
throw new Error('\'fail\' was used when there was no current spec, this could be because an asynchronous test timed out');
|
||||
throw new Error(
|
||||
"'fail' was used when there was no current spec, this could be because an asynchronous test timed out"
|
||||
);
|
||||
}
|
||||
|
||||
var message = 'Failed';
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
getJasmineRequireObj().ExceptionFormatter = function(j$) {
|
||||
|
||||
var ignoredProperties = ['name', 'message', 'stack', 'fileName', 'sourceURL', 'line', 'lineNumber', 'column', 'description', 'jasmineMessage'];
|
||||
var ignoredProperties = [
|
||||
'name',
|
||||
'message',
|
||||
'stack',
|
||||
'fileName',
|
||||
'sourceURL',
|
||||
'line',
|
||||
'lineNumber',
|
||||
'column',
|
||||
'description',
|
||||
'jasmineMessage'
|
||||
];
|
||||
|
||||
function ExceptionFormatter(options) {
|
||||
var jasmineFile = (options && options.jasmineFile) || j$.util.jasmineFile();
|
||||
@@ -49,7 +59,8 @@ getJasmineRequireObj().ExceptionFormatter = function(j$) {
|
||||
|
||||
function filterJasmine(stackTrace) {
|
||||
var result = [],
|
||||
jasmineMarker = stackTrace.style === 'webkit' ? '<Jasmine>' : ' at <Jasmine>';
|
||||
jasmineMarker =
|
||||
stackTrace.style === 'webkit' ? '<Jasmine>' : ' at <Jasmine>';
|
||||
|
||||
stackTrace.frames.forEach(function(frame) {
|
||||
if (frame.file && frame.file !== jasmineFile) {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
getJasmineRequireObj().Expectation = function(j$) {
|
||||
var promiseForMessage = {
|
||||
jasmineToString: function() { return 'a promise'; }
|
||||
jasmineToString: function() {
|
||||
return 'a promise';
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -12,7 +14,10 @@ getJasmineRequireObj().Expectation = function(j$) {
|
||||
|
||||
var customMatchers = options.customMatchers || {};
|
||||
for (var matcherName in customMatchers) {
|
||||
this[matcherName] = wrapSyncCompare(matcherName, customMatchers[matcherName]);
|
||||
this[matcherName] = wrapSyncCompare(
|
||||
matcherName,
|
||||
customMatchers[matcherName]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +55,9 @@ getJasmineRequireObj().Expectation = function(j$) {
|
||||
this.expector = new j$.Expector(options);
|
||||
|
||||
if (!global.Promise) {
|
||||
throw new Error('expectAsync is unavailable because the environment does not support promises.');
|
||||
throw new Error(
|
||||
'expectAsync is unavailable because the environment does not support promises.'
|
||||
);
|
||||
}
|
||||
|
||||
if (!j$.isPromiseLike(this.expector.actual)) {
|
||||
@@ -100,9 +107,11 @@ getJasmineRequireObj().Expectation = function(j$) {
|
||||
// frames that are relevant to the user instead of just parts of Jasmine.
|
||||
var errorForStack = j$.util.errorWithStack();
|
||||
|
||||
return this.expector.compare(name, matcherFactory, arguments).then(function(result) {
|
||||
self.expector.processResult(result, errorForStack, promiseForMessage);
|
||||
});
|
||||
return this.expector
|
||||
.compare(name, matcherFactory, arguments)
|
||||
.then(function(result) {
|
||||
self.expector.processResult(result, errorForStack, promiseForMessage);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,12 @@ getJasmineRequireObj().ExpectationFilterChain = function() {
|
||||
return this.callFirst_('selectComparisonFunc', arguments).result;
|
||||
};
|
||||
|
||||
ExpectationFilterChain.prototype.buildFailureMessage = function(result, matcherName, args, util) {
|
||||
ExpectationFilterChain.prototype.buildFailureMessage = function(
|
||||
result,
|
||||
matcherName,
|
||||
args,
|
||||
util
|
||||
) {
|
||||
return this.callFirst_('buildFailureMessage', arguments).result;
|
||||
};
|
||||
|
||||
@@ -39,7 +44,7 @@ getJasmineRequireObj().ExpectationFilterChain = function() {
|
||||
};
|
||||
}
|
||||
|
||||
return {found: false};
|
||||
return { found: false };
|
||||
};
|
||||
|
||||
return ExpectationFilterChain;
|
||||
|
||||
@@ -20,7 +20,7 @@ getJasmineRequireObj().buildExpectationResult = function() {
|
||||
passed: options.passed
|
||||
};
|
||||
|
||||
if(!result.passed) {
|
||||
if (!result.passed) {
|
||||
result.expected = options.expected;
|
||||
result.actual = options.actual;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,11 @@ getJasmineRequireObj().Expector = function(j$) {
|
||||
this.filters = new j$.ExpectationFilterChain();
|
||||
}
|
||||
|
||||
Expector.prototype.instantiateMatcher = function(matcherName, matcherFactory, args) {
|
||||
Expector.prototype.instantiateMatcher = function(
|
||||
matcherName,
|
||||
matcherFactory,
|
||||
args
|
||||
) {
|
||||
this.matcherName = matcherName;
|
||||
this.args = Array.prototype.slice.call(args, 0);
|
||||
this.expected = this.args.slice(0);
|
||||
@@ -26,7 +30,13 @@ getJasmineRequireObj().Expector = function(j$) {
|
||||
return '';
|
||||
}
|
||||
|
||||
var msg = this.filters.buildFailureMessage(result, this.matcherName, this.args, this.util, defaultMessage);
|
||||
var msg = this.filters.buildFailureMessage(
|
||||
result,
|
||||
this.matcherName,
|
||||
this.args,
|
||||
this.util,
|
||||
defaultMessage
|
||||
);
|
||||
return this.filters.modifyFailureMessage(msg || defaultMessage());
|
||||
|
||||
function defaultMessage() {
|
||||
@@ -44,7 +54,11 @@ getJasmineRequireObj().Expector = function(j$) {
|
||||
};
|
||||
|
||||
Expector.prototype.compare = function(matcherName, matcherFactory, args) {
|
||||
var matcherCompare = this.instantiateMatcher(matcherName, matcherFactory, args);
|
||||
var matcherCompare = this.instantiateMatcher(
|
||||
matcherName,
|
||||
matcherFactory,
|
||||
args
|
||||
);
|
||||
return matcherCompare.apply(null, this.args);
|
||||
};
|
||||
|
||||
@@ -54,7 +68,11 @@ getJasmineRequireObj().Expector = function(j$) {
|
||||
return result;
|
||||
};
|
||||
|
||||
Expector.prototype.processResult = function(result, errorForStack, actualOverride) {
|
||||
Expector.prototype.processResult = function(
|
||||
result,
|
||||
errorForStack,
|
||||
actualOverride
|
||||
) {
|
||||
this.args[0] = actualOverride || this.args[0];
|
||||
var message = this.buildMessage(result);
|
||||
|
||||
@@ -62,18 +80,15 @@ getJasmineRequireObj().Expector = function(j$) {
|
||||
this.expected = this.expected[0];
|
||||
}
|
||||
|
||||
this.addExpectationResult(
|
||||
result.pass,
|
||||
{
|
||||
matcherName: this.matcherName,
|
||||
passed: result.pass,
|
||||
message: message,
|
||||
error: errorForStack ? undefined : result.error,
|
||||
errorForStack: errorForStack || undefined,
|
||||
actual: this.actual,
|
||||
expected: this.expected // TODO: this may need to be arrayified/sliced
|
||||
}
|
||||
);
|
||||
this.addExpectationResult(result.pass, {
|
||||
matcherName: this.matcherName,
|
||||
passed: result.pass,
|
||||
message: message,
|
||||
error: errorForStack ? undefined : result.error,
|
||||
errorForStack: errorForStack || undefined,
|
||||
actual: this.actual,
|
||||
expected: this.expected // TODO: this may need to be arrayified/sliced
|
||||
});
|
||||
};
|
||||
|
||||
return Expector;
|
||||
|
||||
@@ -38,7 +38,10 @@ getJasmineRequireObj().GlobalErrors = function(j$) {
|
||||
var errorTypes = Object.keys(this.originalHandlers);
|
||||
for (var iType = 0; iType < errorTypes.length; iType++) {
|
||||
var errorType = errorTypes[iType];
|
||||
global.process.removeListener(errorType, this.jasmineHandlers[errorType]);
|
||||
global.process.removeListener(
|
||||
errorType,
|
||||
this.jasmineHandlers[errorType]
|
||||
);
|
||||
for (var i = 0; i < this.originalHandlers[errorType].length; i++) {
|
||||
global.process.on(errorType, this.originalHandlers[errorType][i]);
|
||||
}
|
||||
@@ -49,7 +52,11 @@ getJasmineRequireObj().GlobalErrors = function(j$) {
|
||||
};
|
||||
|
||||
this.install = function install() {
|
||||
if (global.process && global.process.listeners && j$.isFunction_(global.process.on)) {
|
||||
if (
|
||||
global.process &&
|
||||
global.process.listeners &&
|
||||
j$.isFunction_(global.process.on)
|
||||
) {
|
||||
this.installOne_('uncaughtException', 'Uncaught exception');
|
||||
this.installOne_('unhandledRejection', 'Unhandled promise rejection');
|
||||
} else {
|
||||
|
||||
@@ -7,7 +7,7 @@ getJasmineRequireObj().JsApiReporter = function(j$) {
|
||||
*/
|
||||
function JsApiReporter(options) {
|
||||
var timer = options.timer || j$.noopTimer,
|
||||
status = 'loaded';
|
||||
status = 'loaded';
|
||||
|
||||
this.started = false;
|
||||
this.finished = false;
|
||||
@@ -117,7 +117,6 @@ getJasmineRequireObj().JsApiReporter = function(j$) {
|
||||
this.executionTime = function() {
|
||||
return executionTime;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
return JsApiReporter;
|
||||
|
||||
@@ -37,7 +37,7 @@ getJasmineRequireObj().MockDate = function() {
|
||||
return self;
|
||||
|
||||
function FakeDate() {
|
||||
switch(arguments.length) {
|
||||
switch (arguments.length) {
|
||||
case 0:
|
||||
return new GlobalDate(currentTime);
|
||||
case 1:
|
||||
@@ -47,16 +47,39 @@ getJasmineRequireObj().MockDate = function() {
|
||||
case 3:
|
||||
return new GlobalDate(arguments[0], arguments[1], arguments[2]);
|
||||
case 4:
|
||||
return new GlobalDate(arguments[0], arguments[1], arguments[2], arguments[3]);
|
||||
return new GlobalDate(
|
||||
arguments[0],
|
||||
arguments[1],
|
||||
arguments[2],
|
||||
arguments[3]
|
||||
);
|
||||
case 5:
|
||||
return new GlobalDate(arguments[0], arguments[1], arguments[2], arguments[3],
|
||||
arguments[4]);
|
||||
return new GlobalDate(
|
||||
arguments[0],
|
||||
arguments[1],
|
||||
arguments[2],
|
||||
arguments[3],
|
||||
arguments[4]
|
||||
);
|
||||
case 6:
|
||||
return new GlobalDate(arguments[0], arguments[1], arguments[2], arguments[3],
|
||||
arguments[4], arguments[5]);
|
||||
return new GlobalDate(
|
||||
arguments[0],
|
||||
arguments[1],
|
||||
arguments[2],
|
||||
arguments[3],
|
||||
arguments[4],
|
||||
arguments[5]
|
||||
);
|
||||
default:
|
||||
return new GlobalDate(arguments[0], arguments[1], arguments[2], arguments[3],
|
||||
arguments[4], arguments[5], arguments[6]);
|
||||
return new GlobalDate(
|
||||
arguments[0],
|
||||
arguments[1],
|
||||
arguments[2],
|
||||
arguments[3],
|
||||
arguments[4],
|
||||
arguments[5],
|
||||
arguments[6]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
getJasmineRequireObj().Order = function() {
|
||||
function Order(options) {
|
||||
this.random = 'random' in options ? options.random : true;
|
||||
var seed = this.seed = options.seed || generateSeed();
|
||||
var seed = (this.seed = options.seed || generateSeed());
|
||||
this.sort = this.random ? randomOrder : naturalOrder;
|
||||
|
||||
function naturalOrder(items) {
|
||||
@@ -29,17 +29,16 @@ getJasmineRequireObj().Order = function() {
|
||||
|
||||
function jenkinsHash(key) {
|
||||
var hash, i;
|
||||
for(hash = i = 0; i < key.length; ++i) {
|
||||
for (hash = i = 0; i < key.length; ++i) {
|
||||
hash += key.charCodeAt(i);
|
||||
hash += (hash << 10);
|
||||
hash ^= (hash >> 6);
|
||||
hash += hash << 10;
|
||||
hash ^= hash >> 6;
|
||||
}
|
||||
hash += (hash << 3);
|
||||
hash ^= (hash >> 11);
|
||||
hash += (hash << 15);
|
||||
hash += hash << 3;
|
||||
hash ^= hash >> 11;
|
||||
hash += hash << 15;
|
||||
return hash;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return Order;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
getJasmineRequireObj().pp = function(j$) {
|
||||
|
||||
function PrettyPrinter() {
|
||||
this.ppNestLevel_ = 0;
|
||||
this.seen = [];
|
||||
@@ -10,7 +9,11 @@ getJasmineRequireObj().pp = function(j$) {
|
||||
function hasCustomToString(value) {
|
||||
// value.toString !== Object.prototype.toString if value has no custom toString but is from another context (e.g.
|
||||
// iframe, web worker)
|
||||
return j$.isFunction_(value.toString) && value.toString !== Object.prototype.toString && (value.toString() !== Object.prototype.toString.call(value));
|
||||
return (
|
||||
j$.isFunction_(value.toString) &&
|
||||
value.toString !== Object.prototype.toString &&
|
||||
value.toString() !== Object.prototype.toString.call(value)
|
||||
);
|
||||
}
|
||||
|
||||
PrettyPrinter.prototype.format = function(value) {
|
||||
@@ -20,7 +23,7 @@ getJasmineRequireObj().pp = function(j$) {
|
||||
this.emitScalar('undefined');
|
||||
} else if (value === null) {
|
||||
this.emitScalar('null');
|
||||
} else if (value === 0 && 1/value === -Infinity) {
|
||||
} else if (value === 0 && 1 / value === -Infinity) {
|
||||
this.emitScalar('-0');
|
||||
} else if (value === j$.getGlobal()) {
|
||||
this.emitScalar('<global>');
|
||||
@@ -50,10 +53,19 @@ getJasmineRequireObj().pp = function(j$) {
|
||||
this.emitMap(value);
|
||||
} else if (j$.isTypedArray_(value)) {
|
||||
this.emitTypedArray(value);
|
||||
} else if (value.toString && typeof value === 'object' && !j$.isArray_(value) && hasCustomToString(value)) {
|
||||
} else if (
|
||||
value.toString &&
|
||||
typeof value === 'object' &&
|
||||
!j$.isArray_(value) &&
|
||||
hasCustomToString(value)
|
||||
) {
|
||||
this.emitScalar(value.toString());
|
||||
} else if (j$.util.arrayContains(this.seen, value)) {
|
||||
this.emitScalar('<circular reference: ' + (j$.isArray_(value) ? 'Array' : 'Object') + '>');
|
||||
this.emitScalar(
|
||||
'<circular reference: ' +
|
||||
(j$.isArray_(value) ? 'Array' : 'Object') +
|
||||
'>'
|
||||
);
|
||||
} else if (j$.isArray_(value) || j$.isA_('Object', value)) {
|
||||
this.seen.push(value);
|
||||
if (j$.isArray_(value)) {
|
||||
@@ -83,7 +95,6 @@ getJasmineRequireObj().pp = function(j$) {
|
||||
var getter = obj.__lookupGetter__(prop);
|
||||
return !j$.util.isUndefined(getter) && getter !== null;
|
||||
};
|
||||
|
||||
}
|
||||
var length = Math.min(objKeys.length, j$.MAX_PRETTY_PRINT_ARRAY_LENGTH);
|
||||
for (var i = 0; i < length; i++) {
|
||||
@@ -99,7 +110,7 @@ getJasmineRequireObj().pp = function(j$) {
|
||||
};
|
||||
|
||||
PrettyPrinter.prototype.emitString = function(value) {
|
||||
this.append('\'' + value + '\'');
|
||||
this.append("'" + value + "'");
|
||||
};
|
||||
|
||||
PrettyPrinter.prototype.emitArray = function(array) {
|
||||
@@ -115,7 +126,7 @@ getJasmineRequireObj().pp = function(j$) {
|
||||
}
|
||||
this.format(array[i]);
|
||||
}
|
||||
if(array.length > length) {
|
||||
if (array.length > length) {
|
||||
this.append(', ...');
|
||||
}
|
||||
|
||||
@@ -131,7 +142,9 @@ getJasmineRequireObj().pp = function(j$) {
|
||||
self.formatProperty(array, property, isGetter);
|
||||
});
|
||||
|
||||
if (truncated) { this.append(', ...'); }
|
||||
if (truncated) {
|
||||
this.append(', ...');
|
||||
}
|
||||
|
||||
this.append(' ]');
|
||||
};
|
||||
@@ -144,7 +157,7 @@ getJasmineRequireObj().pp = function(j$) {
|
||||
this.append('Set( ');
|
||||
var size = Math.min(set.size, j$.MAX_PRETTY_PRINT_ARRAY_LENGTH);
|
||||
var i = 0;
|
||||
set.forEach( function( value, key ) {
|
||||
set.forEach(function(value, key) {
|
||||
if (i >= size) {
|
||||
return;
|
||||
}
|
||||
@@ -154,7 +167,7 @@ getJasmineRequireObj().pp = function(j$) {
|
||||
this.format(value);
|
||||
|
||||
i++;
|
||||
}, this );
|
||||
}, this);
|
||||
if (set.size > size) {
|
||||
this.append(', ...');
|
||||
}
|
||||
@@ -169,17 +182,17 @@ getJasmineRequireObj().pp = function(j$) {
|
||||
this.append('Map( ');
|
||||
var size = Math.min(map.size, j$.MAX_PRETTY_PRINT_ARRAY_LENGTH);
|
||||
var i = 0;
|
||||
map.forEach( function( value, key ) {
|
||||
map.forEach(function(value, key) {
|
||||
if (i >= size) {
|
||||
return;
|
||||
}
|
||||
if (i > 0) {
|
||||
this.append(', ');
|
||||
}
|
||||
this.format([key,value]);
|
||||
this.format([key, value]);
|
||||
|
||||
i++;
|
||||
}, this );
|
||||
}, this);
|
||||
if (map.size > size) {
|
||||
this.append(', ...');
|
||||
}
|
||||
@@ -188,11 +201,12 @@ getJasmineRequireObj().pp = function(j$) {
|
||||
|
||||
PrettyPrinter.prototype.emitObject = function(obj) {
|
||||
var ctor = obj.constructor,
|
||||
constructorName;
|
||||
constructorName;
|
||||
|
||||
constructorName = typeof ctor === 'function' && obj instanceof ctor ?
|
||||
j$.fnNameFor(obj.constructor) :
|
||||
'null';
|
||||
constructorName =
|
||||
typeof ctor === 'function' && obj instanceof ctor
|
||||
? j$.fnNameFor(obj.constructor)
|
||||
: 'null';
|
||||
|
||||
this.append(constructorName);
|
||||
|
||||
@@ -214,14 +228,20 @@ getJasmineRequireObj().pp = function(j$) {
|
||||
self.formatProperty(obj, property, isGetter);
|
||||
});
|
||||
|
||||
if (truncated) { this.append(', ...'); }
|
||||
if (truncated) {
|
||||
this.append(', ...');
|
||||
}
|
||||
|
||||
this.append(' })');
|
||||
};
|
||||
|
||||
PrettyPrinter.prototype.emitTypedArray = function(arr) {
|
||||
var constructorName = j$.fnNameFor(arr.constructor),
|
||||
limitedArray = Array.prototype.slice.call(arr, 0, j$.MAX_PRETTY_PRINT_ARRAY_LENGTH),
|
||||
limitedArray = Array.prototype.slice.call(
|
||||
arr,
|
||||
0,
|
||||
j$.MAX_PRETTY_PRINT_ARRAY_LENGTH
|
||||
),
|
||||
itemsString = Array.prototype.join.call(limitedArray, ', ');
|
||||
|
||||
if (limitedArray.length !== arr.length) {
|
||||
@@ -258,13 +278,13 @@ getJasmineRequireObj().pp = function(j$) {
|
||||
};
|
||||
|
||||
PrettyPrinter.prototype.formatProperty = function(obj, property, isGetter) {
|
||||
this.append(property);
|
||||
this.append(': ');
|
||||
if (isGetter) {
|
||||
this.append('<getter>');
|
||||
} else {
|
||||
this.format(obj[property]);
|
||||
}
|
||||
this.append(property);
|
||||
this.append(': ');
|
||||
if (isGetter) {
|
||||
this.append('<getter>');
|
||||
} else {
|
||||
this.format(obj[property]);
|
||||
}
|
||||
};
|
||||
|
||||
PrettyPrinter.prototype.append = function(value) {
|
||||
@@ -283,7 +303,6 @@ getJasmineRequireObj().pp = function(j$) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function truncate(s, maxlen) {
|
||||
if (s.length <= maxlen) {
|
||||
return { value: s, truncated: false };
|
||||
@@ -294,30 +313,33 @@ getJasmineRequireObj().pp = function(j$) {
|
||||
}
|
||||
|
||||
function MaxCharsReachedError() {
|
||||
this.message = 'Exceeded ' + j$.MAX_PRETTY_PRINT_CHARS +
|
||||
this.message =
|
||||
'Exceeded ' +
|
||||
j$.MAX_PRETTY_PRINT_CHARS +
|
||||
' characters while pretty-printing a value';
|
||||
}
|
||||
|
||||
MaxCharsReachedError.prototype = new Error();
|
||||
|
||||
function keys(obj, isArray) {
|
||||
var allKeys = Object.keys ? Object.keys(obj) :
|
||||
(function(o) {
|
||||
var allKeys = Object.keys
|
||||
? Object.keys(obj)
|
||||
: (function(o) {
|
||||
var keys = [];
|
||||
for (var key in o) {
|
||||
if (j$.util.has(o, key)) {
|
||||
keys.push(key);
|
||||
}
|
||||
if (j$.util.has(o, key)) {
|
||||
keys.push(key);
|
||||
}
|
||||
}
|
||||
return keys;
|
||||
})(obj);
|
||||
})(obj);
|
||||
|
||||
if (!isArray) {
|
||||
return allKeys;
|
||||
}
|
||||
|
||||
if (allKeys.length === 0) {
|
||||
return allKeys;
|
||||
return allKeys;
|
||||
}
|
||||
|
||||
var extraKeys = [];
|
||||
|
||||
@@ -22,16 +22,26 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
||||
this.queueableFns = queueableFns.concat(attrs.cleanupFns || []);
|
||||
this.firstCleanupIx = queueableFns.length;
|
||||
this.onComplete = attrs.onComplete || emptyFn;
|
||||
this.clearStack = attrs.clearStack || function(fn) { fn(); };
|
||||
this.clearStack =
|
||||
attrs.clearStack ||
|
||||
function(fn) {
|
||||
fn();
|
||||
};
|
||||
this.onException = attrs.onException || emptyFn;
|
||||
this.userContext = attrs.userContext || new j$.UserContext();
|
||||
this.timeout = attrs.timeout || {setTimeout: setTimeout, clearTimeout: clearTimeout};
|
||||
this.timeout = attrs.timeout || {
|
||||
setTimeout: setTimeout,
|
||||
clearTimeout: clearTimeout
|
||||
};
|
||||
this.fail = attrs.fail || emptyFn;
|
||||
this.globalErrors = attrs.globalErrors || { pushListener: emptyFn, popListener: emptyFn };
|
||||
this.globalErrors = attrs.globalErrors || {
|
||||
pushListener: emptyFn,
|
||||
popListener: emptyFn
|
||||
};
|
||||
this.completeOnFirstError = !!attrs.completeOnFirstError;
|
||||
this.errored = false;
|
||||
|
||||
if (typeof(this.onComplete) !== 'function') {
|
||||
if (typeof this.onComplete !== 'function') {
|
||||
throw new Error('invalid onComplete ' + JSON.stringify(this.onComplete));
|
||||
}
|
||||
this.deprecated = attrs.deprecated;
|
||||
@@ -55,15 +65,22 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
||||
};
|
||||
|
||||
QueueRunner.prototype.clearTimeout = function(timeoutId) {
|
||||
Function.prototype.apply.apply(this.timeout.clearTimeout, [j$.getGlobal(), [timeoutId]]);
|
||||
Function.prototype.apply.apply(this.timeout.clearTimeout, [
|
||||
j$.getGlobal(),
|
||||
[timeoutId]
|
||||
]);
|
||||
};
|
||||
|
||||
QueueRunner.prototype.setTimeout = function(fn, timeout) {
|
||||
return Function.prototype.apply.apply(this.timeout.setTimeout, [j$.getGlobal(), [fn, timeout]]);
|
||||
return Function.prototype.apply.apply(this.timeout.setTimeout, [
|
||||
j$.getGlobal(),
|
||||
[fn, timeout]
|
||||
]);
|
||||
};
|
||||
|
||||
QueueRunner.prototype.attempt = function attempt(iterativeIndex) {
|
||||
var self = this, completedSynchronously = true,
|
||||
var self = this,
|
||||
completedSynchronously = true,
|
||||
handleError = function handleError(error) {
|
||||
onException(error);
|
||||
next(error);
|
||||
@@ -114,8 +131,12 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
||||
var timeoutInterval = queueableFn.timeout || j$.DEFAULT_TIMEOUT_INTERVAL;
|
||||
timeoutId = self.setTimeout(function() {
|
||||
var error = new Error(
|
||||
'Timeout - Async callback was not invoked within ' + timeoutInterval + 'ms ' +
|
||||
(queueableFn.timeout ? '(custom timeout)' : '(set by jasmine.DEFAULT_TIMEOUT_INTERVAL)')
|
||||
'Timeout - Async callback was not invoked within ' +
|
||||
timeoutInterval +
|
||||
'ms ' +
|
||||
(queueableFn.timeout
|
||||
? '(custom timeout)'
|
||||
: '(set by jasmine.DEFAULT_TIMEOUT_INTERVAL)')
|
||||
);
|
||||
onException(error);
|
||||
next();
|
||||
@@ -160,8 +181,11 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
||||
self = this,
|
||||
iterativeIndex;
|
||||
|
||||
|
||||
for(iterativeIndex = recursiveIndex; iterativeIndex < length; iterativeIndex++) {
|
||||
for (
|
||||
iterativeIndex = recursiveIndex;
|
||||
iterativeIndex < length;
|
||||
iterativeIndex++
|
||||
) {
|
||||
var result = this.attempt(iterativeIndex);
|
||||
|
||||
if (!result.completedSynchronously) {
|
||||
@@ -180,7 +204,6 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
||||
self.globalErrors.popListener(self.handleFinalError);
|
||||
self.onComplete(self.errored && new StopExecutionError());
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
return QueueRunner;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
getJasmineRequireObj().ReportDispatcher = function(j$) {
|
||||
function ReportDispatcher(methods, queueRunnerFactory) {
|
||||
|
||||
var dispatchedMethods = methods || [];
|
||||
|
||||
for (var i = 0; i < dispatchedMethods.length; i++) {
|
||||
@@ -9,7 +8,7 @@ getJasmineRequireObj().ReportDispatcher = function(j$) {
|
||||
return function() {
|
||||
dispatch(m, arguments);
|
||||
};
|
||||
}(method));
|
||||
})(method);
|
||||
}
|
||||
|
||||
var reporters = [];
|
||||
@@ -31,7 +30,7 @@ getJasmineRequireObj().ReportDispatcher = function(j$) {
|
||||
|
||||
function dispatch(method, args) {
|
||||
if (reporters.length === 0 && fallbackReporter !== null) {
|
||||
reporters.push(fallbackReporter);
|
||||
reporters.push(fallbackReporter);
|
||||
}
|
||||
var onComplete = args[args.length - 1];
|
||||
args = j$.util.argsToArray(args).splice(0, args.length - 1);
|
||||
@@ -57,13 +56,13 @@ getJasmineRequireObj().ReportDispatcher = function(j$) {
|
||||
var thisArgs = j$.util.cloneArgs(args);
|
||||
if (fn.length <= 1) {
|
||||
fns.push({
|
||||
fn: function () {
|
||||
fn: function() {
|
||||
return fn.apply(reporter, thisArgs);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
fns.push({
|
||||
fn: function (done) {
|
||||
fn: function(done) {
|
||||
return fn.apply(reporter, thisArgs.concat([done]));
|
||||
}
|
||||
});
|
||||
@@ -73,4 +72,3 @@ getJasmineRequireObj().ReportDispatcher = function(j$) {
|
||||
|
||||
return ReportDispatcher;
|
||||
};
|
||||
|
||||
|
||||
@@ -6,13 +6,30 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
this.id = attrs.id;
|
||||
this.description = attrs.description || '';
|
||||
this.queueableFn = attrs.queueableFn;
|
||||
this.beforeAndAfterFns = attrs.beforeAndAfterFns || function() { return {befores: [], afters: []}; };
|
||||
this.userContext = attrs.userContext || function() { return {}; };
|
||||
this.beforeAndAfterFns =
|
||||
attrs.beforeAndAfterFns ||
|
||||
function() {
|
||||
return { befores: [], afters: [] };
|
||||
};
|
||||
this.userContext =
|
||||
attrs.userContext ||
|
||||
function() {
|
||||
return {};
|
||||
};
|
||||
this.onStart = attrs.onStart || function() {};
|
||||
this.getSpecName = attrs.getSpecName || function() { return ''; };
|
||||
this.expectationResultFactory = attrs.expectationResultFactory || function() { };
|
||||
this.getSpecName =
|
||||
attrs.getSpecName ||
|
||||
function() {
|
||||
return '';
|
||||
};
|
||||
this.expectationResultFactory =
|
||||
attrs.expectationResultFactory || function() {};
|
||||
this.queueRunnerFactory = attrs.queueRunnerFactory || function() {};
|
||||
this.catchingExceptions = attrs.catchingExceptions || function() { return true; };
|
||||
this.catchingExceptions =
|
||||
attrs.catchingExceptions ||
|
||||
function() {
|
||||
return true;
|
||||
};
|
||||
this.throwOnExpectationFailure = !!attrs.throwOnExpectationFailure;
|
||||
this.timer = attrs.timer || j$.noopTimer;
|
||||
|
||||
@@ -90,12 +107,15 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
isLeaf: true,
|
||||
queueableFns: regularFns,
|
||||
cleanupFns: fns.afters,
|
||||
onException: function () {
|
||||
onException: function() {
|
||||
self.onException.apply(self, arguments);
|
||||
},
|
||||
onComplete: function() {
|
||||
self.result.duration = self.timer.elapsed();
|
||||
onComplete(self.result.status === 'failed' && new j$.StopExecutionError('spec failed'));
|
||||
onComplete(
|
||||
self.result.status === 'failed' &&
|
||||
new j$.StopExecutionError('spec failed')
|
||||
);
|
||||
},
|
||||
userContext: this.userContext()
|
||||
};
|
||||
@@ -121,13 +141,17 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.addExpectationResult(false, {
|
||||
matcherName: '',
|
||||
passed: false,
|
||||
expected: '',
|
||||
actual: '',
|
||||
error: e
|
||||
}, true);
|
||||
this.addExpectationResult(
|
||||
false,
|
||||
{
|
||||
matcherName: '',
|
||||
passed: false,
|
||||
expected: '',
|
||||
actual: '',
|
||||
error: e
|
||||
},
|
||||
true
|
||||
);
|
||||
};
|
||||
|
||||
Spec.prototype.pend = function(message) {
|
||||
@@ -166,13 +190,16 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
if (typeof deprecation === 'string') {
|
||||
deprecation = { message: deprecation };
|
||||
}
|
||||
this.result.deprecationWarnings.push(this.expectationResultFactory(deprecation));
|
||||
this.result.deprecationWarnings.push(
|
||||
this.expectationResultFactory(deprecation)
|
||||
);
|
||||
};
|
||||
|
||||
var extractCustomPendingMessage = function(e) {
|
||||
var fullMessage = e.toString(),
|
||||
boilerplateStart = fullMessage.indexOf(Spec.pendingSpecExceptionMessage),
|
||||
boilerplateEnd = boilerplateStart + Spec.pendingSpecExceptionMessage.length;
|
||||
boilerplateStart = fullMessage.indexOf(Spec.pendingSpecExceptionMessage),
|
||||
boilerplateEnd =
|
||||
boilerplateStart + Spec.pendingSpecExceptionMessage.length;
|
||||
|
||||
return fullMessage.substr(boilerplateEnd);
|
||||
};
|
||||
@@ -180,7 +207,11 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
Spec.pendingSpecExceptionMessage = '=> marked Pending';
|
||||
|
||||
Spec.isPendingSpecException = function(e) {
|
||||
return !!(e && e.toString && e.toString().indexOf(Spec.pendingSpecExceptionMessage) !== -1);
|
||||
return !!(
|
||||
e &&
|
||||
e.toString &&
|
||||
e.toString().indexOf(Spec.pendingSpecExceptionMessage) !== -1
|
||||
);
|
||||
};
|
||||
|
||||
return Spec;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
getJasmineRequireObj().Spy = function (j$) {
|
||||
|
||||
getJasmineRequireObj().Spy = function(j$) {
|
||||
var nextOrder = (function() {
|
||||
var order = 0;
|
||||
|
||||
@@ -14,21 +13,21 @@ getJasmineRequireObj().Spy = function (j$) {
|
||||
* @name Spy
|
||||
*/
|
||||
function Spy(name, originalFn, customStrategies, getPromise) {
|
||||
var numArgs = (typeof originalFn === 'function' ? originalFn.length : 0),
|
||||
wrapper = makeFunc(numArgs, function () {
|
||||
var numArgs = typeof originalFn === 'function' ? originalFn.length : 0,
|
||||
wrapper = makeFunc(numArgs, function() {
|
||||
return spy.apply(this, Array.prototype.slice.call(arguments));
|
||||
}),
|
||||
strategyDispatcher = new SpyStrategyDispatcher({
|
||||
name: name,
|
||||
fn: originalFn,
|
||||
getSpy: function () {
|
||||
getSpy: function() {
|
||||
return wrapper;
|
||||
},
|
||||
customStrategies: customStrategies,
|
||||
getPromise: getPromise
|
||||
}),
|
||||
callTracker = new j$.CallTracker(),
|
||||
spy = function () {
|
||||
spy = function() {
|
||||
/**
|
||||
* @name Spy.callData
|
||||
* @property {object} object - `this` context for the invocation.
|
||||
@@ -50,22 +49,54 @@ getJasmineRequireObj().Spy = function (j$) {
|
||||
|
||||
function makeFunc(length, fn) {
|
||||
switch (length) {
|
||||
case 1 : return function (a) { return fn.apply(this, arguments); };
|
||||
case 2 : return function (a,b) { return fn.apply(this, arguments); };
|
||||
case 3 : return function (a,b,c) { return fn.apply(this, arguments); };
|
||||
case 4 : return function (a,b,c,d) { return fn.apply(this, arguments); };
|
||||
case 5 : return function (a,b,c,d,e) { return fn.apply(this, arguments); };
|
||||
case 6 : return function (a,b,c,d,e,f) { return fn.apply(this, arguments); };
|
||||
case 7 : return function (a,b,c,d,e,f,g) { return fn.apply(this, arguments); };
|
||||
case 8 : return function (a,b,c,d,e,f,g,h) { return fn.apply(this, arguments); };
|
||||
case 9 : return function (a,b,c,d,e,f,g,h,i) { return fn.apply(this, arguments); };
|
||||
default : return function () { return fn.apply(this, arguments); };
|
||||
case 1:
|
||||
return function(a) {
|
||||
return fn.apply(this, arguments);
|
||||
};
|
||||
case 2:
|
||||
return function(a, b) {
|
||||
return fn.apply(this, arguments);
|
||||
};
|
||||
case 3:
|
||||
return function(a, b, c) {
|
||||
return fn.apply(this, arguments);
|
||||
};
|
||||
case 4:
|
||||
return function(a, b, c, d) {
|
||||
return fn.apply(this, arguments);
|
||||
};
|
||||
case 5:
|
||||
return function(a, b, c, d, e) {
|
||||
return fn.apply(this, arguments);
|
||||
};
|
||||
case 6:
|
||||
return function(a, b, c, d, e, f) {
|
||||
return fn.apply(this, arguments);
|
||||
};
|
||||
case 7:
|
||||
return function(a, b, c, d, e, f, g) {
|
||||
return fn.apply(this, arguments);
|
||||
};
|
||||
case 8:
|
||||
return function(a, b, c, d, e, f, g, h) {
|
||||
return fn.apply(this, arguments);
|
||||
};
|
||||
case 9:
|
||||
return function(a, b, c, d, e, f, g, h, i) {
|
||||
return fn.apply(this, arguments);
|
||||
};
|
||||
default:
|
||||
return function() {
|
||||
return fn.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
for (var prop in originalFn) {
|
||||
if (prop === 'and' || prop === 'calls') {
|
||||
throw new Error('Jasmine spies would overwrite the \'and\' and \'calls\' properties on the object being spied upon');
|
||||
throw new Error(
|
||||
"Jasmine spies would overwrite the 'and' and 'calls' properties on the object being spied upon"
|
||||
);
|
||||
}
|
||||
|
||||
wrapper[prop] = originalFn[prop];
|
||||
@@ -112,7 +143,13 @@ getJasmineRequireObj().Spy = function (j$) {
|
||||
|
||||
if (!strategy) {
|
||||
if (argsStrategies.any() && !baseStrategy.isConfigured()) {
|
||||
throw new Error('Spy \'' + strategyArgs.name + '\' received a call with arguments ' + j$.pp(Array.prototype.slice.call(args)) + ' but all configured strategies specify other arguments.');
|
||||
throw new Error(
|
||||
"Spy '" +
|
||||
strategyArgs.name +
|
||||
"' received a call with arguments " +
|
||||
j$.pp(Array.prototype.slice.call(args)) +
|
||||
' but all configured strategies specify other arguments.'
|
||||
);
|
||||
} else {
|
||||
strategy = baseStrategy;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
getJasmineRequireObj().SpyFactory = function(j$) {
|
||||
|
||||
function SpyFactory(getCustomStrategies, getPromise) {
|
||||
var self = this;
|
||||
|
||||
@@ -8,7 +7,8 @@ getJasmineRequireObj().SpyFactory = function(j$) {
|
||||
};
|
||||
|
||||
this.createSpyObj = function(baseName, methodNames) {
|
||||
var baseNameIsCollection = j$.isObject_(baseName) || j$.isArray_(baseName);
|
||||
var baseNameIsCollection =
|
||||
j$.isObject_(baseName) || j$.isArray_(baseName);
|
||||
|
||||
if (baseNameIsCollection && j$.util.isUndefined(methodNames)) {
|
||||
methodNames = baseName;
|
||||
|
||||
@@ -1,13 +1,19 @@
|
||||
getJasmineRequireObj().SpyRegistry = function(j$) {
|
||||
|
||||
var spyOnMsg = j$.formatErrorMsg('<spyOn>', 'spyOn(<object>, <methodName>)');
|
||||
var spyOnPropertyMsg = j$.formatErrorMsg('<spyOnProperty>', 'spyOnProperty(<object>, <propName>, [accessType])');
|
||||
var spyOnPropertyMsg = j$.formatErrorMsg(
|
||||
'<spyOnProperty>',
|
||||
'spyOnProperty(<object>, <propName>, [accessType])'
|
||||
);
|
||||
|
||||
function SpyRegistry(options) {
|
||||
options = options || {};
|
||||
var global = options.global || j$.getGlobal();
|
||||
var createSpy = options.createSpy;
|
||||
var currentSpies = options.currentSpies || function() { return []; };
|
||||
var currentSpies =
|
||||
options.currentSpies ||
|
||||
function() {
|
||||
return [];
|
||||
};
|
||||
|
||||
this.allowRespy = function(allow) {
|
||||
this.respy = allow;
|
||||
@@ -17,7 +23,11 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
|
||||
var getErrorMsg = spyOnMsg;
|
||||
|
||||
if (j$.util.isUndefined(obj) || obj === null) {
|
||||
throw new Error(getErrorMsg('could not find an object to spy upon for ' + methodName + '()'));
|
||||
throw new Error(
|
||||
getErrorMsg(
|
||||
'could not find an object to spy upon for ' + methodName + '()'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (j$.util.isUndefined(methodName) || methodName === null) {
|
||||
@@ -28,25 +38,32 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
|
||||
throw new Error(getErrorMsg(methodName + '() method does not exist'));
|
||||
}
|
||||
|
||||
if (obj[methodName] && j$.isSpy(obj[methodName]) ) {
|
||||
if (obj[methodName] && j$.isSpy(obj[methodName])) {
|
||||
if (this.respy) {
|
||||
return obj[methodName];
|
||||
}else {
|
||||
throw new Error(getErrorMsg(methodName + ' has already been spied upon'));
|
||||
} else {
|
||||
throw new Error(
|
||||
getErrorMsg(methodName + ' has already been spied upon')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
var descriptor = Object.getOwnPropertyDescriptor(obj, methodName);
|
||||
|
||||
if (descriptor && !(descriptor.writable || descriptor.set)) {
|
||||
throw new Error(getErrorMsg(methodName + ' is not declared writable or has no setter'));
|
||||
throw new Error(
|
||||
getErrorMsg(methodName + ' is not declared writable or has no setter')
|
||||
);
|
||||
}
|
||||
|
||||
var originalMethod = obj[methodName],
|
||||
spiedMethod = createSpy(methodName, originalMethod),
|
||||
restoreStrategy;
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(obj, methodName) || (obj === global && methodName === 'onerror')) {
|
||||
if (
|
||||
Object.prototype.hasOwnProperty.call(obj, methodName) ||
|
||||
(obj === global && methodName === 'onerror')
|
||||
) {
|
||||
restoreStrategy = function() {
|
||||
obj[methodName] = originalMethod;
|
||||
};
|
||||
@@ -67,13 +84,19 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
|
||||
return spiedMethod;
|
||||
};
|
||||
|
||||
this.spyOnProperty = function (obj, propertyName, accessType) {
|
||||
this.spyOnProperty = function(obj, propertyName, accessType) {
|
||||
var getErrorMsg = spyOnPropertyMsg;
|
||||
|
||||
accessType = accessType || 'get';
|
||||
|
||||
if (j$.util.isUndefined(obj)) {
|
||||
throw new Error(getErrorMsg('spyOn could not find an object to spy upon for ' + propertyName + ''));
|
||||
throw new Error(
|
||||
getErrorMsg(
|
||||
'spyOn could not find an object to spy upon for ' +
|
||||
propertyName +
|
||||
''
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (j$.util.isUndefined(propertyName)) {
|
||||
@@ -87,18 +110,31 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
|
||||
}
|
||||
|
||||
if (!descriptor.configurable) {
|
||||
throw new Error(getErrorMsg(propertyName + ' is not declared configurable'));
|
||||
throw new Error(
|
||||
getErrorMsg(propertyName + ' is not declared configurable')
|
||||
);
|
||||
}
|
||||
|
||||
if(!descriptor[accessType]) {
|
||||
throw new Error(getErrorMsg('Property ' + propertyName + ' does not have access type ' + accessType));
|
||||
if (!descriptor[accessType]) {
|
||||
throw new Error(
|
||||
getErrorMsg(
|
||||
'Property ' +
|
||||
propertyName +
|
||||
' does not have access type ' +
|
||||
accessType
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (j$.isSpy(descriptor[accessType])) {
|
||||
if (this.respy) {
|
||||
return descriptor[accessType];
|
||||
} else {
|
||||
throw new Error(getErrorMsg(propertyName + '#' + accessType + ' has already been spied upon'));
|
||||
throw new Error(
|
||||
getErrorMsg(
|
||||
propertyName + '#' + accessType + ' has already been spied upon'
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,19 +165,27 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
|
||||
|
||||
this.spyOnAllFunctions = function(obj) {
|
||||
if (j$.util.isUndefined(obj)) {
|
||||
throw new Error('spyOnAllFunctions could not find an object to spy upon');
|
||||
throw new Error(
|
||||
'spyOnAllFunctions could not find an object to spy upon'
|
||||
);
|
||||
}
|
||||
|
||||
var pointer = obj,
|
||||
props = [],
|
||||
prop,
|
||||
descriptor;
|
||||
props = [],
|
||||
prop,
|
||||
descriptor;
|
||||
|
||||
while (pointer) {
|
||||
for (prop in pointer) {
|
||||
if (Object.prototype.hasOwnProperty.call(pointer, prop) && pointer[prop] instanceof Function) {
|
||||
if (
|
||||
Object.prototype.hasOwnProperty.call(pointer, prop) &&
|
||||
pointer[prop] instanceof Function
|
||||
) {
|
||||
descriptor = Object.getOwnPropertyDescriptor(pointer, prop);
|
||||
if ((descriptor.writable || descriptor.set) && descriptor.configurable) {
|
||||
if (
|
||||
(descriptor.writable || descriptor.set) &&
|
||||
descriptor.configurable
|
||||
) {
|
||||
props.push(prop);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
getJasmineRequireObj().SpyStrategy = function(j$) {
|
||||
|
||||
/**
|
||||
* @interface SpyStrategy
|
||||
*/
|
||||
@@ -19,20 +18,27 @@ getJasmineRequireObj().SpyStrategy = function(j$) {
|
||||
this.getSpy = options.getSpy || function() {};
|
||||
this.plan = this._defaultPlan = function() {};
|
||||
|
||||
var k, cs = options.customStrategies || {};
|
||||
var k,
|
||||
cs = options.customStrategies || {};
|
||||
for (k in cs) {
|
||||
if (j$.util.has(cs, k) && !this[k]) {
|
||||
this[k] = createCustomPlan(cs[k]);
|
||||
}
|
||||
}
|
||||
|
||||
var getPromise = (typeof options.getPromise === 'function') ? options.getPromise : function() {};
|
||||
var getPromise =
|
||||
typeof options.getPromise === 'function'
|
||||
? options.getPromise
|
||||
: function() {};
|
||||
|
||||
var requirePromise = function(name) {
|
||||
var Promise = getPromise();
|
||||
|
||||
if (!Promise) {
|
||||
throw new Error(name + ' requires global Promise, or `Promise` configured with `jasmine.getEnv().configure()`');
|
||||
throw new Error(
|
||||
name +
|
||||
' requires global Promise, or `Promise` configured with `jasmine.getEnv().configure()`'
|
||||
);
|
||||
}
|
||||
|
||||
return Promise;
|
||||
@@ -60,7 +66,7 @@ getJasmineRequireObj().SpyStrategy = function(j$) {
|
||||
*/
|
||||
this.rejectWith = function(value) {
|
||||
var Promise = requirePromise('rejectWith');
|
||||
var error = (value instanceof Error) ? value : new Error(value);
|
||||
var error = value instanceof Error ? value : new Error(value);
|
||||
|
||||
self.plan = function() {
|
||||
return Promise.reject(error);
|
||||
@@ -122,7 +128,7 @@ getJasmineRequireObj().SpyStrategy = function(j$) {
|
||||
*/
|
||||
SpyStrategy.prototype.returnValues = function() {
|
||||
var values = Array.prototype.slice.call(arguments);
|
||||
this.plan = function () {
|
||||
this.plan = function() {
|
||||
return values.shift();
|
||||
};
|
||||
return this.getSpy();
|
||||
@@ -135,7 +141,7 @@ getJasmineRequireObj().SpyStrategy = function(j$) {
|
||||
* @param {Error|String} something Thing to throw
|
||||
*/
|
||||
SpyStrategy.prototype.throwError = function(something) {
|
||||
var error = (something instanceof Error) ? something : new Error(something);
|
||||
var error = something instanceof Error ? something : new Error(something);
|
||||
this.plan = function() {
|
||||
throw error;
|
||||
};
|
||||
@@ -149,8 +155,10 @@ getJasmineRequireObj().SpyStrategy = function(j$) {
|
||||
* @param {Function} fn The function to invoke with the passed parameters.
|
||||
*/
|
||||
SpyStrategy.prototype.callFake = function(fn) {
|
||||
if(!(j$.isFunction_(fn) || j$.isAsyncFunction_(fn))) {
|
||||
throw new Error('Argument passed to callFake should be a function, got ' + fn);
|
||||
if (!(j$.isFunction_(fn) || j$.isAsyncFunction_(fn))) {
|
||||
throw new Error(
|
||||
'Argument passed to callFake should be a function, got ' + fn
|
||||
);
|
||||
}
|
||||
this.plan = fn;
|
||||
return this.getSpy();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
getJasmineRequireObj().StackTrace = function(j$) {
|
||||
function StackTrace(error) {
|
||||
var lines = error.stack
|
||||
.split('\n')
|
||||
.filter(function(line) { return line !== ''; });
|
||||
var lines = error.stack.split('\n').filter(function(line) {
|
||||
return line !== '';
|
||||
});
|
||||
|
||||
var extractResult = extractMessage(error.message, lines);
|
||||
|
||||
@@ -21,7 +21,12 @@ getJasmineRequireObj().StackTrace = function(j$) {
|
||||
// e.g. " at QueueRunner.run (http://localhost:8888/__jasmine__/jasmine.js:4320:20)"
|
||||
// Note that the "function name" can include a surprisingly large set of
|
||||
// characters, including angle brackets and square brackets.
|
||||
{ re: /^\s*at ([^\)]+) \(([^\)]+)\)$/, fnIx: 1, fileLineColIx: 2, style: 'v8' },
|
||||
{
|
||||
re: /^\s*at ([^\)]+) \(([^\)]+)\)$/,
|
||||
fnIx: 1,
|
||||
fileLineColIx: 2,
|
||||
style: 'v8'
|
||||
},
|
||||
|
||||
// NodeJS alternate form, often mixed in with the Chrome style
|
||||
// e.g. " at /some/path:4320:20
|
||||
@@ -30,7 +35,12 @@ getJasmineRequireObj().StackTrace = function(j$) {
|
||||
// PhantomJS on OS X, Safari, Firefox
|
||||
// e.g. "run@http://localhost:8888/__jasmine__/jasmine.js:4320:27"
|
||||
// or "http://localhost:8888/__jasmine__/jasmine.js:4320:27"
|
||||
{ re: /^(([^@\s]+)@)?([^\s]+)$/, fnIx: 2, fileLineColIx: 3, style: 'webkit' }
|
||||
{
|
||||
re: /^(([^@\s]+)@)?([^\s]+)$/,
|
||||
fnIx: 2,
|
||||
fileLineColIx: 3,
|
||||
style: 'webkit'
|
||||
}
|
||||
];
|
||||
|
||||
// regexes should capture the function name (if any) as group 1
|
||||
@@ -41,11 +51,16 @@ getJasmineRequireObj().StackTrace = function(j$) {
|
||||
var convertedLine = first(framePatterns, function(pattern) {
|
||||
var overallMatch = line.match(pattern.re),
|
||||
fileLineColMatch;
|
||||
if (!overallMatch) { return null; }
|
||||
if (!overallMatch) {
|
||||
return null;
|
||||
}
|
||||
|
||||
fileLineColMatch = overallMatch[pattern.fileLineColIx].match(
|
||||
/^(.*):(\d+):\d+$/);
|
||||
if (!fileLineColMatch) { return null; }
|
||||
/^(.*):(\d+):\d+$/
|
||||
);
|
||||
if (!fileLineColMatch) {
|
||||
return null;
|
||||
}
|
||||
|
||||
style = style || pattern.style;
|
||||
return {
|
||||
|
||||
@@ -48,7 +48,11 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
|
||||
Suite.prototype.getFullName = function() {
|
||||
var fullName = [];
|
||||
for (var parentSuite = this; parentSuite; parentSuite = parentSuite.parentSuite) {
|
||||
for (
|
||||
var parentSuite = this;
|
||||
parentSuite;
|
||||
parentSuite = parentSuite.parentSuite
|
||||
) {
|
||||
if (parentSuite.parentSuite) {
|
||||
fullName.unshift(parentSuite.description);
|
||||
}
|
||||
@@ -85,7 +89,7 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
};
|
||||
|
||||
function removeFns(queueableFns) {
|
||||
for(var i = 0; i < queueableFns.length; i++) {
|
||||
for (var i = 0; i < queueableFns.length; i++) {
|
||||
queueableFns[i].fn = null;
|
||||
}
|
||||
}
|
||||
@@ -124,7 +128,9 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
|
||||
Suite.prototype.sharedUserContext = function() {
|
||||
if (!this.sharedContext) {
|
||||
this.sharedContext = this.parentSuite ? this.parentSuite.clonedSharedUserContext() : new j$.UserContext();
|
||||
this.sharedContext = this.parentSuite
|
||||
? this.parentSuite.clonedSharedUserContext()
|
||||
: new j$.UserContext();
|
||||
}
|
||||
|
||||
return this.sharedContext;
|
||||
@@ -155,11 +161,11 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
this.result.failedExpectations.push(failedExpectation);
|
||||
};
|
||||
|
||||
Suite.prototype.addExpectationResult = function () {
|
||||
if(isFailure(arguments)) {
|
||||
Suite.prototype.addExpectationResult = function() {
|
||||
if (isFailure(arguments)) {
|
||||
var data = arguments[1];
|
||||
this.result.failedExpectations.push(this.expectationResultFactory(data));
|
||||
if(this.throwOnExpectationFailure) {
|
||||
if (this.throwOnExpectationFailure) {
|
||||
throw new j$.errors.ExpectationFailed();
|
||||
}
|
||||
}
|
||||
@@ -169,7 +175,9 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
if (typeof deprecation === 'string') {
|
||||
deprecation = { message: deprecation };
|
||||
}
|
||||
this.result.deprecationWarnings.push(this.expectationResultFactory(deprecation));
|
||||
this.result.deprecationWarnings.push(
|
||||
this.expectationResultFactory(deprecation)
|
||||
);
|
||||
};
|
||||
|
||||
function isFailure(args) {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
getJasmineRequireObj().Timer = function() {
|
||||
var defaultNow = (function(Date) {
|
||||
return function() { return new Date().getTime(); };
|
||||
return function() {
|
||||
return new Date().getTime();
|
||||
};
|
||||
})(Date);
|
||||
|
||||
function Timer(options) {
|
||||
@@ -24,6 +26,8 @@ getJasmineRequireObj().Timer = function() {
|
||||
getJasmineRequireObj().noopTimer = function() {
|
||||
return {
|
||||
start: function() {},
|
||||
elapsed: function() { return 0; }
|
||||
elapsed: function() {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,16 +1,24 @@
|
||||
getJasmineRequireObj().TreeProcessor = function() {
|
||||
function TreeProcessor(attrs) {
|
||||
var tree = attrs.tree,
|
||||
runnableIds = attrs.runnableIds,
|
||||
queueRunnerFactory = attrs.queueRunnerFactory,
|
||||
nodeStart = attrs.nodeStart || function() {},
|
||||
nodeComplete = attrs.nodeComplete || function() {},
|
||||
orderChildren = attrs.orderChildren || function(node) { return node.children; },
|
||||
excludeNode = attrs.excludeNode || function(node) { return false; },
|
||||
stats = { valid: true },
|
||||
processed = false,
|
||||
defaultMin = Infinity,
|
||||
defaultMax = 1 - Infinity;
|
||||
runnableIds = attrs.runnableIds,
|
||||
queueRunnerFactory = attrs.queueRunnerFactory,
|
||||
nodeStart = attrs.nodeStart || function() {},
|
||||
nodeComplete = attrs.nodeComplete || function() {},
|
||||
orderChildren =
|
||||
attrs.orderChildren ||
|
||||
function(node) {
|
||||
return node.children;
|
||||
},
|
||||
excludeNode =
|
||||
attrs.excludeNode ||
|
||||
function(node) {
|
||||
return false;
|
||||
},
|
||||
stats = { valid: true },
|
||||
processed = false,
|
||||
defaultMin = Infinity,
|
||||
defaultMax = 1 - Infinity;
|
||||
|
||||
this.processTree = function() {
|
||||
processNode(tree, true);
|
||||
@@ -59,13 +67,15 @@ getJasmineRequireObj().TreeProcessor = function() {
|
||||
stats[node.id] = {
|
||||
excluded: excluded,
|
||||
willExecute: !excluded && !node.markedPending,
|
||||
segments: [{
|
||||
index: 0,
|
||||
owner: node,
|
||||
nodes: [node],
|
||||
min: startingMin(executableIndex),
|
||||
max: startingMax(executableIndex)
|
||||
}]
|
||||
segments: [
|
||||
{
|
||||
index: 0,
|
||||
owner: node,
|
||||
nodes: [node],
|
||||
min: startingMin(executableIndex),
|
||||
max: startingMax(executableIndex)
|
||||
}
|
||||
]
|
||||
};
|
||||
} else {
|
||||
var hasExecutableChild = false;
|
||||
@@ -107,14 +117,29 @@ getJasmineRequireObj().TreeProcessor = function() {
|
||||
return executableIndex === undefined ? defaultMax : executableIndex;
|
||||
}
|
||||
|
||||
function segmentChildren(node, orderedChildren, nodeStats, executableIndex) {
|
||||
var currentSegment = { index: 0, owner: node, nodes: [], min: startingMin(executableIndex), max: startingMax(executableIndex) },
|
||||
result = [currentSegment],
|
||||
lastMax = defaultMax,
|
||||
orderedChildSegments = orderChildSegments(orderedChildren);
|
||||
function segmentChildren(
|
||||
node,
|
||||
orderedChildren,
|
||||
nodeStats,
|
||||
executableIndex
|
||||
) {
|
||||
var currentSegment = {
|
||||
index: 0,
|
||||
owner: node,
|
||||
nodes: [],
|
||||
min: startingMin(executableIndex),
|
||||
max: startingMax(executableIndex)
|
||||
},
|
||||
result = [currentSegment],
|
||||
lastMax = defaultMax,
|
||||
orderedChildSegments = orderChildSegments(orderedChildren);
|
||||
|
||||
function isSegmentBoundary(minIndex) {
|
||||
return lastMax !== defaultMax && minIndex !== defaultMin && lastMax < minIndex - 1;
|
||||
return (
|
||||
lastMax !== defaultMax &&
|
||||
minIndex !== defaultMin &&
|
||||
lastMax < minIndex - 1
|
||||
);
|
||||
}
|
||||
|
||||
for (var i = 0; i < orderedChildSegments.length; i++) {
|
||||
@@ -123,7 +148,13 @@ getJasmineRequireObj().TreeProcessor = function() {
|
||||
minIndex = childSegment.min;
|
||||
|
||||
if (isSegmentBoundary(minIndex)) {
|
||||
currentSegment = {index: result.length, owner: node, nodes: [], min: defaultMin, max: defaultMax};
|
||||
currentSegment = {
|
||||
index: result.length,
|
||||
owner: node,
|
||||
nodes: [],
|
||||
min: defaultMin,
|
||||
max: defaultMax
|
||||
};
|
||||
result.push(currentSegment);
|
||||
}
|
||||
|
||||
@@ -138,11 +169,11 @@ getJasmineRequireObj().TreeProcessor = function() {
|
||||
|
||||
function orderChildSegments(children) {
|
||||
var specifiedOrder = [],
|
||||
unspecifiedOrder = [];
|
||||
unspecifiedOrder = [];
|
||||
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
var child = children[i],
|
||||
segments = stats[child.id].segments;
|
||||
segments = stats[child.id].segments;
|
||||
|
||||
for (var j = 0; j < segments.length; j++) {
|
||||
var seg = segments[j];
|
||||
@@ -173,7 +204,7 @@ getJasmineRequireObj().TreeProcessor = function() {
|
||||
};
|
||||
|
||||
queueRunnerFactory({
|
||||
onComplete: function () {
|
||||
onComplete: function() {
|
||||
var args = Array.prototype.slice.call(arguments, [0]);
|
||||
node.cleanupBeforeAfter();
|
||||
nodeComplete(node, node.getResult(), function() {
|
||||
@@ -182,7 +213,7 @@ getJasmineRequireObj().TreeProcessor = function() {
|
||||
},
|
||||
queueableFns: [onStart].concat(wrapChildren(node, segmentNumber)),
|
||||
userContext: node.sharedUserContext(),
|
||||
onException: function () {
|
||||
onException: function() {
|
||||
node.onException.apply(node, arguments);
|
||||
}
|
||||
});
|
||||
@@ -190,17 +221,21 @@ getJasmineRequireObj().TreeProcessor = function() {
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
fn: function(done) { node.execute(done, stats[node.id].excluded); }
|
||||
fn: function(done) {
|
||||
node.execute(done, stats[node.id].excluded);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function wrapChildren(node, segmentNumber) {
|
||||
var result = [],
|
||||
segmentChildren = stats[node.id].segments[segmentNumber].nodes;
|
||||
segmentChildren = stats[node.id].segments[segmentNumber].nodes;
|
||||
|
||||
for (var i = 0; i < segmentChildren.length; i++) {
|
||||
result.push(executeNode(segmentChildren[i].owner, segmentChildren[i].index));
|
||||
result.push(
|
||||
executeNode(segmentChildren[i].owner, segmentChildren[i].index)
|
||||
);
|
||||
}
|
||||
|
||||
if (!stats[node.id].willExecute) {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
getJasmineRequireObj().UserContext = function(j$) {
|
||||
function UserContext() {
|
||||
}
|
||||
function UserContext() {}
|
||||
|
||||
UserContext.fromExisting = function(oldContext) {
|
||||
var context = new UserContext();
|
||||
@@ -14,5 +13,5 @@ getJasmineRequireObj().UserContext = function(j$) {
|
||||
return context;
|
||||
};
|
||||
|
||||
return UserContext;
|
||||
return UserContext;
|
||||
};
|
||||
|
||||
@@ -40,7 +40,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
* @return {Env}
|
||||
*/
|
||||
j$.getEnv = function(options) {
|
||||
var env = j$.currentEnv_ = j$.currentEnv_ || new j$.Env(options);
|
||||
var env = (j$.currentEnv_ = j$.currentEnv_ || new j$.Env(options));
|
||||
//jasmine. singletons in here (setTimeout blah blah).
|
||||
return env;
|
||||
};
|
||||
@@ -50,7 +50,9 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
};
|
||||
|
||||
j$.isObject_ = function(value) {
|
||||
return !j$.util.isUndefined(value) && value !== null && j$.isA_('Object', value);
|
||||
return (
|
||||
!j$.util.isUndefined(value) && value !== null && j$.isA_('Object', value)
|
||||
);
|
||||
};
|
||||
|
||||
j$.isString_ = function(value) {
|
||||
@@ -70,7 +72,8 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
};
|
||||
|
||||
j$.isTypedArray_ = function(value) {
|
||||
return j$.isA_('Float32Array', value) ||
|
||||
return (
|
||||
j$.isA_('Float32Array', value) ||
|
||||
j$.isA_('Float64Array', value) ||
|
||||
j$.isA_('Int16Array', value) ||
|
||||
j$.isA_('Int32Array', value) ||
|
||||
@@ -78,7 +81,8 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
j$.isA_('Uint16Array', value) ||
|
||||
j$.isA_('Uint32Array', value) ||
|
||||
j$.isA_('Uint8Array', value) ||
|
||||
j$.isA_('Uint8ClampedArray', value);
|
||||
j$.isA_('Uint8ClampedArray', value)
|
||||
);
|
||||
};
|
||||
|
||||
j$.isA_ = function(typeName, value) {
|
||||
@@ -108,9 +112,9 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
|
||||
j$.isDomNode = function(obj) {
|
||||
// Node is a function, because constructors
|
||||
return typeof jasmineGlobal.Node !== 'undefined' ?
|
||||
obj instanceof jasmineGlobal.Node :
|
||||
obj !== null &&
|
||||
return typeof jasmineGlobal.Node !== 'undefined'
|
||||
? obj instanceof jasmineGlobal.Node
|
||||
: obj !== null &&
|
||||
typeof obj === 'object' &&
|
||||
typeof obj.nodeType === 'number' &&
|
||||
typeof obj.nodeName === 'string';
|
||||
@@ -118,15 +122,25 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
};
|
||||
|
||||
j$.isMap = function(obj) {
|
||||
return typeof jasmineGlobal.Map !== 'undefined' && obj.constructor === jasmineGlobal.Map;
|
||||
return (
|
||||
typeof jasmineGlobal.Map !== 'undefined' &&
|
||||
obj.constructor === jasmineGlobal.Map
|
||||
);
|
||||
};
|
||||
|
||||
j$.isSet = function(obj) {
|
||||
return typeof jasmineGlobal.Set !== 'undefined' && obj.constructor === jasmineGlobal.Set;
|
||||
return (
|
||||
typeof jasmineGlobal.Set !== 'undefined' &&
|
||||
obj.constructor === jasmineGlobal.Set
|
||||
);
|
||||
};
|
||||
|
||||
j$.isPromise = function(obj) {
|
||||
return typeof jasmineGlobal.Promise !== 'undefined' && !!obj && obj.constructor === jasmineGlobal.Promise;
|
||||
return (
|
||||
typeof jasmineGlobal.Promise !== 'undefined' &&
|
||||
!!obj &&
|
||||
obj.constructor === jasmineGlobal.Promise
|
||||
);
|
||||
};
|
||||
|
||||
j$.isPromiseLike = function(obj) {
|
||||
@@ -138,7 +152,8 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
return func.name;
|
||||
}
|
||||
|
||||
var matches = func.toString().match(/^\s*function\s*(\w+)\s*\(/) ||
|
||||
var matches =
|
||||
func.toString().match(/^\s*function\s*(\w+)\s*\(/) ||
|
||||
func.toString().match(/^\s*\[object\s*(\w+)Constructor\]/);
|
||||
|
||||
return matches ? matches[1] : '<anonymous>';
|
||||
@@ -171,7 +186,9 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
* @name jasmine.truthy
|
||||
* @function
|
||||
*/
|
||||
j$.truthy = function() { return new j$.Truthy(); };
|
||||
j$.truthy = function() {
|
||||
return new j$.Truthy();
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
@@ -179,7 +196,9 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
* @name jasmine.falsy
|
||||
* @function
|
||||
*/
|
||||
j$.falsy = function() { return new j$.Falsy(); };
|
||||
j$.falsy = function() {
|
||||
return new j$.Falsy();
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
@@ -187,7 +206,9 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
* @name jasmine.empty
|
||||
* @function
|
||||
*/
|
||||
j$.empty = function() { return new j$.Empty(); };
|
||||
j$.empty = function() {
|
||||
return new j$.Empty();
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
@@ -195,7 +216,9 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
* @name jasmine.notEmpty
|
||||
* @function
|
||||
*/
|
||||
j$.notEmpty = function() { return new j$.NotEmpty(); };
|
||||
j$.notEmpty = function() {
|
||||
return new j$.NotEmpty();
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||
@@ -245,7 +268,9 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
if (!putativeSpy) {
|
||||
return false;
|
||||
}
|
||||
return putativeSpy.and instanceof j$.SpyStrategy &&
|
||||
putativeSpy.calls instanceof j$.CallTracker;
|
||||
return (
|
||||
putativeSpy.and instanceof j$.SpyStrategy &&
|
||||
putativeSpy.calls instanceof j$.CallTracker
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -7,4 +7,4 @@ getJasmineRequireObj().errors = function() {
|
||||
return {
|
||||
ExpectationFailed: ExpectationFailed
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
var getJasmineRequireObj = (function (jasmineGlobal) {
|
||||
/* globals exports, global, module, window */
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
var getJasmineRequireObj = (function(jasmineGlobal) {
|
||||
var jasmineRequire;
|
||||
|
||||
if (typeof module !== 'undefined' && module.exports && typeof exports !== 'undefined') {
|
||||
if (
|
||||
typeof module !== 'undefined' &&
|
||||
module.exports &&
|
||||
typeof exports !== 'undefined'
|
||||
) {
|
||||
if (typeof global !== 'undefined') {
|
||||
jasmineGlobal = global;
|
||||
} else {
|
||||
@@ -10,7 +14,11 @@ var getJasmineRequireObj = (function (jasmineGlobal) {
|
||||
}
|
||||
jasmineRequire = exports;
|
||||
} else {
|
||||
if (typeof window !== 'undefined' && typeof window.toString === 'function' && window.toString() === '[object GjsGlobal]') {
|
||||
if (
|
||||
typeof window !== 'undefined' &&
|
||||
typeof window.toString === 'function' &&
|
||||
window.toString() === '[object GjsGlobal]'
|
||||
) {
|
||||
jasmineGlobal = window;
|
||||
}
|
||||
jasmineRequire = jasmineGlobal.jasmineRequire = {};
|
||||
|
||||
@@ -203,7 +203,7 @@ getJasmineRequireObj().interface = function(jasmine, env) {
|
||||
* @function
|
||||
* @global
|
||||
* @param {String|Error} [error] - Reason for the failure.
|
||||
*/
|
||||
*/
|
||||
fail: function() {
|
||||
return env.fail.apply(env, arguments);
|
||||
},
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
getJasmineRequireObj().util = function(j$) {
|
||||
|
||||
var util = {};
|
||||
|
||||
util.inherit = function(childClass, parentClass) {
|
||||
var Subclass = function() {
|
||||
};
|
||||
var Subclass = function() {};
|
||||
Subclass.prototype = parentClass.prototype;
|
||||
childClass.prototype = new Subclass();
|
||||
};
|
||||
@@ -13,7 +11,8 @@ getJasmineRequireObj().util = function(j$) {
|
||||
if (!str) {
|
||||
return str;
|
||||
}
|
||||
return str.replace(/&/g, '&')
|
||||
return str
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>');
|
||||
};
|
||||
@@ -58,7 +57,7 @@ getJasmineRequireObj().util = function(j$) {
|
||||
util.cloneArgs = function(args) {
|
||||
var clonedArgs = [];
|
||||
var argsAsArray = j$.util.argsToArray(args);
|
||||
for(var i = 0; i < argsAsArray.length; i++) {
|
||||
for (var i = 0; i < argsAsArray.length; i++) {
|
||||
var str = Object.prototype.toString.apply(argsAsArray[i]),
|
||||
primitives = /^\[object (Boolean|String|RegExp|Number)/;
|
||||
|
||||
@@ -100,7 +99,7 @@ getJasmineRequireObj().util = function(j$) {
|
||||
return Object.prototype.hasOwnProperty.call(obj, key);
|
||||
};
|
||||
|
||||
util.errorWithStack = function errorWithStack () {
|
||||
util.errorWithStack = function errorWithStack() {
|
||||
// Don't throw and catch if we don't have to, because it makes it harder
|
||||
// for users to debug their code with exception breakpoints.
|
||||
var error = new Error();
|
||||
@@ -132,7 +131,7 @@ getJasmineRequireObj().util = function(j$) {
|
||||
|
||||
return result;
|
||||
};
|
||||
}());
|
||||
})();
|
||||
|
||||
return util;
|
||||
};
|
||||
|
||||
@@ -23,8 +23,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
}
|
||||
};
|
||||
|
||||
ResultsStateBuilder.prototype.specStarted = function(result) {
|
||||
};
|
||||
ResultsStateBuilder.prototype.specStarted = function(result) {};
|
||||
|
||||
ResultsStateBuilder.prototype.specDone = function(result) {
|
||||
this.currentParent.addChild(result, 'spec');
|
||||
@@ -42,15 +41,16 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
function HtmlReporter(options) {
|
||||
var config = function() { return (options.env && options.env.configuration()) || {}; },
|
||||
var config = function() {
|
||||
return (options.env && options.env.configuration()) || {};
|
||||
},
|
||||
getContainer = options.getContainer,
|
||||
createElement = options.createElement,
|
||||
createTextNode = options.createTextNode,
|
||||
navigateWithNewParam = options.navigateWithNewParam || function() {},
|
||||
addToExistingQueryString = options.addToExistingQueryString || defaultQueryString,
|
||||
addToExistingQueryString =
|
||||
options.addToExistingQueryString || defaultQueryString,
|
||||
filterSpecs = options.filterSpecs,
|
||||
timer = options.timer || j$.noopTimer,
|
||||
htmlReporterMain,
|
||||
@@ -59,15 +59,25 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
|
||||
this.initialize = function() {
|
||||
clearPrior();
|
||||
htmlReporterMain = createDom('div', {className: 'jasmine_html-reporter'},
|
||||
createDom('div', {className: 'jasmine-banner'},
|
||||
createDom('a', {className: 'jasmine-title', href: 'http://jasmine.github.io/', target: '_blank'}),
|
||||
createDom('span', {className: 'jasmine-version'}, j$.version)
|
||||
htmlReporterMain = createDom(
|
||||
'div',
|
||||
{ className: 'jasmine_html-reporter' },
|
||||
createDom(
|
||||
'div',
|
||||
{ className: 'jasmine-banner' },
|
||||
createDom('a', {
|
||||
className: 'jasmine-title',
|
||||
href: 'http://jasmine.github.io/',
|
||||
target: '_blank'
|
||||
}),
|
||||
createDom('span', { className: 'jasmine-version' }, j$.version)
|
||||
),
|
||||
createDom('ul', {className: 'jasmine-symbol-summary'}),
|
||||
createDom('div', {className: 'jasmine-alert'}),
|
||||
createDom('div', {className: 'jasmine-results'},
|
||||
createDom('div', {className: 'jasmine-failures'})
|
||||
createDom('ul', { className: 'jasmine-symbol-summary' }),
|
||||
createDom('div', { className: 'jasmine-alert' }),
|
||||
createDom(
|
||||
'div',
|
||||
{ className: 'jasmine-results' },
|
||||
createDom('div', { className: 'jasmine-failures' })
|
||||
)
|
||||
);
|
||||
getContainer().appendChild(htmlReporterMain);
|
||||
@@ -79,7 +89,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
timer.start();
|
||||
};
|
||||
|
||||
var summary = createDom('div', {className: 'jasmine-summary'});
|
||||
var summary = createDom('div', { className: 'jasmine-summary' });
|
||||
|
||||
var stateBuilder = new ResultsStateBuilder();
|
||||
|
||||
@@ -104,20 +114,25 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
this.specDone = function(result) {
|
||||
stateBuilder.specDone(result);
|
||||
|
||||
if(noExpectations(result) && typeof console !== 'undefined' && typeof console.error !== 'undefined') {
|
||||
console.error('Spec \'' + result.fullName + '\' has no expectations.');
|
||||
if (
|
||||
noExpectations(result) &&
|
||||
typeof console !== 'undefined' &&
|
||||
typeof console.error !== 'undefined'
|
||||
) {
|
||||
console.error("Spec '" + result.fullName + "' has no expectations.");
|
||||
}
|
||||
|
||||
if (!symbols) {
|
||||
symbols = find('.jasmine-symbol-summary');
|
||||
}
|
||||
|
||||
symbols.appendChild(createDom('li', {
|
||||
symbols.appendChild(
|
||||
createDom('li', {
|
||||
className: this.displaySpecInCorrectFormat(result),
|
||||
id: 'spec_' + result.id,
|
||||
title: result.fullName
|
||||
}
|
||||
));
|
||||
})
|
||||
);
|
||||
|
||||
if (result.status === 'failed') {
|
||||
failures.push(failureDom(result));
|
||||
@@ -127,12 +142,16 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
};
|
||||
|
||||
this.displaySpecInCorrectFormat = function(result) {
|
||||
return noExpectations(result) ? 'jasmine-empty' : this.resultStatus(result.status);
|
||||
return noExpectations(result)
|
||||
? 'jasmine-empty'
|
||||
: this.resultStatus(result.status);
|
||||
};
|
||||
|
||||
this.resultStatus = function(status) {
|
||||
if(status === 'excluded') {
|
||||
return config().hideDisabled ? 'jasmine-excluded-no-display' : 'jasmine-excluded';
|
||||
if (status === 'excluded') {
|
||||
return config().hideDisabled
|
||||
? 'jasmine-excluded-no-display'
|
||||
: 'jasmine-excluded';
|
||||
}
|
||||
return 'jasmine-' + status;
|
||||
};
|
||||
@@ -142,16 +161,33 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
var alert = find('.jasmine-alert');
|
||||
var order = doneResult && doneResult.order;
|
||||
var i;
|
||||
alert.appendChild(createDom('span', {className: 'jasmine-duration'}, 'finished in ' + timer.elapsed() / 1000 + 's'));
|
||||
alert.appendChild(
|
||||
createDom(
|
||||
'span',
|
||||
{ className: 'jasmine-duration' },
|
||||
'finished in ' + timer.elapsed() / 1000 + 's'
|
||||
)
|
||||
);
|
||||
|
||||
banner.appendChild(optionsMenu(config()));
|
||||
|
||||
if (stateBuilder.specsExecuted < totalSpecsDefined) {
|
||||
var skippedMessage = 'Ran ' + stateBuilder.specsExecuted + ' of ' + totalSpecsDefined + ' specs - run all';
|
||||
var skippedMessage =
|
||||
'Ran ' +
|
||||
stateBuilder.specsExecuted +
|
||||
' of ' +
|
||||
totalSpecsDefined +
|
||||
' specs - run all';
|
||||
var skippedLink = addToExistingQueryString('spec', '');
|
||||
alert.appendChild(
|
||||
createDom('span', {className: 'jasmine-bar jasmine-skipped'},
|
||||
createDom('a', {href: skippedLink, title: 'Run all specs'}, skippedMessage)
|
||||
createDom(
|
||||
'span',
|
||||
{ className: 'jasmine-bar jasmine-skipped' },
|
||||
createDom(
|
||||
'a',
|
||||
{ href: skippedLink, title: 'Run all specs' },
|
||||
skippedMessage
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -161,34 +197,66 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
var failed = stateBuilder.failureCount + globalFailures.length > 0;
|
||||
|
||||
if (totalSpecsDefined > 0 || failed) {
|
||||
statusBarMessage += pluralize('spec', stateBuilder.specsExecuted) + ', ' + pluralize('failure', stateBuilder.failureCount);
|
||||
if (stateBuilder.pendingSpecCount) { statusBarMessage += ', ' + pluralize('pending spec', stateBuilder.pendingSpecCount); }
|
||||
statusBarMessage +=
|
||||
pluralize('spec', stateBuilder.specsExecuted) +
|
||||
', ' +
|
||||
pluralize('failure', stateBuilder.failureCount);
|
||||
if (stateBuilder.pendingSpecCount) {
|
||||
statusBarMessage +=
|
||||
', ' + pluralize('pending spec', stateBuilder.pendingSpecCount);
|
||||
}
|
||||
}
|
||||
|
||||
if (doneResult.overallStatus === 'passed') {
|
||||
statusBarClassName += ' jasmine-passed ';
|
||||
} else if (doneResult.overallStatus === 'incomplete') {
|
||||
statusBarClassName += ' jasmine-incomplete ';
|
||||
statusBarMessage = 'Incomplete: ' + doneResult.incompleteReason + ', ' + statusBarMessage;
|
||||
statusBarMessage =
|
||||
'Incomplete: ' +
|
||||
doneResult.incompleteReason +
|
||||
', ' +
|
||||
statusBarMessage;
|
||||
} else {
|
||||
statusBarClassName += ' jasmine-failed ';
|
||||
}
|
||||
|
||||
var seedBar;
|
||||
if (order && order.random) {
|
||||
seedBar = createDom('span', {className: 'jasmine-seed-bar'},
|
||||
seedBar = createDom(
|
||||
'span',
|
||||
{ className: 'jasmine-seed-bar' },
|
||||
', randomized with seed ',
|
||||
createDom('a', {title: 'randomized with seed ' + order.seed, href: seedHref(order.seed)}, order.seed)
|
||||
createDom(
|
||||
'a',
|
||||
{
|
||||
title: 'randomized with seed ' + order.seed,
|
||||
href: seedHref(order.seed)
|
||||
},
|
||||
order.seed
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
alert.appendChild(createDom('span', {className: statusBarClassName}, statusBarMessage, seedBar));
|
||||
alert.appendChild(
|
||||
createDom(
|
||||
'span',
|
||||
{ className: statusBarClassName },
|
||||
statusBarMessage,
|
||||
seedBar
|
||||
)
|
||||
);
|
||||
|
||||
var errorBarClassName = 'jasmine-bar jasmine-errored';
|
||||
var afterAllMessagePrefix = 'AfterAll ';
|
||||
|
||||
for(i = 0; i < globalFailures.length; i++) {
|
||||
alert.appendChild(createDom('span', {className: errorBarClassName}, globalFailureMessage(globalFailures[i])));
|
||||
for (i = 0; i < globalFailures.length; i++) {
|
||||
alert.appendChild(
|
||||
createDom(
|
||||
'span',
|
||||
{ className: errorBarClassName },
|
||||
globalFailureMessage(globalFailures[i])
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function globalFailureMessage(failure) {
|
||||
@@ -196,7 +264,9 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
var prefix = 'Error during loading: ' + failure.message;
|
||||
|
||||
if (failure.filename) {
|
||||
return prefix + ' in ' + failure.filename + ' line ' + failure.lineno;
|
||||
return (
|
||||
prefix + ' in ' + failure.filename + ' line ' + failure.lineno
|
||||
);
|
||||
} else {
|
||||
return prefix;
|
||||
}
|
||||
@@ -208,9 +278,15 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
addDeprecationWarnings(doneResult);
|
||||
|
||||
var warningBarClassName = 'jasmine-bar jasmine-warning';
|
||||
for(i = 0; i < deprecationWarnings.length; i++) {
|
||||
for (i = 0; i < deprecationWarnings.length; i++) {
|
||||
var warning = deprecationWarnings[i];
|
||||
alert.appendChild(createDom('span', {className: warningBarClassName}, 'DEPRECATION: ' + warning));
|
||||
alert.appendChild(
|
||||
createDom(
|
||||
'span',
|
||||
{ className: warningBarClassName },
|
||||
'DEPRECATION: ' + warning
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
var results = find('.jasmine-results');
|
||||
@@ -220,13 +296,29 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
|
||||
if (failures.length) {
|
||||
alert.appendChild(
|
||||
createDom('span', {className: 'jasmine-menu jasmine-bar jasmine-spec-list'},
|
||||
createDom(
|
||||
'span',
|
||||
{ className: 'jasmine-menu jasmine-bar jasmine-spec-list' },
|
||||
createDom('span', {}, 'Spec List | '),
|
||||
createDom('a', {className: 'jasmine-failures-menu', href: '#'}, 'Failures')));
|
||||
createDom(
|
||||
'a',
|
||||
{ className: 'jasmine-failures-menu', href: '#' },
|
||||
'Failures'
|
||||
)
|
||||
)
|
||||
);
|
||||
alert.appendChild(
|
||||
createDom('span', {className: 'jasmine-menu jasmine-bar jasmine-failure-list'},
|
||||
createDom('a', {className: 'jasmine-spec-list-menu', href: '#'}, 'Spec List'),
|
||||
createDom('span', {}, ' | Failures ')));
|
||||
createDom(
|
||||
'span',
|
||||
{ className: 'jasmine-menu jasmine-bar jasmine-failure-list' },
|
||||
createDom(
|
||||
'a',
|
||||
{ className: 'jasmine-spec-list-menu', href: '#' },
|
||||
'Spec List'
|
||||
),
|
||||
createDom('span', {}, ' | Failures ')
|
||||
)
|
||||
);
|
||||
|
||||
find('.jasmine-failures-menu').onclick = function() {
|
||||
setMenuModeTo('jasmine-failure-list');
|
||||
@@ -247,17 +339,30 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
return this;
|
||||
|
||||
function failureDom(result) {
|
||||
var failure =
|
||||
createDom('div', {className: 'jasmine-spec-detail jasmine-failed'},
|
||||
failureDescription(result, stateBuilder.currentParent),
|
||||
createDom('div', {className: 'jasmine-messages'})
|
||||
);
|
||||
var failure = createDom(
|
||||
'div',
|
||||
{ className: 'jasmine-spec-detail jasmine-failed' },
|
||||
failureDescription(result, stateBuilder.currentParent),
|
||||
createDom('div', { className: 'jasmine-messages' })
|
||||
);
|
||||
var messages = failure.childNodes[1];
|
||||
|
||||
for (var i = 0; i < result.failedExpectations.length; i++) {
|
||||
var expectation = result.failedExpectations[i];
|
||||
messages.appendChild(createDom('div', {className: 'jasmine-result-message'}, expectation.message));
|
||||
messages.appendChild(createDom('div', {className: 'jasmine-stack-trace'}, expectation.stack));
|
||||
messages.appendChild(
|
||||
createDom(
|
||||
'div',
|
||||
{ className: 'jasmine-result-message' },
|
||||
expectation.message
|
||||
)
|
||||
);
|
||||
messages.appendChild(
|
||||
createDom(
|
||||
'div',
|
||||
{ className: 'jasmine-stack-trace' },
|
||||
expectation.stack
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return failure;
|
||||
@@ -271,9 +376,20 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
continue;
|
||||
}
|
||||
if (resultNode.type === 'suite') {
|
||||
var suiteListNode = createDom('ul', {className: 'jasmine-suite', id: 'suite-' + resultNode.result.id},
|
||||
createDom('li', {className: 'jasmine-suite-detail jasmine-' + resultNode.result.status},
|
||||
createDom('a', {href: specHref(resultNode.result)}, resultNode.result.description)
|
||||
var suiteListNode = createDom(
|
||||
'ul',
|
||||
{ className: 'jasmine-suite', id: 'suite-' + resultNode.result.id },
|
||||
createDom(
|
||||
'li',
|
||||
{
|
||||
className:
|
||||
'jasmine-suite-detail jasmine-' + resultNode.result.status
|
||||
},
|
||||
createDom(
|
||||
'a',
|
||||
{ href: specHref(resultNode.result) },
|
||||
resultNode.result.description
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
@@ -282,22 +398,34 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
}
|
||||
if (resultNode.type === 'spec') {
|
||||
if (domParent.getAttribute('class') !== 'jasmine-specs') {
|
||||
specListNode = createDom('ul', {className: 'jasmine-specs'});
|
||||
specListNode = createDom('ul', { className: 'jasmine-specs' });
|
||||
domParent.appendChild(specListNode);
|
||||
}
|
||||
var specDescription = resultNode.result.description;
|
||||
if(noExpectations(resultNode.result)) {
|
||||
if (noExpectations(resultNode.result)) {
|
||||
specDescription = 'SPEC HAS NO EXPECTATIONS ' + specDescription;
|
||||
}
|
||||
if(resultNode.result.status === 'pending' && resultNode.result.pendingReason !== '') {
|
||||
specDescription = specDescription + ' PENDING WITH MESSAGE: ' + resultNode.result.pendingReason;
|
||||
if (
|
||||
resultNode.result.status === 'pending' &&
|
||||
resultNode.result.pendingReason !== ''
|
||||
) {
|
||||
specDescription =
|
||||
specDescription +
|
||||
' PENDING WITH MESSAGE: ' +
|
||||
resultNode.result.pendingReason;
|
||||
}
|
||||
specListNode.appendChild(
|
||||
createDom('li', {
|
||||
createDom(
|
||||
'li',
|
||||
{
|
||||
className: 'jasmine-' + resultNode.result.status,
|
||||
id: 'spec-' + resultNode.result.id
|
||||
},
|
||||
createDom('a', {href: specHref(resultNode.result)}, specDescription)
|
||||
createDom(
|
||||
'a',
|
||||
{ href: specHref(resultNode.result) },
|
||||
specDescription
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -305,37 +433,69 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
}
|
||||
|
||||
function optionsMenu(config) {
|
||||
var optionsMenuDom = createDom('div', { className: 'jasmine-run-options' },
|
||||
var optionsMenuDom = createDom(
|
||||
'div',
|
||||
{ className: 'jasmine-run-options' },
|
||||
createDom('span', { className: 'jasmine-trigger' }, 'Options'),
|
||||
createDom('div', { className: 'jasmine-payload' },
|
||||
createDom('div', { className: 'jasmine-stop-on-failure' },
|
||||
createDom(
|
||||
'div',
|
||||
{ className: 'jasmine-payload' },
|
||||
createDom(
|
||||
'div',
|
||||
{ className: 'jasmine-stop-on-failure' },
|
||||
createDom('input', {
|
||||
className: 'jasmine-fail-fast',
|
||||
id: 'jasmine-fail-fast',
|
||||
type: 'checkbox'
|
||||
}),
|
||||
createDom('label', { className: 'jasmine-label', 'for': 'jasmine-fail-fast' }, 'stop execution on spec failure')),
|
||||
createDom('div', { className: 'jasmine-throw-failures' },
|
||||
createDom(
|
||||
'label',
|
||||
{ className: 'jasmine-label', for: 'jasmine-fail-fast' },
|
||||
'stop execution on spec failure'
|
||||
)
|
||||
),
|
||||
createDom(
|
||||
'div',
|
||||
{ className: 'jasmine-throw-failures' },
|
||||
createDom('input', {
|
||||
className: 'jasmine-throw',
|
||||
id: 'jasmine-throw-failures',
|
||||
type: 'checkbox'
|
||||
}),
|
||||
createDom('label', { className: 'jasmine-label', 'for': 'jasmine-throw-failures' }, 'stop spec on expectation failure')),
|
||||
createDom('div', { className: 'jasmine-random-order' },
|
||||
createDom(
|
||||
'label',
|
||||
{ className: 'jasmine-label', for: 'jasmine-throw-failures' },
|
||||
'stop spec on expectation failure'
|
||||
)
|
||||
),
|
||||
createDom(
|
||||
'div',
|
||||
{ className: 'jasmine-random-order' },
|
||||
createDom('input', {
|
||||
className: 'jasmine-random',
|
||||
id: 'jasmine-random-order',
|
||||
type: 'checkbox'
|
||||
}),
|
||||
createDom('label', { className: 'jasmine-label', 'for': 'jasmine-random-order' }, 'run tests in random order')),
|
||||
createDom('div', { className: 'jasmine-hide-disabled' },
|
||||
createDom(
|
||||
'label',
|
||||
{ className: 'jasmine-label', for: 'jasmine-random-order' },
|
||||
'run tests in random order'
|
||||
)
|
||||
),
|
||||
createDom(
|
||||
'div',
|
||||
{ className: 'jasmine-hide-disabled' },
|
||||
createDom('input', {
|
||||
className: 'jasmine-disabled',
|
||||
id: 'jasmine-hide-disabled',
|
||||
type: 'checkbox'
|
||||
}),
|
||||
createDom('label', { className: 'jasmine-label', 'for': 'jasmine-hide-disabled' }, 'hide disabled tests'))
|
||||
createDom(
|
||||
'label',
|
||||
{ className: 'jasmine-label', for: 'jasmine-hide-disabled' },
|
||||
'hide disabled tests'
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
@@ -345,13 +505,17 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
navigateWithNewParam('failFast', !config.failFast);
|
||||
};
|
||||
|
||||
var throwCheckbox = optionsMenuDom.querySelector('#jasmine-throw-failures');
|
||||
var throwCheckbox = optionsMenuDom.querySelector(
|
||||
'#jasmine-throw-failures'
|
||||
);
|
||||
throwCheckbox.checked = config.oneFailurePerSpec;
|
||||
throwCheckbox.onclick = function() {
|
||||
navigateWithNewParam('throwFailures', !config.oneFailurePerSpec);
|
||||
};
|
||||
|
||||
var randomCheckbox = optionsMenuDom.querySelector('#jasmine-random-order');
|
||||
var randomCheckbox = optionsMenuDom.querySelector(
|
||||
'#jasmine-random-order'
|
||||
);
|
||||
randomCheckbox.checked = config.random;
|
||||
randomCheckbox.onclick = function() {
|
||||
navigateWithNewParam('random', !config.random);
|
||||
@@ -369,7 +533,10 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
|
||||
optionsTrigger.onclick = function() {
|
||||
if (isOpen.test(optionsPayload.className)) {
|
||||
optionsPayload.className = optionsPayload.className.replace(isOpen, '');
|
||||
optionsPayload.className = optionsPayload.className.replace(
|
||||
isOpen,
|
||||
''
|
||||
);
|
||||
} else {
|
||||
optionsPayload.className += ' jasmine-open';
|
||||
}
|
||||
@@ -379,14 +546,24 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
}
|
||||
|
||||
function failureDescription(result, suite) {
|
||||
var wrapper = createDom('div', {className: 'jasmine-description'},
|
||||
createDom('a', {title: result.description, href: specHref(result)}, result.description)
|
||||
var wrapper = createDom(
|
||||
'div',
|
||||
{ className: 'jasmine-description' },
|
||||
createDom(
|
||||
'a',
|
||||
{ title: result.description, href: specHref(result) },
|
||||
result.description
|
||||
)
|
||||
);
|
||||
var suiteLink;
|
||||
|
||||
while (suite && suite.parent) {
|
||||
wrapper.insertBefore(createTextNode(' > '), wrapper.firstChild);
|
||||
suiteLink = createDom('a', {href: suiteHref(suite)}, suite.result.description);
|
||||
suiteLink = createDom(
|
||||
'a',
|
||||
{ href: suiteHref(suite) },
|
||||
suite.result.description
|
||||
);
|
||||
wrapper.insertBefore(suiteLink, wrapper.firstChild);
|
||||
|
||||
suite = suite.parent;
|
||||
@@ -408,7 +585,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
|
||||
function addDeprecationWarnings(result) {
|
||||
if (result && result.deprecationWarnings) {
|
||||
for(var i = 0; i < result.deprecationWarnings.length; i++) {
|
||||
for (var i = 0; i < result.deprecationWarnings.length; i++) {
|
||||
var warning = result.deprecationWarnings[i].message;
|
||||
if (!j$.util.arrayContains(warning)) {
|
||||
deprecationWarnings.push(warning);
|
||||
@@ -425,7 +602,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
// return the reporter
|
||||
var oldReporter = find('');
|
||||
|
||||
if(oldReporter) {
|
||||
if (oldReporter) {
|
||||
getContainer().removeChild(oldReporter);
|
||||
}
|
||||
}
|
||||
@@ -457,7 +634,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
}
|
||||
|
||||
function pluralize(singular, count) {
|
||||
var word = (count == 1 ? singular : singular + 's');
|
||||
var word = count == 1 ? singular : singular + 's';
|
||||
|
||||
return '' + count + ' ' + word;
|
||||
}
|
||||
@@ -479,8 +656,10 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
}
|
||||
|
||||
function noExpectations(result) {
|
||||
return (result.failedExpectations.length + result.passedExpectations.length) === 0 &&
|
||||
result.status === 'passed';
|
||||
return (
|
||||
result.failedExpectations.length + result.passedExpectations.length ===
|
||||
0 && result.status === 'passed'
|
||||
);
|
||||
}
|
||||
|
||||
function hasActiveSpec(resultNode) {
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
jasmineRequire.HtmlSpecFilter = function() {
|
||||
function HtmlSpecFilter(options) {
|
||||
var filterString = options && options.filterString() && options.filterString().replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
||||
var filterString =
|
||||
options &&
|
||||
options.filterString() &&
|
||||
options.filterString().replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
||||
var filterPattern = new RegExp(filterString);
|
||||
|
||||
this.matches = function(specName) {
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
jasmineRequire.QueryString = function() {
|
||||
function QueryString(options) {
|
||||
|
||||
this.navigateWithNewParam = function(key, value) {
|
||||
options.getWindowLocation().search = this.fullStringWithNewParam(key, value);
|
||||
options.getWindowLocation().search = this.fullStringWithNewParam(
|
||||
key,
|
||||
value
|
||||
);
|
||||
};
|
||||
|
||||
this.fullStringWithNewParam = function(key, value) {
|
||||
@@ -20,7 +22,9 @@ jasmineRequire.QueryString = function() {
|
||||
function toQueryString(paramMap) {
|
||||
var qStrPairs = [];
|
||||
for (var prop in paramMap) {
|
||||
qStrPairs.push(encodeURIComponent(prop) + '=' + encodeURIComponent(paramMap[prop]));
|
||||
qStrPairs.push(
|
||||
encodeURIComponent(prop) + '=' + encodeURIComponent(paramMap[prop])
|
||||
);
|
||||
}
|
||||
return '?' + qStrPairs.join('&');
|
||||
}
|
||||
@@ -44,7 +48,6 @@ jasmineRequire.QueryString = function() {
|
||||
|
||||
return paramMap;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return QueryString;
|
||||
|
||||
Reference in New Issue
Block a user