diff --git a/src/testing-utils.ts b/src/testing-utils.ts index 60e8fb554..e5b622c25 100644 --- a/src/testing-utils.ts +++ b/src/testing-utils.ts @@ -357,6 +357,11 @@ class EnvBuilder< } } +export interface PassedAssertion { + result: Awaited; + assertionResult: T; +} + class CallableEnvBuilder< Args extends readonly any[], R, @@ -396,7 +401,7 @@ class CallableEnvBuilder< public async passes( assertion: (val: Awaited, ...assertionArgs: AArgs) => AResult, ...assertionArgs: AArgs - ): Promise { + ): Promise> { // this.call() may or may not return a promise, // `Promise.resolve` turns the result into one if it isn't already, // and we then await it. That ensures that `result` is an `Awaited`. @@ -410,8 +415,8 @@ class CallableEnvBuilder< await delayedCheck(this); } - // Return the result of the main assertion. - return assertionResult; + // Return the results of the function call and the main assertion. + return { result, assertionResult }; } /**