Merge branch 'main' into better-error-handling
This commit is contained in:
commit
65ab729673
|
|
@ -185,7 +185,7 @@ export default class BrowsertimePlugin extends SitespeedioPlugin {
|
|||
// https://github.com/sitespeedio/sitespeed.io/issues/2341
|
||||
for (const element of result) {
|
||||
// Browsertime supports alias for URLS in a script
|
||||
const alias = element.info.alias;
|
||||
const alias = element.info?.alias;
|
||||
if (alias) {
|
||||
if (this.scriptOrMultiple) {
|
||||
url = element.info.url;
|
||||
|
|
@ -207,14 +207,32 @@ export default class BrowsertimePlugin extends SitespeedioPlugin {
|
|||
resultIndex++
|
||||
) {
|
||||
axeAggregatorPerURL = new AxeAggregator(this.options);
|
||||
// Send errors from Browsertime as early as possible
|
||||
// Check for errors. Browsertime errors is an array of all iterations
|
||||
// [[],[],[]] where one iteration can have multiple errors
|
||||
for (let errorsForOneIteration of result[resultIndex].errors) {
|
||||
if (Array.isArray(errorsForOneIteration)) {
|
||||
for (let error of errorsForOneIteration) {
|
||||
super.sendMessage('error', error, _merge({ url }));
|
||||
}
|
||||
} else {
|
||||
super.sendMessage(
|
||||
'error',
|
||||
`${errorsForOneIteration} ${result[resultIndex].failureMessages}`,
|
||||
_merge({ url })
|
||||
);
|
||||
}
|
||||
}
|
||||
// If we use scripts or multiple, use the URL from the tested page
|
||||
// so that we can handle click on links etc
|
||||
// see https://github.com/sitespeedio/sitespeed.io/issues/2260
|
||||
// we could change the plugins but since they do not work with
|
||||
// multiple/scripting lets do it like this for now
|
||||
if (this.scriptOrMultiple) {
|
||||
url = result[resultIndex].info.url;
|
||||
group = parse(url).hostname;
|
||||
url = result[resultIndex].info?.url;
|
||||
if (url) {
|
||||
group = parse(url).hostname;
|
||||
}
|
||||
}
|
||||
let runIndex = 0;
|
||||
for (let browserScriptsData of result[resultIndex].browserScripts) {
|
||||
|
|
@ -597,14 +615,6 @@ export default class BrowsertimePlugin extends SitespeedioPlugin {
|
|||
group
|
||||
});
|
||||
}
|
||||
|
||||
// Check for errors. Browsertime errors is an array of all iterations
|
||||
// [[],[],[]] where one iteration can have multiple errors
|
||||
for (let errorsForOneIteration of result[resultIndex].errors) {
|
||||
for (let error of errorsForOneIteration) {
|
||||
super.sendMessage('error', error, _merge({ url }));
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
} catch (error) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue