@@ -94,13 +94,6 @@ async function readOptions<
94
94
} ;
95
95
}
96
96
97
- export function getExistingApp < SLocals extends ServiceLocals = ServiceLocals > ( ) {
98
- if ( ! app ) {
99
- throw new Error ( 'getExistingApp requires a running app, and there is not one available.' ) ;
100
- }
101
- return app as ServiceExpress < SLocals > ;
102
- }
103
-
104
97
class RequestTestingHelpers {
105
98
_fetch : ReturnType < typeof makeFetch > ;
106
99
@@ -117,6 +110,18 @@ class RequestTestingHelpers {
117
110
}
118
111
}
119
112
113
+ export interface ServiceUnderTest < SLocals extends ServiceLocals = ServiceLocals >
114
+ extends ServiceExpress < SLocals > {
115
+ test : RequestTestingHelpers ;
116
+ }
117
+
118
+ export function getExistingApp < SLocals extends ServiceLocals = ServiceLocals > ( ) {
119
+ if ( ! app ) {
120
+ throw new Error ( 'getExistingApp requires a running app, and there is not one available.' ) ;
121
+ }
122
+ return app as ServiceUnderTest < SLocals > ;
123
+ }
124
+
120
125
export async function getReusableApp <
121
126
SLocals extends ServiceLocals = ServiceLocals ,
122
127
RLocals extends RequestLocals = RequestLocals ,
@@ -125,7 +130,7 @@ export async function getReusableApp<
125
130
| Partial < ServiceStartOptions < SLocals , RLocals > >
126
131
| ServiceFactory < SLocals , RLocals > ,
127
132
cwd ?: string ,
128
- ) : Promise < ServiceExpress < SLocals > & { test : RequestTestingHelpers } > {
133
+ ) : Promise < ServiceUnderTest < SLocals > > {
129
134
const logFn = ( error : Error ) => {
130
135
// eslint-disable-next-line no-console
131
136
console . error ( 'Could not start app' , error ) ;
0 commit comments