Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions apps/ssr-tests-v9/src/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@ export function hrToSeconds(hrtime: ReturnType<typeof process.hrtime>): string {

return raw.toFixed(2) + 's';
}

export function containsAriaDescriptionWarning(message: string): boolean {
return message.startsWith(
'Warning: Invalid aria prop %s on <%s> tag. For details, see https://reactjs.org/link/invalid-aria-props%s `aria-description`',
);
}
14 changes: 12 additions & 2 deletions apps/ssr-tests-v9/src/utils/visitPage.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import type { Browser } from 'puppeteer';
import { visitUrl } from '@fluentui/scripts-puppeteer';
import { PROVIDER_ID } from './constants';
import * as React from 'react';
import { containsAriaDescriptionWarning } from './helpers';

class RenderError extends Error {
public name = 'RangeError';
Expand All @@ -14,9 +16,17 @@ export async function visitPage(browser: Browser, url: string) {

page.on('console', message => {
if (message.type() === 'error') {
const messageContent = message.text();

// Ignoring 'aria-description' warning from react 17 as it's a valid prop
// https://github.com/facebook/react/issues/21035
if (containsAriaDescriptionWarning(messageContent) && React.version.startsWith('17')) {
return;
}

// Ignoring network errors as we have an interceptor that prevents loading everything except our JS bundle
if (!message.text().includes('net::ERR_FAILED')) {
error = new RenderError(message.text());
if (!messageContent.includes('net::ERR_FAILED')) {
error = new RenderError(messageContent);
}
}
});
Expand Down