diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d1a2b5d..5afb4b2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: - node-version: [10, 12, 14] + node-version: [14, 16, 18] steps: - uses: actions/checkout@v2 diff --git a/.nvmrc b/.nvmrc index 48082f7..b6a7d89 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -12 +16 diff --git a/CHANGELOG.md b/CHANGELOG.md index e537922..c227192 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,19 @@ +# 7.0.0 + +Update main dependencies: +- axe-core from version 4.4.1 to 4.5.1 - thanks [@jbchr](https://github.com/jbchr). +- chalk updated from version 4.1.0 to 4.1.2 +- jest-matcher-utils updated from version 27.0.2 to 29.2.2 + +Breaking changes: +- axe-core includes new rules and checks which may need to be fixed or turned off +- axe-core help messages updates will change your snapshot output +- no longer support Node.js 10 and 12 + +# 6.0.1 + +- [Fix "Not implemented: window.computedStyle(elt, pseudoElt)" errors](https://github.com/NickColley/jest-axe/pull/252/commits/48824b2400b23bf2ff11bcccd090cf868b4fd8ec). + # 6.0.0 - Update axe-core to version 4.4.1 - thanks [@dafnem1](https://github.com/dafnem1). diff --git a/README.md b/README.md index b49eaa9..4730c0e 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ You'll also need to: ## Installation: ```bash -npm install --save-dev jest-axe +npm install --save-dev jest jest-axe jest-environment-jsdom ``` [TypeScript](https://www.typescriptlang.org/) users can install the community maintained types package: @@ -30,6 +30,9 @@ npm install --save-dev @types/jest-axe ## Usage: ```javascript +/** + * @jest-environment jsdom + */ const { axe, toHaveNoViolations } = require('jest-axe') expect.extend(toHaveNoViolations) diff --git a/__tests__/__snapshots__/index.test.js.snap b/__tests__/__snapshots__/index.test.js.snap index cb776f0..5b3d41e 100644 --- a/__tests__/__snapshots__/index.test.js.snap +++ b/__tests__/__snapshots__/index.test.js.snap @@ -5,37 +5,37 @@ exports[`jest-axe readme first readme example should demonstrate this matcher\`s Expected the HTML found at $('img') to have no violations: - + Received: -\\"Images must have alternate text (image-alt)\\" +"Images must have alternate text (image-alt)" Fix any of the following: Element does not have an alt attribute aria-label attribute does not exist or is empty aria-labelledby attribute does not exist, references elements that do not exist or references elements that are empty Element has no title attribute - Element's default semantics were not overridden with role=\\"none\\" or role=\\"presentation\\" + Element's default semantics were not overridden with role="none" or role="presentation" You can find more information on this issue here: -https://dequeuniversity.com/rules/axe/4.4/image-alt?application=axeAPI +https://dequeuniversity.com/rules/axe/4.5/image-alt?application=axeAPI ──────── Expected the HTML found at $('img') to have no violations: - + Received: -\\"All page content should be contained by landmarks (region)\\" +"All page content should be contained by landmarks (region)" Fix any of the following: Some page content is not contained by landmarks You can find more information on this issue here: -https://dequeuniversity.com/rules/axe/4.4/region?application=axeAPI" +https://dequeuniversity.com/rules/axe/4.5/region?application=axeAPI" `; exports[`jest-axe toHaveNoViolations returns correctly formatted message when violations are present 1`] = ` @@ -43,19 +43,19 @@ exports[`jest-axe toHaveNoViolations returns correctly formatted message when vi Expected the HTML found at $('body > img') to have no violations: - + Received: -\\"Images must have alternate text (image-alt)\\" +"Images must have alternate text (image-alt)" Fix any of the following: Element does not have an alt attribute aria-label attribute does not exist or is empty aria-labelledby attribute does not exist, references elements that do not exist or references elements that are empty or not visible Element has no title attribute or the title attribute is empty - Element's default semantics were not overridden with role=\\"presentation\\" - Element's default semantics were not overridden with role=\\"none\\" + Element's default semantics were not overridden with role="presentation" + Element's default semantics were not overridden with role="none" You can find more information on this issue here: https://dequeuniversity.com/rules/axe/2.6/image-alt?application=axeAPI" @@ -64,51 +64,51 @@ https://dequeuniversity.com/rules/axe/2.6/image-alt?application=axeAPI" exports[`jest-axe toHaveNoViolations returns properly formatted text with more complex example 1`] = ` "expect(received).toHaveNoViolations(expected) -Expected the HTML found at $('img[src$=\\"example.com\\"]') to have no violations: +Expected the HTML found at $('img[src$="example.com"]') to have no violations: - + Received: -\\"Images must have alternate text (image-alt)\\" +"Images must have alternate text (image-alt)" Fix any of the following: Element does not have an alt attribute aria-label attribute does not exist or is empty aria-labelledby attribute does not exist, references elements that do not exist or references elements that are empty Element has no title attribute - Element's default semantics were not overridden with role=\\"none\\" or role=\\"presentation\\" + Element's default semantics were not overridden with role="none" or role="presentation" You can find more information on this issue here: -https://dequeuniversity.com/rules/axe/4.4/image-alt?application=axeAPI +https://dequeuniversity.com/rules/axe/4.5/image-alt?application=axeAPI -Expected the HTML found at $('img[src=\\"http://example.com/2\\"]') to have no violations: +Expected the HTML found at $('img[src="http://example.com/2"]') to have no violations: - + Received: -\\"Images must have alternate text (image-alt)\\" +"Images must have alternate text (image-alt)" Fix any of the following: Element does not have an alt attribute aria-label attribute does not exist or is empty aria-labelledby attribute does not exist, references elements that do not exist or references elements that are empty Element has no title attribute - Element's default semantics were not overridden with role=\\"none\\" or role=\\"presentation\\" + Element's default semantics were not overridden with role="none" or role="presentation" You can find more information on this issue here: -https://dequeuniversity.com/rules/axe/4.4/image-alt?application=axeAPI +https://dequeuniversity.com/rules/axe/4.5/image-alt?application=axeAPI ──────── Expected the HTML found at $('input') to have no violations: - + Received: -\\"Form elements must have labels (label)\\" +"Form elements must have labels (label)" Fix any of the following: Form element does not have an implicit (wrapped)