-
Notifications
You must be signed in to change notification settings - Fork 10
Set up jest-axe for a11y testing #2262
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
Conversation
This is so we don't forget to await the a11y checks. Also fixing some linting issues that were caught when this rule was enabled
🦋 Changeset detectedLatest commit: c969e7a The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Size Change: 0 B Total Size: 97.1 kB ℹ️ View Unchanged
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2262 +/- ##
==========================================
+ Coverage 93.91% 96.36% +2.45%
==========================================
Files 248 248
Lines 29514 29514
Branches 2407 2538 +131
==========================================
+ Hits 27717 28441 +724
+ Misses 1793 1056 -737
- Partials 4 17 +13 see 54 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
A new build was pushed to Chromatic! 🚀undefined Chromatic results:
|
@@ -47,7 +47,7 @@ describe("Test utils", () => { | |||
await promise; | |||
|
|||
// Assert | |||
expect(promise).resolves.toHaveProperty("type", "resize"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixing this after the jest-await-async-matchers
rule caught this
@@ -259,7 +259,7 @@ describe("RespondWith", () => { | |||
const act = Promise.race([settleableResponse, otherResponse]); | |||
|
|||
// Assert | |||
await expect(act).resolves; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The jest-await-async-matchers
linting rule was complaining about this too. The suggested fix was to add await
before it(...)
where we define the test case, but that had errors too. Updating it to use toResolve
instead seemed to fix it and the tests still pass. Let me know if you have any other suggestions for this!
@@ -53,7 +53,7 @@ jobs: | |||
with: | |||
changed-files: ${{ steps.changed.outputs.files }} | |||
files: packages/ # Only look for changes in packages | |||
globs: "!(**/__tests__/**), !(**/dist/*)" # Ignore test files | |||
globs: "!(**/__tests__/**), !(**/dist/*), !(**/*.test.ts)" # Ignore test files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excluding .test.ts
files from the changeset check
It was failing previously because there was no changeset for the wonder-blocks-layout
package. A changeset isn't needed since this package only has an updated test!
Error: Changeset entry required for @khanacademy/wonder-blocks-layout because there have been changes since the last release.
GeraldRequired Reviewers
Don't want to be involved in this pull request? Comment |
npm Snapshot: NOT Published🤕 Oh noes!! We couldn't find any changesets in this PR (7a516f9). As a result, we did not publish an npm snapshot for you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes all look reasonable to me, thank you Bea!
Summary:
jest-axe
toHaveNoA11yViolations
matcher for jest testsNote: this set up is similar to how
jest-axe
is set up in webapp (I referenced this jest-axe webapp PR!)Issue: WB-466
Test plan: