Skip to content

Commit

Permalink
test/integration: allow use of this.timeout() in FullTrx tests (#1402)
Browse files Browse the repository at this point in the history
Due to use of `function()` in the test wrappers, `this` was unbound from the real test functions.  This PR re-binds mocha's `this` to the test functions, allowing use of e.g. `this.timeout(...)` in individual "FullTrx" tests.
  • Loading branch information
alxndrsn authored Feb 18, 2025
1 parent 2f57a02 commit e7ec970
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/integration/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ const testService = (test) => () => new Promise((resolve, reject) => {
// we offer testServiceFullTrx:
const testServiceFullTrx = (test) => function() {
mustReinitAfter = this.test.fullTitle();
return test(augment(request(service(baseContainer))), baseContainer);
return test.call(this, augment(request(service(baseContainer))), baseContainer);
};

// for some tests we just want a container, without any of the webservice stuffs between.
Expand All @@ -176,7 +176,7 @@ const testContainer = (test) => () => new Promise((resolve, reject) => {
// complete the square of options:
const testContainerFullTrx = (test) => function() {
mustReinitAfter = this.test.fullTitle();
return test(baseContainer);
return test.call(this, baseContainer);
};

// called to get a container context per task. ditto all // from testService.
Expand All @@ -198,7 +198,7 @@ const testTask = (test) => () => new Promise((resolve, reject) => {
const testTaskFullTrx = (test) => function() {
mustReinitAfter = this.test.fullTitle();
task._container = baseContainer.with({ task: true });
return test(task._container);
return test.call(this, task._container);
};

// eslint-disable-next-line no-shadow
Expand Down

0 comments on commit e7ec970

Please sign in to comment.