ci: minimum working example for jest-axe accessibility CI #412
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements the minimum overhead required to run
jest-axe
via GitHub Actions on a set of predefined components. In order, we:jest
,jest-axe
,@testing-library/react
,@testing-library/jest-dom
, the minimum set up for a viable test infrastructurejest
, we add a generaljest.config.js
as a jest configuration file, andjest.setup.js
as a pre-test setup file (automatically importing our dependencies)__mocks__/fileMock.js
) for most files, and theidentity-obj-proxy
to proxy-back CSS/SASS/SCSS class namesnext
preset to babelNewsArticle.test.js
, which is a simple subcomponent with no errors. You can validate this working by adding an arbitrary<img />
toNewsArticle.js
;npm test
will throw an error.Footer.test.js
, where an<ul>
has children that are not<li>
- showing that negatives work. I then resolve this issue.npm test
in itIdeally, you should be able to add more test files following the configuration in
NewsArticle.test.js
; note the strangelet
pattern with the async version ofact
.I didn't use the native next testing plugin, since that seems blocked by the upgrade to Next 12 (#409).
Part of #218, supersedes #301.
Relevant reading:
act()
in React