NickColley / jest-axe

Custom Jest matcher for aXe for testing accessibility ♿️🃏
MIT License
1.06k stars 54 forks source link

Cannot find module 'jest-axe' #230

Closed chrisdemars closed 2 years ago

chrisdemars commented 2 years ago

I am importing these things from 'jest-axe' but the test fails because the module can't be found. What am I doing wrong?

import React from 'react';
import { render } from '@testing-library/react';
import { axe, toHaveNoViolations } from 'jest-axe';
NickColley commented 2 years ago

This project is still commonjs so will need to look into publishing something that works in ESM environments if it doesnt by default...

NickColley commented 2 years ago

I'll support this when ES Modules support in Jest is stable:

https://jestjs.io/docs/ecmascript-modules https://github.com/facebook/jest/issues/9430

Re-open when that's the case, for now, use commonjs for tests if possible.