11import chalk from 'chalk' ;
22import open from "open" ;
33import { randomUUIDBase62 } from './_internalUtils.js' ;
4- import { FlakinessProjectConfig } from "./flakinessProjectConfig.js" ;
54import { StaticServer } from './staticServer.js' ;
65
76/**
@@ -14,35 +13,34 @@ import { StaticServer } from './staticServer.js';
1413 *
1514 * @param {string } reportFolder - Absolute or relative path to the folder containing
1615 * the Flakiness report.
16+ * @param {object } [options] - Optional configuration.
17+ * @param {string } [options.reportViewerUrl] - Custom report viewer URL. Defaults to
18+ * `https://report.flakiness.io`.
1719 *
1820 * @example
1921 * ```typescript
2022 * await showReport('./flakiness-report');
2123 * ```
2224 */
23- export async function showReport ( reportFolder : string ) {
24- const config = await FlakinessProjectConfig . load ( ) ;
25- const projectPublicId = config . projectPublicId ( ) ;
26-
27- const reportViewerEndpoint = config . reportViewerUrl ( ) ;
28-
25+ export async function showReport ( reportFolder : string , options ?: {
26+ reportViewerUrl ?: string ,
27+ } ) {
28+ const reportViewerUrl = options ?. reportViewerUrl ?? 'https://report.flakiness.io' ;
2929 const token = randomUUIDBase62 ( ) ;
3030 const server = new StaticServer ( token , reportFolder , [
31- reportViewerEndpoint ,
31+ reportViewerUrl ,
3232 // trace.playwright.dev is used to load & display Playwright Test traces.
3333 'https://trace.playwright.dev' ,
3434 ] ) ;
3535 await server . start ( 9373 , '127.0.0.1' ) ;
3636
37- const url = new URL ( reportViewerEndpoint ) ;
37+ const url = new URL ( reportViewerUrl ) ;
3838 url . searchParams . set ( 'port' , String ( server . port ( ) ) ) ;
3939 url . searchParams . set ( 'token' , token ) ;
40- if ( projectPublicId )
41- url . searchParams . set ( 'ppid' , projectPublicId ) ;
4240
4341 console . log ( chalk . cyan ( `
4442 Serving Flakiness report at ${ ( url . toString ( ) ) }
4543 Press Ctrl+C to quit.` ) )
4644 await open ( url . toString ( ) ) ;
4745 await new Promise ( ( ) => { } ) ;
48- }
46+ }
0 commit comments