-
Notifications
You must be signed in to change notification settings - Fork 784
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
TypeError: run is not a function
when using v4.9.1
#4458
Comments
Thanks for the issue. I'm not sure why you would be getting that error. // index.ts
import axe, { run } from 'axe-core';
console.log({ version: axe.version, run });
|
I think it has something to do with how vite resolves it, because I have seamlessly updated other projects to V4.9.1, but with all the projects using vite, I'm getting this error. I'll try to do a bit of debugging to see if I can find the root cause. |
i'm facing the same issue with created devbox with super simple example: https://codesandbox.io/p/devbox/fy3jnp?file=%2Fsrc%2FApp.test.tsx import { run, version } from "axe-core";
it("should work with axe", () => {
console.log({ version, run });
expect(run).toStrictEqual(expect.any(Function));
}); all is good after switching to |
Yep, it doesn't seem to be something related with vite specifically, but with vitest, as I can import the I have also verified that it works if I do this: - import { run } from 'axe-core';
- run(...);
+ import axe from 'axe-core';
+ axe.run(...); |
|
Unfortunately, it's not quite as simple as just reverting back to the old non-core-js polyfill like #4465 attempted; the previous polyfill isn't good enough for the purposes of a different compatibility issue we solves in 4.9.1 (#4428). I'd prefer not to spend time on embedding an even more complicated polyfill of our own when there's a straightforward workaround for vitest users. We'd love to see a fix for this and if someone proposes a solution that works for vitest and continues to let us reuse core-js's Array.from polyfill we'd be happy to review a PR, but since it seems like this is an issue on vitest's end and there's a relatively straightforward workaround, we probably won't be able to prioritize researching a fix ourselves. |
I think that's perfectly reasonable. I'm personally happy closing this, unless you think it's better to keep it open. |
Because there's a workaround and this isn't something we'll get around to working on I'm going to close. |
Product
axe-core
Product Version
4.9.1
Latest Version
Issue Description
Expectation
Yesterday I got dependabot PRs in a few repositories, to upgrade from v4.9.0 to v4.9.1, and they all failed with the same error.
With v4.9.0 everything works as expected.
Actual
When running tests, I get
TypeError: run is not a function
How to Reproduce
It happens just by updating to v4.9.1, and trying to import and then use the
run
function, but you can see how I use it here https://github.com/shlinkio/shlink-frontend-kit/blob/86ad2eb395d35d57225cb0e4527282435efa6955/test/__helpers__/accessibility.tsAdditional context
You can see an example of the error here https://github.com/shlinkio/shlink-frontend-kit/actions/runs/9041997260/job/24848007149#step:5:59
Also, I'm not sure if it's related, but I use vite, vitest and react-testing-library
The text was updated successfully, but these errors were encountered: