toHaveNoViolations does not exist on type Matchers<any> typescript
See original GitHub issueI 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();
});
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
toHaveNoViolations does not exist on type Matchers<any ...
I get the following error when trying to get this working with ts-jest: TypeScript diagnostics (customize using `[jest-config].globals.ts-jest.diagnostics` ...
Read more >reactjs - Property 'toBeInTheDocument' does not exist on type ...
Property 'toBeInTheDocument' does not exist on type 'JestMatchers<HTMLElement>'. which leads to Cannot use import statement outside a module ...
Read more >jest-axe - npm
Start using jest-axe in your project by running `npm i jest-axe`. There are 59 other projects in the npm registry using jest-axe.
Read more >Just an FYI. You can add the axe toHaveNoViolations matcher ...
Just an FYI. You can add the axe toHaveNoViolations matcher globally so you don't have to import it in your tests.
Read more >TS2339: Property 'toHaveBeenCalledWith' does not exist on ...
TS2339: Property 'toHaveBeenCalledWith' does not exist on type 'Assertion'. When doing Angular tests from WebStorm, I keep getting these error notifications ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I had the same problem. I fixed it with
npm i -D @types/jest-axeI wonder if we should add @hernandezbb 's advice to the README?