Merge branch 'properties' of https://github.com/johnjbarton/jasmine
* Merges #1763 from @johnjbarton
This commit is contained in:
@@ -314,7 +314,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
obj.constructor === jasmineGlobal.Set
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
j$.isWeakMap = function(obj) {
|
||||
return (
|
||||
obj !== null &&
|
||||
@@ -716,6 +716,7 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
* @property {String} pendingReason - If the spec is {@link pending}, this will be the reason.
|
||||
* @property {String} status - Once the spec has completed, this string represents the pass/fail status of this spec.
|
||||
* @property {number} duration - The time in ms used by the spec execution, including any before/afterEach.
|
||||
* @property {Object} properties - user-supplied key-value pairs.
|
||||
*/
|
||||
this.result = {
|
||||
id: this.id,
|
||||
@@ -725,7 +726,8 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
passedExpectations: [],
|
||||
deprecationWarnings: [],
|
||||
pendingReason: '',
|
||||
duration: null
|
||||
duration: null,
|
||||
properties: null
|
||||
};
|
||||
}
|
||||
|
||||
@@ -742,6 +744,11 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
}
|
||||
};
|
||||
|
||||
Spec.prototype.setSpecProperty = function(key, value) {
|
||||
this.result.properties = this.result.properties || {};
|
||||
this.result.properties[key] = value;
|
||||
};
|
||||
|
||||
Spec.prototype.expect = function(actual) {
|
||||
return this.expectationFactory(actual, this);
|
||||
};
|
||||
@@ -2068,6 +2075,24 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
return spec;
|
||||
};
|
||||
|
||||
this.setSpecProperty = function(key, value) {
|
||||
if (!currentRunnable() || currentRunnable() == currentSuite()) {
|
||||
throw new Error(
|
||||
"'setSpecProperty' was used when there was no current spec"
|
||||
);
|
||||
}
|
||||
currentRunnable().setSpecProperty(key, value);
|
||||
};
|
||||
|
||||
this.setSuiteProperty = function(key, value) {
|
||||
if (!currentSuite()) {
|
||||
throw new Error(
|
||||
"'setSuiteProperty' was used when there was no current suite"
|
||||
);
|
||||
}
|
||||
currentSuite().setSuiteProperty(key, value);
|
||||
};
|
||||
|
||||
this.expect = function(actual) {
|
||||
if (!currentRunnable()) {
|
||||
throw new Error(
|
||||
@@ -8348,6 +8373,7 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
* @property {Expectation[]} deprecationWarnings - The list of deprecation warnings that occurred on this suite.
|
||||
* @property {String} status - Once the suite has completed, this string represents the pass/fail status of this suite.
|
||||
* @property {number} duration - The time in ms for Suite execution, including any before/afterAll, before/afterEach.
|
||||
* @property {Object} properties - user-supplied key-value pairs.
|
||||
*/
|
||||
this.result = {
|
||||
id: this.id,
|
||||
@@ -8355,10 +8381,16 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
fullName: this.getFullName(),
|
||||
failedExpectations: [],
|
||||
deprecationWarnings: [],
|
||||
duration: null
|
||||
duration: null,
|
||||
properties: null
|
||||
};
|
||||
}
|
||||
|
||||
Suite.prototype.setSuiteProperty = function(key, value) {
|
||||
this.result.properties = this.result.properties || {};
|
||||
this.result.properties[key] = value;
|
||||
};
|
||||
|
||||
Suite.prototype.expect = function(actual) {
|
||||
return this.expectationFactory(actual, this);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user