Browse Source

Define getters for t.title and t.end() in PublicApi class

master
Mark Wubben 8 years ago
committed by Sindre Sorhus
parent
commit
0b11db7741
  1. 19
      lib/test.js

19
lib/test.js

@ -43,6 +43,12 @@ class PublicApi {
Error.stackTraceLimit = limitBefore;
this._test.plan(ct, obj.stack);
}
get end() {
return this._test.end;
}
get title() {
return this._test.title;
}
get context() {
const contextRef = this._test.contextRef;
return contextRef && contextRef.context;
@ -98,19 +104,6 @@ Object.assign(PublicApi.prototype, enhanceAssert({
onError: onAssertionEvent
}));
// Getters
[
'title',
'end'
]
.forEach(name => {
Object.defineProperty(PublicApi.prototype, name, {
get() {
return this._test[name];
}
});
});
Object.defineProperty(PublicApi.prototype, 'context', {enumerable: true});
class Test {

Loading…
Cancel
Save