Skip to content

Commit

Permalink
12 duplicate firebase urls generated (#13)
Browse files Browse the repository at this point in the history
* check hyperlink support in console-notifier.ts

* check hyperlink support in console-notifier.ts

* Update console-notifier.ts
  • Loading branch information
cybersokari authored Jan 6, 2025
1 parent ddf2069 commit 71c95fa
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions apps/cli/src/features/messaging/console-notifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,39 @@ export class ConsoleNotifier implements Notifier {
constructor(args: ArgsInterface) {
this.args = args;
}
private isHyperlinkSupported(): boolean {
// Check for CI environments or non-TTY outputs
return process.stdout.isTTY && !process.env.CI;
}

private link(text: string, url: string): string {
// Use `ansiEscapes.link` if hyperlinks are supported; otherwise, return plain text
return this.isHyperlinkSupported() ? ansiEscapes.link(text, url) : `${text} (${url})`;
}
async notify(data: NotificationData): Promise<void> {
const dashboardUrl = data.storageUrl
const reportUrl = data.reportUrl

if (dashboardUrl && reportUrl) {
appLog(`
${Icon.CHART} Test report URL : ${ansiEscapes.link(chalk.blue(reportUrl), reportUrl)}
${Icon.FILE_UPLOAD} Storage URL : ${ansiEscapes.link(chalk.blue(dashboardUrl), dashboardUrl)}
${Icon.CHART} Test report URL : ${this.link(chalk.blue(reportUrl), reportUrl)}
${Icon.FILE_UPLOAD} Storage URL : ${this.link(chalk.blue(dashboardUrl), dashboardUrl)}
${Icon.SUCCESS} Passed : ${chalk.yellow(data.resultStatus.passed)}
${Icon.WARNING} Broken : ${chalk.yellow(data.resultStatus.broken)}
`)
}

if (dashboardUrl && !reportUrl) {
appLog(`
${Icon.FILE_UPLOAD} Storage URL : ${ansiEscapes.link(chalk.blue(dashboardUrl), dashboardUrl)}
${Icon.FILE_UPLOAD} Storage URL : ${this.link(chalk.blue(dashboardUrl), dashboardUrl)}
${Icon.SUCCESS} Passed : ${chalk.yellow(data.resultStatus.passed)}
${Icon.WARNING} Broken : ${chalk.yellow(data.resultStatus.broken)}
`)
}

if (!dashboardUrl && reportUrl) {
appLog(`
${Icon.CHART} Test report URL : ${ansiEscapes.link(chalk.blue(reportUrl), reportUrl)}
${Icon.CHART} Test report URL : ${this.link(chalk.blue(reportUrl), reportUrl)}
${Icon.SUCCESS} Passed : ${chalk.yellow(data.resultStatus.passed)}
${Icon.WARNING} Broken : ${chalk.yellow(data.resultStatus.broken)}
`)
Expand Down

0 comments on commit 71c95fa

Please sign in to comment.