Comparing version 2.0.1 to 2.1.0
# Changelog | ||
## 2.1.0 (2018-04-09) | ||
* Respect the Pa11y `threshold` configuration option for individual urls when determining whether to pass or fail | ||
## 2.0.1 (2018-03-14) | ||
@@ -5,0 +9,0 @@ |
@@ -89,5 +89,6 @@ // | ||
const results = await pa11y(url, config); | ||
const withinThreshold = config.threshold ? results.issues.length <= config.threshold : false; | ||
let message = ` ${chalk.cyan('>')} ${url} - `; | ||
if (results.issues.length) { | ||
if (results.issues.length && !withinThreshold) { | ||
message += chalk.red(`${results.issues.length} errors`); | ||
@@ -99,2 +100,5 @@ log.error(message); | ||
message += chalk.green(`${results.issues.length} errors`); | ||
if (withinThreshold) { | ||
message += chalk.green(` (within threshold of ${config.threshold})`); | ||
} | ||
log.info(message); | ||
@@ -101,0 +105,0 @@ report.results[url] = []; |
{ | ||
"name": "pa11y-ci", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "Pa11y CI is a CI-centric accessibility test runner, built using Pa11y", | ||
@@ -5,0 +5,0 @@ "keywords": [], |
@@ -146,3 +146,3 @@ | ||
- [Automated accessibility testing with Travis and Pa11y CI](http://cruft.io/posts/automated-accessibility-testing-node-travis-ci-pa11y/) | ||
- [Automated accessibility testing with Travis and Pa11y CI](http://andrewmee.com/posts/automated-accessibility-testing-node-travis-ci-pa11y/) | ||
@@ -149,0 +149,0 @@ |
@@ -52,1 +52,24 @@ /* eslint max-len: 'off' */ | ||
}); | ||
describe('pa11y-ci (with URLs passing due to threshold)', () => { | ||
before(() => { | ||
return global.cliCall([ | ||
'--config', | ||
'passing-threshold' | ||
]); | ||
}); | ||
it('exits with 0', () => { | ||
assert.strictEqual(global.lastResult.code, 0); | ||
}); | ||
it('outputs a result notice for each URL', () => { | ||
assert.include(global.lastResult.output, 'http://localhost:8090/failing-1 - 1 errors (within threshold of 1)'); | ||
}); | ||
it('outputs a total passing notice', () => { | ||
assert.include(global.lastResult.output, '1/1 URLs passed'); | ||
}); | ||
}); |
@@ -258,2 +258,3 @@ /* eslint max-len: 'off' */ | ||
bar: 'baz', | ||
threshold: 2, | ||
concurrency: 4, | ||
@@ -266,3 +267,10 @@ wrapWidth: 80, | ||
pa11y.reset(); | ||
pa11y.withArgs('qux-url', userUrls[0]).resolves({issues: []}); | ||
pa11y.withArgs('qux-url', userUrls[0]).resolves({issues: [ | ||
{ | ||
type: 'error', | ||
message: 'Pa11y Result Error', | ||
selector: '', | ||
context: null | ||
} | ||
]}); | ||
@@ -288,3 +296,3 @@ returnedPromise = pa11yCi(userUrls, userOptions); | ||
it('correctly logs the number of errors for the URL', () => { | ||
assert.calledWithMatch(log.info, /qux-url.*0 errors/i); | ||
assert.calledWithMatch(log.info, /qux-url.*1 errors/i); | ||
}); | ||
@@ -296,2 +304,3 @@ | ||
assert.isObject(report.results); | ||
assert.strictEqual(report.passes, 1); | ||
assert.isArray(report.results['qux-url']); | ||
@@ -298,0 +307,0 @@ assert.lengthEquals(report.results['qux-url'], 0); |
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
63987
1351