Closed dwightjack closed 5 years ago
Forgot to mention: I addressed the same issue solved in #2 by placing axe-core in the peerDependencies
list.
Until this PR gets approved, I'm going to have to use the source branch directly.
Typings:
declare module 'axe-testcafe' {
import { ElementContext, RunOnly, AxeResults, Result } from 'axe-core';
import 'testcafe';
export function axeCheck(
t: TestController,
context?: ElementContext,
options?: {
runOnly?: RunOnly;
rules?: Object;
iframes?: Boolean;
elementRef?: Boolean;
selectors?: Boolean;
}
): Promise<AxeResults>;
export function createReport(violations: Result[]): string;
}
Ping @helen-dikareva, would you / testcafe like some support maintaining this plugin?
@helen-dikareva Thanks for your review. 😃
Right now there's a conflict in the package.json
. 😢
This is great, thanks for your work!
Can we also get the typings added as mentioned in this comment? https://github.com/helen-dikareva/axe-testcafe/pull/3#issuecomment-430876982
It would be great to get this in so we can start using an updated axe-core.
@jrparish I added an index.d.ts file with the type declarations referenced it ona typings
property in the package.json.
I hope I got it right right. Let me know if there something I missed.
Typings look good.
There seems to be an issue with the package.json after the latest merge with master though.
Might need to update the peer dependency to be:
"axe-core": ">=2.2.3 <4"
@dwightjack - are you able to fix the peer dependency in package.json?
@jrparish sure! I'm traveling until the 5th so I won't be able to work on it right away.
@jrparish Sorry for the delay!
Fixed package.json
and updated the peer dependency.
So now this has been merged, is it possible to get a release?
I really like the idea to be able to use axe-core with testcafe. So I've picked up this plugin and made some updates and changes:
1) Set the minimum node version requirement to >=8.9.0. Testcafe uses async/await so it makes sense. 2) Updated the language to es2015+. That is just to leverage some es2015 syntactic sugar. 3) Instead of throwing on error, now
axeCheck
returns an object witherror
(populated whenever an error occurs) andviolations
(axe-core reported violations) properties. That way the user can useviolations
in at.expect
call. 4) Extracted the report generation logic to its own function. That makes possible to opt for a custom reporter instead of the default one.