dequelabs / dequelabs/axe-core

axe-core timeout with mock timer in JS unit tests

Open
#3,055 9 comments 6 reactions 0 assignees View on GitHub
help wanted
Dominant language
JavaScript
Stars
7.5k
Forks
933
Avg merge
2d 13h
Merged PRs (30d)
29

Description

Product: axe-core

Expectation: axe-core does not timeout when timer is mocked in JS unit tests

Actual: When mock timers are used with axe (e.g. [jest.useFakeTimers()](https://jestjs.io/docs/timer-mocks)), tests fail with error "Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.Timeout"

Motivation: Mocking timers are common in JS unit tests. Getting axe-core to work as expected even when mock timers are being used would be great. The timeout issue occurs even with other third-party mock timer libs such as [@sinonjs/fake-timers](https://www.npmjs.com/package/@sinonjs/fake-timers) - so it is not a problem just with Jest.



axe-core version: 4.2.3

For Tooling issues:
- Node version: v14.17.1
- Platform: OSX 10.15.7

Something about mocking timers results in axe timeout - not sure why ?

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure in a minimal JavaScript unit test using jest.useFakeTimers() with axe-core 4.2.3, then compare it with @sinonjs/fake-timers. Trace the timeout behavior and verify the fix by confirming axe completes without the 5000ms timeout under both mocked-timer libraries.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.