GithubHelp home page GithubHelp logo

jest-axe's People

Contributors

camdub avatar cjoshmartin avatar connor-baer avatar dakebl avatar dependabot-preview[bot] avatar dependabot[bot] avatar dominicfraser avatar dwightjack avatar foxandxss avatar greenkeeper[bot] avatar j2kenton avatar lpelypenko avatar mcataford avatar nickcolley avatar piperchester avatar pranjaljately avatar raven-wills avatar rzane avatar shaundr avatar simenb avatar stephenmathieson avatar thomasheyenbrock avatar ubbe-xyz avatar zcolleyz avatar zoetrope69 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

jest-axe's Issues

TypeScript typings?

This matcher is AWESOME. I'd love to use it in TypeScript projects at scale. Would you be up for including .d.ts files with it?

specify axe.run parameters

Is it possible to specify the run parameters? I'm particularly interested in the Include-Exclude Object

Update thanks

Should include the Design System team, GOV.UK team, Jest and Axe

Clarify which rules are run by default

Hey folks, apologies for the silly question.

I looked around, but couldn't confirm which rule sets are run by default if axe is not configured with custom options. In axe-core's docs, it's mentioned that experimental rules are off by default; does that mean all rules here but experimental rules are run by default through jest-axe?

Thank you.

axe-core 4.1.1 support

Is there any estimate on an update to the axe-core version/is it actively being worked?

We use this package and have color contrast tests disabled in a few areas due to bugs existing in axe-core. Since axe-core has been updated (and apparently has fixed for those issues), I wanted to make an issue here for tracking.

Thank you for all you've done with this package!

Confused about "No violations found in aXe results object" error

First, thanks for this break tool.
It was very easy to set up.

The error I get

I get this error:

  ● <KFormInputLabel> β€Ί Does not have basic accessibility issues

    No violations found in aXe results object

      64 | 
      65 |     const a11yTestResults = configuredAxe(component.container);
    > 66 |     expect(a11yTestResults).toHaveNoViolations();
         |                             ^
      67 |   });

Here's my code:

import * as React from "react";
import { render, cleanup } from "@testing-library/react";
import { toHaveNoViolations, axe } from "jest-axe";
import "@testing-library/jest-dom";

expect.extend(toHaveNoViolations);

/* more code */

describe("<KFormInputLabel>", () => {
  afterEach(() => {
    jest.resetAllMocks();
    cleanup();
  });

  /* more code */

  it("Does not have basic accessibility issues", async () => {
    const component = render(
      <KFormInputLabel htmlFor="dow3uef98i6">
        Label text
      </KFormInputLabel>
    );

    const a11yTestResults = axe(
      component.container
    );
    expect(a11yTestResults).toHaveNoViolations();
  });
});

I'm not sure what the error means, or what to do about it

"No violations found in aXe results object" sounds like the test should pass. So why does it fail?

Also, I can't see why I'm getting this error when testing this component. It didn't happen it other places where I've used the same test code.

Any thought or guidance would help.

React-dom warning on every test

Hey, jest-axe is fantastic and very helpful in teaching my team more a11y responsibility. My tests are working, but on every single file, I am getting the following error:

console.error node_modules/react-dom/cjs/react-dom.development.js:88 Warning: render(): Rendering components directly into document.body is discouraged since its children are often manipulated by third-party scripts and browser extensions. This may lead to subtle reconciliation issues. Try rendering into a container element created for your app.

Mainly, this is inconvenient. It fills up the terminal and constantly prompts questions from the team. I do not see a way to turn it off from the react-dom side, and I'm curious if there is another solution from the jest-axe side. Our app was built with CRA, so our jest customization options are limited as well.

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Replaced the old Node.js version in your .nvmrc with the new one
  • The new Node.js version is in-range for the engines in 1 of your package.json files, so that was left alone

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected πŸ€–


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Add support for `toHaveNoIncomplete`

I came across this when trying to determine the root cause of what I originally thought was a bug. I had a test that I expected to have an aXe failure, but it turns out it is falling into the incomplete array of rule checks. I assume the toHaveNoViolations matcher essentially checks the for violations.length === 0; I'd like to propose a corresponding toHaveNoIncomplete matcher which checks the incomplete array.

Not able to find vioaltions

I am writing a sample test for accessibility scan. I could see that the axe run is not able to find the violations in the inner HTML.

Example unit test :

test("Sample Accessibility Test", async () => {
	const sampleHTML: string = "<div class=\"abc1\" role=\"main\"><div class=\"page-content\"><div class=\"abc1-container\"><div class=\"abc1-content\"><div class=\"abc2\"><button type=\"button\" id=\"my-button\" class=\"my-button\" data-is-focusable=\"true\"><span class=\"abc3\" data-automationid=\"splitbuttonprimary\"><span class=\"textContainer\"><span class=\"label\" id=\"my-label\">Sample Button</span></span></span></button></div></div></div></div></div>";
	const results = await axe(sampleHTML);
	expect(results).toHaveNoViolations();
});

Actual -
This test passes with no violations.

Expected -
The test should fail with violations related to aira-labels for the button.

Define impact level

First of all: Great job!

It would be nice if it were possible to define the impact levels that should be used ("critical", "moderate", "etc.") .

This axe plugin for cypress does this in a very nice way (see here - includedImpacts).

Breaking changes on 3.4

Hi there, thanks for your work on jest-axe!

I just upgraded to 3.4 and I'm getting the following error (I suspect related to the axe update):

 "All page content must be contained by landmarks (region)"

I can set up a global config as you suggest on the readme but I was wondering if it would make sense to disable this rule by default on unit tests

toHaveNoViolations does not exist on type Matchers<any> typescript

I get the following error when trying to get this working with ts-jest:

TypeScript diagnostics (customize using `[jest-config].globals.ts-jest.diagnostics` option):
    src/components/PriceBreakdown/components/ChargesList/ChargesList.test.tsx:124:19 - error TS2339: Property 'toHaveNoViolations' does not exist on type 'Matchers<any>'.

I am following the documentation correctly so I was just wondering if there is any documentation around using this with typescript.

example of how I am using it:

import { axe, toHaveNoViolations } from "jest-axe";

expect.extend(toHaveNoViolations);

it("should be accessible", async () => {
         // wrap is just a react component
	const { container } = wrap([fee1, fee2, fee3], "Some text", true);
	const results = await axe(container);
	expect(results).toHaveNoViolations();
});

Cannot install with yarn in combination with NodeJS 9

When installing jest-axe with the command yarn add jest-axe -D on a NodeJS 9 system the following error appears:

error [email protected]: The engine "node" is incompatible with this module. Expected version "8.9.4".
error Found incompatible module

If i directly require a copy of the jest-axe/index.js file in my project then all is well. So removing/changing the engines/node variable in package.json might resolve this problem.

How to fire a click event before rendering the component

Sorry for posting here instead of StackOverflow. There aren't any tags for jest-axe on SO and I couldn't find any spectrum chat either. I'll close this issue as soon as I get a reply.

I have a dialog component that needs to have its state set to open to render it. In react-testing-library I simply include a button in the initial render that sets the dialog state to open onClick (and removes the button from the DOM), so all I need to do is include fireEvent.click(button) before I run any tests to get the component to render. I'm not sure how to do this with jest-axe though and can't find anything about it in the documentation.

How do I go about doing this?

An in-range update of @testing-library/react is breaking the build 🚨

The devDependency @testing-library/react was updated from 9.1.0 to 9.1.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@testing-library/react is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Release Notes for v9.1.1

9.1.1 (2019-08-12)

Bug Fixes

Commits

The new version differs by 1 commits.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

RTL - tests timing out

Hi @NickColley!

first of all thanks for your contribution in a11y tooling, it definitely helps making apps more inclusive. Regarding my issue, some of my tests are timing out after having jest-aXe integrated in my React Testing Library suite. I do have a quite recent version of RTL so cleanup won't help.

It is interesting to point that tests would pass:

  • --runInBand flag was used

Regarding the context of tests, all of them are "wrapper" components (like forms) and not bare elements, and they don't really make any extra assertions. They are just rendered and then passed to jest-aXe. It should be noted that prior to aXe's integration, their it renders correctly case would never have any issues. AFAIK, at the time of the timeout <body /> is empty.

Have already tried fiddling with the testTimeout and --max-old-space-size to no avail.

Any ideas of what might be the culprit or steps to identify potential problems are more than welcome.

Thanks in advance!

jest.useFakeTimers causes test timeout

Here is a simple repro, the test below passes. If you uncomment the jest.useFakeTimers() in the beforeEach the test will timeout no matter what else you do.

import React from 'react'
import { mount } from 'enzyme'

import { toHaveNoViolations, axe } from 'jest-axe'

expect.extend(toHaveNoViolations)

const MyComponent = () => {
    return <div></div>
}

describe('myComponent', () => {
    beforeEach(() => {
        //jest.useFakeTimers()
    })

    it('does not hit a timeout', async () => {
        const wrapper = mount(<MyComponent />)

        const result = await axe(wrapper.getDOMNode())

        expect(result).toHaveNoViolations()
    })
})

Version Details:
jest-axe: 4.1.0
jest: 26.6.3
axe-core: 4.1.1

Fails to check full html document

I'm trying to test the accessibility of the document.

expect(await axe(document.documentElement.outerHtlm)).toHaveNoViolations() does not produce the expected violations, even if you pass is an obviously faulty string (e.g a document without title it isn't flagged, though it is mentioned in the axe-core docs)

Does jest-axe not support the full functionality of axe-core?

Duplicate ID false flag with Vue component (attachToDocument)

Hello, I'm not sure it's directly an issue on our side, but I will ask.

I'm using jest-axe to test Vue component (with vue-test-utils), and since the update of jest-axe v3.1.1, it return errors for duplicate id ("id attribute value must be unique (duplicate-id)") for some of my component. But after verification, the ID are not duplicated, it seem that these false errors are only throw when mounting the component with the option attachToDocument set to true.

Here are a simple example:

testId.vue

<template>
    <div>
        <p id="test-id">Test Id</p>
    </div>
</template>

testId.spec.js

import Vue from "vue";
import { shallowMount} from "@vue/test-utils";

import testId from "testId.vue";

// Use axe accessibility tools
// https://www.deque.com/axe/
// https://github.com/nickcolley/jest-axe
import { axe, toHaveNoViolations } from "jest-axe";
expect.extend(toHaveNoViolations);

describe("CardList.vue", () => {
    let wrapper;

    beforeEach(() => {
        wrapper = shallowMount(testId, {
            attachToDocument: true,
        });
    });

    describe('Mounted', () => {
        test("It should not contain any axe accessibility violation", async () => {
            const html = wrapper.html();

            expect(await axe(html)).toHaveNoViolations()
        });
    });
});

Return:

Expected the HTML found at $('div:nth-child(2) > div
                                                     
<p id="test-id">Test Id</p>                         
                                                     
Received:                                           
                                                    
"id attribute value must be unique (duplicate-id)"  

Any idea ? Thank you

Getting `act` warnings running axe

We are using axe as described in the readme and other examples we've looked at online and are getting act warnings when using it.

Expected: Can run axe on react code and assert on violations without act warnings
Actual: act warnings output to the console when test is run

Example code:

describe('tests', () => {
  it('should have no Axe violations', async () => {
    const { container } = render(<MyComponent />);
    const results = await axe(container);
    expect(results).toHaveNoViolations();
  })
});

I'm having to wrap the last two lines in act:

await act(async () => {
  const results = await axe(container);
  expect(results).toHaveNoViolations();
})

In order not to get warnings. I'm not sure how axe is implemented under the hood, so I can't offer much advice, but I do know that react testing library wraps most or all of its actions in act calls under the hood - maybe jest-axe needs to do the same with whatever it's doing?

question on no-redundant-roles

https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-redundant-roles.md

my eslint set up points out that no-redundant-roles error, because it doesn't want me to do something like <form role="form></form>

jest-axe though will point out the following if I don't add role property:

    expect(received).toHaveNoViolations(expected)

    Expected the HTML found at $('form') to have no violations:

    <form>

    Received:

    "All page content must be contained by landmarks (region)"

is there a configuration for this? happy to help out if you need extra information or assistance.

Q: Could these tests be ran as part of the Storyshot tests?

Storybook's Storyshots add-on make it easy to create Jest snapshots for each storybook story automatically. That means, there are no individual test files, just one Jest test file with the initialization of Storyshots like:

Storyshots.test.js

import initStoryshots from '@storybook/addon-storyshots';

initStoryshots();

Is it possible to integrate jest-axe so that the accessibility tests are also ran automatically per each story?

Disable a check

I would like to disable the fallback role check.

Using axe directly, I can do this.

axe.configure({
  checks: [
    {
      id: 'fallbackrole'
      enabled: false
    }
  ]
});

However, I don't see a way to configure checks through jest-axe. Thanks

Engine limit prevents jest-axe to be installed on node v6 environment with yarn

Given the limit set in package.json

"engines": {
    "node": ">= 8.0.0"
  },

and because my team uses Yarn, we cannot install jest-axe on node v6 environment - yarn is stricter than npm and completely refuses to install. While this limit is needed to run jest-axe tests, it should not be required for consumers of the library.

While examples provided in the README use some functionalities not available in node 6 (async), anyone can transpile their code and / or use babel to run their tests, therefore it seems that this limitation is not needed.

Is there any chance that the engines section be removed from package.json?
PS: I created PR #30 if this is acceptable. Thank you!

Adding a configurable error threshold

Hi!

At the moment, the matcher passes only when it detects no violations.

Other tools like pa11y and the next version of cypress-axe allow uses to set a tolerance threshold for the test.

What about adding such a threshold to this matcher as well? If it sounds good to you, I could submit a PR with the related changes.

Lower the Node engine requirements to 8.x.x

Hi,

I noticed the minimum required Node version in package.json is 8.9.4. I'm wondering if we can lower this to > 8 since it's seem pretty limiting. Is there something that is present in 8.9.4 and above that is required by this library ?

small typo README.md 'Testing React with Enzyme'

sorry i do not know how to do a multiline code block

const wrapper = mount(<App/>)
const results = await axe(container.getDOMNode())

should be

const wrapper = mount(<App/>)
const results = await axe(wrapper.getDOMNode())

Also I had to change
const App = require('./app')

to

import App from '.App'

because mount was being passed an object instead of the component

React Portal support

First of all, thanks for doing such an amazing job with jest-axe πŸ’“ πŸ’― πŸ‘πŸ»

The issue

We're trying to use jest-axe to verify the output of Reakit components.

Here's the PR that captures the work: ariakit/ariakit#652

We basically configured axe to test components on isolation and now we're [trying to verify the HTML output of a component:

test("renders with no a11y violations", async () => {
  const { container } = render(<ButtonWithTooltip />);
  const results = await axe(container.innerHTML);

  expect(results).toHaveNoViolations();
  cleanup;
});

However, we're facing the following error:

["Error: Uncaught [NotFoundError: The node to be removed is not a child of this node.]
        at reportException (/Users/lluis/Code/reakit/node_modules/jsdom/lib/jsdom/living/helpers/runtime-script-errors.js:62:24)
        at innerInvokeEventListeners (/Users/lluis/Code/reakit/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:346:9)
        at invokeEventListeners (/Users/lluis/Code/reakit/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:281:3)

Many Reakit components make use of React Portals, and we noticed when we switch off portals ( through a prop ) then the jest-axe test pass.

So the question being is this library compatible with portals? πŸ€”

"TypeError: (0 , _prettyFormat.format) is not a function" error message from wrong heading order

Had this problem recently:

  TypeError: (0 , _prettyFormat.format) is not a function

      48 |     const { container } = render(<Wizard />, { wrapper: MockProviders })
      49 |     const result = await axe(container)
    > 50 |     expect(result).toHaveNoViolations()
         |                    ^
      51 | })

Found out then that the problem was that the Wizard component (which has other nested components) when rendered formed an incorrect sequence of headings: an <h1> was rendered and then later on an <h3> without an <h2> in between.

That error message from axe wasn't very helpful, though. I remember having that issue in the past and getting a helpful error message, something like this.

Is this a bug?

UPDATE

Although this really seems to be the reason why I got that error, the accessibility test is still flaky. I've run the test 10 times for each of these scenarios:

  • with the right heading element: FLAKY (passed 5 out of 10)
  • commenting the heading element: ALWAYS PASS (passed 10)
  • with the wrong heading element: ALWAYS FAILS (failed 10)

Improve violation reporter

Violations currently may not have enough context, depending on the rule that's being violated.

Example:

<div id="dialog" aria-labelledby="foo" aria-describedby="desc">
  <h1 id="bar">Title</h1>
  <p id="desc">Description</p>
</div>

Returns:

Expected the HTML found at $('#dialog') to have no violations:

<div id="dialog" aria-labelledby="foo" aria-describedby="desc">
  <h1 id="bar">Title</h1>
  <p id="desc">Description</p>
</div>

Received:

"ARIA attributes must conform to valid values (aria-valid-attr-value)"

Try fixing it with this help: https://dequeuniversity.com/rules/axe/3.1/aria-valid-attr-value?application=axeAPI

If I'm not well versed on accessibility, I may not know exactly what to look for. Which attribute? What's invalid? However, we're in luck! For each node that has a violation, axe has a failure summary that is more specific on what to fix.

Fix all of the following:
Invalid ARIA attribute value: aria-labelledby="foo"

Including this failure summary as part of the violations reporter would provide more clear direction on what to investigate.

Include guidance in README about what these tests can help with.

πŸ†•πŸ₯☝ First Timers Only

This issue is reserved for people who never contributed to Open Source before. We know that the process of creating a pull request is the biggest barrier for new contributors. This issue is for you πŸ’

About First Timers Only.

πŸ€” What you will need to know

Nothing. This issue is meant to welcome you to Open Source :) We are happy to walk you through the process.

πŸ“‹ Step by Step

@@ -7,6 +7,15 @@
 
 Custom [Jest](https://jest-bot.github.io/jest/) matcher for [aXe](https://github.com/dequelabs/axe-core) for testing accessibility
 
+## βš οΈβœ‹ This project does not guarantee what you build is accessible.
+The GDS Accessibility team found that only [~30% of issues are found by automated testing](https://accessibility.blog.gov.uk/2017/02/24/what-we-found-when-we-tested-tools-on-the-worlds-least-accessible-webpage).
+
+Tools like aXe are similar to [code linters](https://en.wikipedia.org/wiki/Lint_%28software%29) such as [eslint](https://eslint.org/) or [sass-lint](https://github.com/sasstools/sass-lint), they can find common issues but can not guarantee what you build works for users.
+
+You'll also need to:
+- test your interface with the [assistive technologies that real users use](https://www.gov.uk/service-manual/technology/testing-with-assistive-technologies#when-to-test) (see also [WebAIM's survey results](https://webaim.org/projects/screenreadersurvey7/#primary)).
+- include people with disabilities in user research.
+
 ## Installation:
 ```bash
 npm install --save-dev jest-axe
  • πŸ”€ Start a Pull Request. You can create a pull request in Github. Mention closes nickcolley/jest-axe#24 in the description.
  • 🏁 Done πŸ‘ We'll review the Pull Request and let you know if any changes are needed.

πŸ€”β“ Questions

Comment on this issue or message Nick on Twitter.

npm advisory due to lodash.merge

There was a recent advisory posted for lodash and a couple of its sub-packages. Since the dependencies in this package are pegged to specific versions, npm audit fix wasn't able to fix the issue automatically.

Pull request incoming.

Clean up document after test is finished

Since this matcher appends the rendered content to the document (i.e., document.body.innerHTML = html), I noticed that other tests that render to the document via react-testing-librarycause there to be two instances of the component in the tree.

To avoid this, I added the following:

afterEach(() => {
  document.body.innerHTML = ''
})

However, it seems like this would best be handled by jest-axe itself. I can create a PR if needed.

Conflicts with flow

Error trying to use jest-axe in a .test.js file using flow (// @flow)

This is the output:

$ xxx/xxx/xxx/node_modules/.bin/flow
Error β”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆ src/components/organisms/BlogCategoryLayout/BlogCategoryLayout.test.js:32:27

Cannot call expect(...).toHaveNoViolations because:
 β€’ Either property toHaveNoViolations is missing in JestExpectType [1].
 β€’ Or property toHaveNoViolations is missing in JestPromiseType [2].
 β€’ Or property toHaveNoViolations is missing in EnzymeMatchersType [3].

           src/components/organisms/BlogCategoryLayout/BlogCategoryLayout.test.js
            29β”‚                 const html = ReactDOMServer.renderToString(
            30β”‚                         <BlogCategoryLayout title="Test Title" standardPosts={standardPosts} />
            31β”‚                 )
            32β”‚                 expect(await axe(html)).toHaveNoViolations()
            33β”‚         })
            34β”‚ })
            35β”‚

           flow-typed/npm/jest_v22.x.x.js
 [1][2][3] 512β”‚         (value: any): JestExpectType & JestPromiseType & EnzymeMatchersType,

Not implemented: window.computedStyle(elt, pseudoElt)

I am getting the following error for the following test with jest-axe:

Am I missing something?

Error: Not implemented: window.computedStyle(elt, pseudoElt)

test/setup.ts:

import '@testing-library/jest-dom/extend-expect'
import 'jest-axe/extend-expect'

file.spec.tsx:

const a11y = await axe(container)
expect(a11y).toHaveNoViolations()

jest.config.js

{
  displayName: 'web:test',
  preset: 'ts-jest',
  testEnvironment: 'jsdom',
  testMatch: ['**/__tests__/**/+(*.)+(spec|test).+(js|ts)?(x)'],
  moduleNameMapper: {
    '^~/(.*)$': '<rootDir>/src/$1',
    '^test/(.*)$': '<rootDir>/test/$1'
  },
  setupFilesAfterEnv: ['<rootDir>/test/setup.ts'],
  globals: {
    'ts-jest': {
      tsconfig: {
        jsx: 'react'
      }
    }
  }
}

deps:

"jest": "^26.6.3",
"jest-axe": "^4.1.0",
"react-test-renderer": "^17.0.1",
"ts-jest": "^26.4.4",
"typescript": "^4.1.2"

How to use without requiring async/await for every render?

Hi,

I'd like to use toHaveNoViolations in a project to extend expect.

Is there a way to do this without requiring async/await for every render of my react components? I'd love for it to be transparent to the users of the extended expect.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.