Skip to content

Commit 8844aea

Browse files
committed
fix(audits/server): url option can also just be a Promise
1 parent 370fca5 commit 8844aea

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

docs/interfaces/audits_server.ServerAuditOptions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ ___
3131

3232
### url
3333

34-
**url**: `string` \| () => `string` \| `Promise`<`string`\>
34+
**url**: `string` \| `Promise`<`string`\> \| () => `string` \| `Promise`<`string`\>
3535

3636
The URL of the GraphQL server for the audit.
3737

src/audits/server.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export interface ServerAuditOptions {
2424
* A function can be also supplied, in this case -
2525
* every audit will invoke the function to get the URL.
2626
*/
27-
url: string | (() => string | Promise<string>);
27+
url: string | Promise<string> | (() => string | Promise<string>);
2828
/**
2929
* The Fetch function to use.
3030
*
@@ -950,10 +950,10 @@ export async function auditServer(
950950

951951
/** @private */
952952
async function getUrl(
953-
url: string | (() => string | Promise<string>),
953+
url: string | Promise<string> | (() => string | Promise<string>),
954954
): Promise<string> {
955-
if (typeof url === 'string') {
956-
return url;
955+
if (typeof url === 'function') {
956+
return await url();
957957
}
958-
return await url();
958+
return url;
959959
}

0 commit comments

Comments
 (0)