feat(env): setSpecProperty/setSuiteProperty(key, value) to attach data to tests
Use setSpecProperty to attach key/value pairs to spec results that can be picked up in specialized jasmine reporters. Example use-cases include: * Tagging specs with URLs or string-tokens referencing test-plan docs. * Recording performance information for blocks of JS. Similarly setSuiteProperty attaches key/value pairs to suite results
This commit is contained in:
@@ -1124,6 +1124,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(
|
||||
|
||||
Reference in New Issue
Block a user