-
Notifications
You must be signed in to change notification settings - Fork 22
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
Add ability to register a11y matcher in jest config once per project #11
Comments
I am running into errors related to modules primarily because I think jest uses the CJS module system whereas the rest of the sa11y packages are using the ES modules. Not sure if it would help if I split the integration tests from the mono-repo into its own project. In the integration tests package: Baseline
extending
|
Ok I pulled your branch and tried it out. I got it working after making a couple changes.
You were on to something when you mentioned the module format. You don't have to update any of your authored source code, but in the root level
The
This one is broader and more my opinion than a "bug". I think having So what I would do is remove the
where
I think this is a reasonable thing for consuming projects to do so appropriate for this integration test package. Finally, if you run the Jest tests from the top level this will still fail because that will use the root level jest config instead of the integration test package config. I'd either create a separate npm script for running tests in this package, or have each sub package extend a base config and then have this package also have the |
That is awesome 🎉. Thanks a lot @trevor-bliss
Thanks a lot for this! |
Fixed by #9 |
If you came here because you had this error, be aware that the Api has changed from https://www.npmjs.com/package/@sa11y/jest
|
Motivation
The a11y matcher API has to be registered before its used. Currently this needs to be done in each test module as part of test setup as shown below.
This could be made less tedious by registering the a11y matchers once in the jest config of the consuming project and then all the tests in the project can use the a11y API without any additional setup.
For example a consuming project should be able to register a11y matchers by extending the config as below in the
jest.config.js
at the project root:Resources
Similar setup can be found in
The text was updated successfully, but these errors were encountered: