-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
Description
Describe the bug
The solution for #6346, implemented on #6347 doesn't seem to work as described in the original issue.
Reproduction link is found below, but the code is:
import { vi, expect, test } from 'vitest';
vi.useFakeTimers();
test('works', () => {
let frameRendered = false;
window.requestAnimationFrame(() => {
frameRendered = true;
});
vi.advanceTimersToNextFrame();
expect(frameRendered).toBe(true); // throws, `frameRendered` is false
});
Reproduction
https://stackblitz.com/edit/vitest-dev-vitest-zd3lj1?file=test%2Fbasic.test.ts
System Info
System:
OS: macOS 14.1.1
CPU: (10) arm64 Apple M1 Pro
Memory: 113.53 MB / 32.00 GB
Shell: 3.7.1 - /opt/homebrew/bin/fish
Binaries:
Node: 18.17.1 - ~/.volta/tools/image/node/18.17.1/bin/node
Yarn: 4.2.2 - ~/.volta/tools/image/yarn/4.2.2/bin/yarn
npm: 9.6.7 - ~/.volta/tools/image/node/18.17.1/bin/npm
Browsers:
Chrome: 128.0.6613.138
Edge: 128.0.2739.79
Safari: 17.1
NPM Packages:
vitest: 2.1.0
Used Package Manager
yarn
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
samruston, steckhelena, crismotinha, cauli, penovi17 and 4 more