Redesigned moudule system
* Top level private APIs (e.g. jasmine.private.whatever) are no longer exposed * jasmineRequire is no longer exposed * core is self-booting * Globals are automatically created in browsers. (They can subsequently be removed by user code if desired.) * Globals are *not* automatically created in Node. An installGlobals function is exported instead. The jasmine package calls installGlobals unless configured not to do so. * In Node, the same instance is returned each time jasmine-core is imported. A reset function is exported. It effectively resets all state by discarding the env and creating a new one. This allows mulitple sequential runs within the same process to be independent of each other, but does not allow multiple concurrent runs. (That probably never worked anyway.) Fixes #2094
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
getJasmineRequireObj().AllOf = function(j$) {
|
||||
getJasmineRequireObj().AllOf = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
function AllOf() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
getJasmineRequireObj().Any = function(j$) {
|
||||
getJasmineRequireObj().Any = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
function Any(expectedObject) {
|
||||
@@ -40,7 +40,7 @@ getJasmineRequireObj().Any = function(j$) {
|
||||
};
|
||||
|
||||
Any.prototype.jasmineToString = function() {
|
||||
return '<jasmine.any(' + j$.private.fnNameFor(this.expectedObject) + ')>';
|
||||
return '<jasmine.any(' + private$.fnNameFor(this.expectedObject) + ')>';
|
||||
};
|
||||
|
||||
return Any;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
getJasmineRequireObj().Anything = function(j$) {
|
||||
getJasmineRequireObj().Anything = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
function Anything() {}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
getJasmineRequireObj().ArrayContaining = function(j$) {
|
||||
getJasmineRequireObj().ArrayContaining = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
function ArrayContaining(sample) {
|
||||
@@ -9,7 +9,7 @@ getJasmineRequireObj().ArrayContaining = function(j$) {
|
||||
if (!Array.isArray(this.sample)) {
|
||||
throw new Error(
|
||||
'You must provide an array to arrayContaining, not ' +
|
||||
j$.private.basicPrettyPrinter(this.sample) +
|
||||
private$.basicPrettyPrinter(this.sample) +
|
||||
'.'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
getJasmineRequireObj().ArrayWithExactContents = function(j$) {
|
||||
getJasmineRequireObj().ArrayWithExactContents = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
function ArrayWithExactContents(sample) {
|
||||
@@ -12,7 +12,7 @@ getJasmineRequireObj().ArrayWithExactContents = function(j$) {
|
||||
if (!Array.isArray(this.sample)) {
|
||||
throw new Error(
|
||||
'You must provide an array to arrayWithExactContents, not ' +
|
||||
j$.private.basicPrettyPrinter(this.sample) +
|
||||
private$.basicPrettyPrinter(this.sample) +
|
||||
'.'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
getJasmineRequireObj().Empty = function(j$) {
|
||||
getJasmineRequireObj().Empty = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
function Empty() {}
|
||||
|
||||
Empty.prototype.asymmetricMatch = function(other) {
|
||||
if (
|
||||
j$.private.isString(other) ||
|
||||
private$.isString(other) ||
|
||||
Array.isArray(other) ||
|
||||
j$.private.isTypedArray(other)
|
||||
private$.isTypedArray(other)
|
||||
) {
|
||||
return other.length === 0;
|
||||
}
|
||||
|
||||
if (j$.private.isMap(other) || j$.private.isSet(other)) {
|
||||
if (private$.isMap(other) || private$.isSet(other)) {
|
||||
return other.size === 0;
|
||||
}
|
||||
|
||||
if (j$.private.isObject(other)) {
|
||||
if (private$.isObject(other)) {
|
||||
return Object.keys(other).length === 0;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
getJasmineRequireObj().Falsy = function(j$) {
|
||||
getJasmineRequireObj().Falsy = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
function Falsy() {}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
getJasmineRequireObj().Is = function(j$) {
|
||||
getJasmineRequireObj().Is = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
class Is {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
getJasmineRequireObj().MapContaining = function(j$) {
|
||||
getJasmineRequireObj().MapContaining = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
function MapContaining(sample) {
|
||||
if (!j$.private.isMap(sample)) {
|
||||
if (!private$.isMap(sample)) {
|
||||
throw new Error(
|
||||
'You must provide a map to `mapContaining`, not ' +
|
||||
j$.private.basicPrettyPrinter(sample)
|
||||
private$.basicPrettyPrinter(sample)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ getJasmineRequireObj().MapContaining = function(j$) {
|
||||
}
|
||||
|
||||
MapContaining.prototype.asymmetricMatch = function(other, matchersUtil) {
|
||||
if (!j$.private.isMap(other)) {
|
||||
if (!private$.isMap(other)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
getJasmineRequireObj().NotEmpty = function(j$) {
|
||||
getJasmineRequireObj().NotEmpty = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
function NotEmpty() {}
|
||||
|
||||
NotEmpty.prototype.asymmetricMatch = function(other) {
|
||||
if (
|
||||
j$.private.isString(other) ||
|
||||
private$.isString(other) ||
|
||||
Array.isArray(other) ||
|
||||
j$.private.isTypedArray(other)
|
||||
private$.isTypedArray(other)
|
||||
) {
|
||||
return other.length !== 0;
|
||||
}
|
||||
|
||||
if (j$.private.isMap(other) || j$.private.isSet(other)) {
|
||||
if (private$.isMap(other) || private$.isSet(other)) {
|
||||
return other.size !== 0;
|
||||
}
|
||||
|
||||
if (j$.private.isObject(other)) {
|
||||
if (private$.isObject(other)) {
|
||||
return Object.keys(other).length !== 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
getJasmineRequireObj().ObjectContaining = function(j$) {
|
||||
getJasmineRequireObj().ObjectContaining = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
function ObjectContaining(sample) {
|
||||
@@ -42,7 +42,7 @@ getJasmineRequireObj().ObjectContaining = function(j$) {
|
||||
};
|
||||
|
||||
ObjectContaining.prototype.valuesForDiff_ = function(other, pp) {
|
||||
if (!j$.private.isObject(other)) {
|
||||
if (!private$.isObject(other)) {
|
||||
return {
|
||||
self: this.jasmineToString(pp),
|
||||
other: other
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
getJasmineRequireObj().SetContaining = function(j$) {
|
||||
getJasmineRequireObj().SetContaining = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
function SetContaining(sample) {
|
||||
if (!j$.private.isSet(sample)) {
|
||||
if (!private$.isSet(sample)) {
|
||||
throw new Error(
|
||||
'You must provide a set to `setContaining`, not ' +
|
||||
j$.private.basicPrettyPrinter(sample)
|
||||
private$.basicPrettyPrinter(sample)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ getJasmineRequireObj().SetContaining = function(j$) {
|
||||
}
|
||||
|
||||
SetContaining.prototype.asymmetricMatch = function(other, matchersUtil) {
|
||||
if (!j$.private.isSet(other)) {
|
||||
if (!private$.isSet(other)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
getJasmineRequireObj().StringContaining = function(j$) {
|
||||
getJasmineRequireObj().StringContaining = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
function StringContaining(expected) {
|
||||
if (!j$.private.isString(expected)) {
|
||||
if (!private$.isString(expected)) {
|
||||
throw new Error('Expected is not a String');
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ getJasmineRequireObj().StringContaining = function(j$) {
|
||||
}
|
||||
|
||||
StringContaining.prototype.asymmetricMatch = function(other) {
|
||||
if (!j$.private.isString(other)) {
|
||||
if (!private$.isString(other)) {
|
||||
// Arrays, etc. don't match no matter what their indexOf returns.
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
getJasmineRequireObj().StringMatching = function(j$) {
|
||||
getJasmineRequireObj().StringMatching = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
function StringMatching(expected) {
|
||||
if (!j$.private.isString(expected) && !j$.private.isA('RegExp', expected)) {
|
||||
if (!private$.isString(expected) && !private$.isA('RegExp', expected)) {
|
||||
throw new Error('Expected is not a String or a RegExp');
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
getJasmineRequireObj().Truthy = function(j$) {
|
||||
getJasmineRequireObj().Truthy = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
function Truthy() {}
|
||||
|
||||
Reference in New Issue
Block a user