Comparing version 6.2.1 to 6.2.2
@@ -146,2 +146,3 @@ 'use strict'; | ||
* @private | ||
* @param {Object} url - The URL to test against | ||
* @param {Object} [options] - Options to change the way tests run. | ||
@@ -164,21 +165,25 @@ * @param {Object} state - The current pa11y internal state, fields will be mutated by | ||
state.consoleCallback = message => { | ||
const location = message.location(); | ||
const parsedUrl = new URL(location.url ? location.url : url); | ||
if (message.type() === 'log') { | ||
const location = message.location(); | ||
const parsedUrl = new URL(location.url ? location.url : url); | ||
// Try to follow devtool conventions when displaying the document name | ||
if (parsedUrl.pathname === '/') { | ||
// If the document is root, replace it with the hostname instead | ||
// e.g. '/' becomes 'www.pa11y.org' | ||
location.url = parsedUrl.hostname; | ||
// Try to follow devtool conventions when displaying the document name | ||
if (parsedUrl.pathname === '/') { | ||
// If the document is root, replace it with the hostname instead | ||
// e.g. '/' becomes 'www.pa11y.org' | ||
location.url = parsedUrl.hostname; | ||
} else { | ||
// The path is longer than '/' so we: | ||
// * remove the last character if it's a forward slash with replace | ||
// * split the path in different elements | ||
// * retrieve the last element of the path | ||
// e.g. '/foo/bar/baz/' becomes 'baz' | ||
location.url = parsedUrl.pathname.replace(/\/$/, '').split('/').pop(); | ||
} | ||
const locationString = `${location.url}:${location.lineNumber}:${location.columnNumber}`; | ||
options.log.debug(`Browser Console: ${locationString} ${message.text()}`); | ||
} else { | ||
// The path is longer than '/' so we: | ||
// * remove the last character if it's a forward slash with replace | ||
// * split the path in different elements | ||
// * retrieve the last element of the path | ||
// e.g. '/foo/bar/baz/' becomes 'baz' | ||
location.url = parsedUrl.pathname.replace(/\/$/, '').split('/').pop(); | ||
options.log.debug(`Browser Console: ${message.text()}`); | ||
} | ||
const locationString = `${location.url}:${location.lineNumber}:${location.columnNumber}`; | ||
options.log.debug(`Browser Console: ${locationString} ${message.text()}`); | ||
}; | ||
@@ -185,0 +190,0 @@ |
{ | ||
"name": "pa11y", | ||
"version": "6.2.1", | ||
"version": "6.2.2", | ||
"description": "Pa11y is your automated accessibility testing pal", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
104610
1882