Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retry launching browser once if it fails the first time #138

Merged
merged 1 commit into from
Jun 28, 2021
Merged
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
18 changes: 16 additions & 2 deletions lib/pa11y-ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,22 @@ module.exports.defaults = {
function pa11yCi(urls, options) {
return new Promise(async resolve => {
// Create a test browser to assign to tests
const testBrowser = await puppeteer.launch(options.chromeLaunchConfig);
let testBrowser;

// Issue #128: on specific URLs, Chrome will sometimes fail to load
// the page, or crash during or after loading. This attempts to
// relaunch the browser just once before bailing out, in case Chrome
// crashed at startup. This is just an attempt at mitigating it,
// it won't fix #128 completely or even at all
try {
testBrowser = await puppeteer.launch(
options.chromeLaunchConfig
);
} catch (error) {
testBrowser = await puppeteer.launch(
options.chromeLaunchConfig
);
}

// Default the passed in options
options = defaults({}, options, module.exports.defaults);
Expand All @@ -52,7 +67,6 @@ function pa11yCi(urls, options) {
const log = options.log;
delete options.log;


// Create a Pa11y test function and an async queue
const taskQueue = queue(testRunner, options.concurrency);
taskQueue.drain = testRunComplete;
Expand Down