Removed expect/expectAsync indirection through spec/suite

This commit is contained in:
Steve Gravrock
2023-06-21 19:23:54 -07:00
parent f8e4ea868f
commit 59600a1c29
4 changed files with 16 additions and 40 deletions

View File

@@ -809,14 +809,6 @@ getJasmineRequireObj().Spec = function(j$) {
this.result.properties[key] = value; this.result.properties[key] = value;
}; };
Spec.prototype.expect = function(actual) {
return this.expectationFactory(actual, this);
};
Spec.prototype.expectAsync = function(actual) {
return this.asyncExpectationFactory(actual, this);
};
Spec.prototype.execute = function( Spec.prototype.execute = function(
queueRunnerFactory, queueRunnerFactory,
onComplete, onComplete,
@@ -1904,23 +1896,27 @@ getJasmineRequireObj().Env = function(j$) {
}; };
this.expect = function(actual) { this.expect = function(actual) {
if (!runner.currentRunable()) { const runable = runner.currentRunable();
if (!runable) {
throw new Error( throw new Error(
"'expect' was used when there was no current spec, this could be because an asynchronous test timed out" "'expect' was used when there was no current spec, this could be because an asynchronous test timed out"
); );
} }
return runner.currentRunable().expect(actual); return runable.expectationFactory(actual, runable);
}; };
this.expectAsync = function(actual) { this.expectAsync = function(actual) {
if (!runner.currentRunable()) { const runable = runner.currentRunable();
if (!runable) {
throw new Error( throw new Error(
"'expectAsync' was used when there was no current spec, this could be because an asynchronous test timed out" "'expectAsync' was used when there was no current spec, this could be because an asynchronous test timed out"
); );
} }
return runner.currentRunable().expectAsync(actual); return runable.asyncExpectationFactory(actual, runable);
}; };
this.beforeEach = function(beforeEachFunction, timeout) { this.beforeEach = function(beforeEachFunction, timeout) {
@@ -9755,14 +9751,6 @@ getJasmineRequireObj().Suite = function(j$) {
this.result.properties[key] = value; this.result.properties[key] = value;
}; };
Suite.prototype.expect = function(actual) {
return this.expectationFactory(actual, this);
};
Suite.prototype.expectAsync = function(actual) {
return this.asyncExpectationFactory(actual, this);
};
Suite.prototype.getFullName = function() { Suite.prototype.getFullName = function() {
const fullName = []; const fullName = [];
for ( for (

View File

@@ -767,23 +767,27 @@ getJasmineRequireObj().Env = function(j$) {
}; };
this.expect = function(actual) { this.expect = function(actual) {
if (!runner.currentRunable()) { const runable = runner.currentRunable();
if (!runable) {
throw new Error( throw new Error(
"'expect' was used when there was no current spec, this could be because an asynchronous test timed out" "'expect' was used when there was no current spec, this could be because an asynchronous test timed out"
); );
} }
return runner.currentRunable().expect(actual); return runable.expectationFactory(actual, runable);
}; };
this.expectAsync = function(actual) { this.expectAsync = function(actual) {
if (!runner.currentRunable()) { const runable = runner.currentRunable();
if (!runable) {
throw new Error( throw new Error(
"'expectAsync' was used when there was no current spec, this could be because an asynchronous test timed out" "'expectAsync' was used when there was no current spec, this could be because an asynchronous test timed out"
); );
} }
return runner.currentRunable().expectAsync(actual); return runable.asyncExpectationFactory(actual, runable);
}; };
this.beforeEach = function(beforeEachFunction, timeout) { this.beforeEach = function(beforeEachFunction, timeout) {

View File

@@ -70,14 +70,6 @@ getJasmineRequireObj().Spec = function(j$) {
this.result.properties[key] = value; this.result.properties[key] = value;
}; };
Spec.prototype.expect = function(actual) {
return this.expectationFactory(actual, this);
};
Spec.prototype.expectAsync = function(actual) {
return this.asyncExpectationFactory(actual, this);
};
Spec.prototype.execute = function( Spec.prototype.execute = function(
queueRunnerFactory, queueRunnerFactory,
onComplete, onComplete,

View File

@@ -28,14 +28,6 @@ getJasmineRequireObj().Suite = function(j$) {
this.result.properties[key] = value; this.result.properties[key] = value;
}; };
Suite.prototype.expect = function(actual) {
return this.expectationFactory(actual, this);
};
Suite.prototype.expectAsync = function(actual) {
return this.asyncExpectationFactory(actual, this);
};
Suite.prototype.getFullName = function() { Suite.prototype.getFullName = function() {
const fullName = []; const fullName = [];
for ( for (