Skip to content
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

[BUG]: Intermittent ace.Checker is not a constructor errors in Jest tests #1025

Closed
caleballen opened this issue Aug 2, 2022 · 6 comments
Closed
Assignees
Labels
node-accessibility-checker Issues in the accessibility-checker component user-reported Issues identified outside of the core team

Comments

@caleballen
Copy link

Project

a11y checker

Browser

No response

Operating system

Other

Description

Hi there,

We import accessibility-checker into our node environment for use in Jest testing both locally and as part of our CI pipeline. We have begun seeing intermittent failures, usually all tests will pass without issue but occasionally the tests encounter errors:

    TypeError: ace.Checker is not a constructor

      at node_modules/src-ts/lib/ACEngineManager.ts:112:31
      at node_modules/graceful-fs/graceful-fs.js:61:14

which leads to

    TypeError: Cannot read properties of undefined (reading 'check')

      at node_modules/src-ts/lib/ACHelper.ts:400:45
      at step (node_modules/accessibility-checker/lib/ACHelper.js:33:23)
      at Object.next (node_modules/accessibility-checker/lib/ACHelper.js:14:53)
      at node_modules/accessibility-checker/lib/ACHelper.js:8:71
      at Object.<anonymous>.__awaiter (node_modules/accessibility-checker/lib/ACHelper.js:4:12)
      at getComplianceHelperLocal (node_modules/accessibility-checker/lib/ACHelper.js:466:12)
      at node_modules/src-ts/lib/ACHelper.ts:216:22
      at step (node_modules/accessibility-checker/lib/ACHelper.js:33:23)
      at Object.next (node_modules/accessibility-checker/lib/ACHelper.js:14:53)
      at fulfilled (node_modules/accessibility-checker/lib/ACHelper.js:5:58)

in the same test.

When these errors occur often several tests still pass. All issues can be mitigated by using the Jest flag --runInBand forcing all tests to run sequentially although this is not ideal. This issue is highly reproducible on my 8 thread laptop.

Steps to reproduce

I'll put together a reproducible repo if that would be helpful but I believe the steps are as follows

  1. Set up accessibility-checker with Jest. Extend the expect functionality with the accessibility-checker compliance assertion.
  2. Have several accessibility tests.
  3. Run on a multithreaded system to allow for Jest workers.
  4. Repeat several times.
@aliunwala
Copy link
Contributor

Moving this issue into Triage pipeline to be prioritized to be looked at.

@tombrunet
Copy link
Member

I ran this boilerplate: https://github.com/IBMa/equal-access/tree/jest-puppeteer/accessibility-checker/boilerplates/jest-puppeteer-ts with 5 suites running 50 tests each using puppeteer and am not running into this. Are you sure you aren't sharing pages across tests and trying to load two tests into the same page at the same time?

@aliunwala
Copy link
Contributor

Triage meeting:
We are closing this for now as we cannot reproduce it reliably. If you get a test environment that sees this consistently you can share feel free to open this issue.

@tombrunet
Copy link
Member

Going to re-open this. Got some new reports. Will try again to reproduce this.

@tombrunet tombrunet reopened this Jan 23, 2023
@tombrunet tombrunet self-assigned this Jan 23, 2023
@philljenkins philljenkins added the user-reported Issues identified outside of the core team label Jan 26, 2023
@marcjohlic marcjohlic added the node-accessibility-checker Issues in the accessibility-checker component label Jan 31, 2023
@tombrunet
Copy link
Member

Finally able to reproduce this on my end. Looking...

@tombrunet
Copy link
Member

Should be fixed in 3.1.44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
node-accessibility-checker Issues in the accessibility-checker component user-reported Issues identified outside of the core team
Projects
None yet
Development

No branches or pull requests

5 participants