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

Avoid call requestIdleCallback in nodejs #6106

Closed
EYHN opened this issue Jan 24, 2024 · 2 comments · Fixed by #6232
Closed

Avoid call requestIdleCallback in nodejs #6106

EYHN opened this issue Jan 24, 2024 · 2 comments · Fixed by #6232
Assignees
Labels
mod:infra Environment related issues and discussions type:feat Non-bug feature improvements

Comments

@EYHN
Copy link
Member

EYHN commented Jan 24, 2024

Blocksuite uses requestIdleCallback here, which causes @blocksuite/store can't run in nodejs, which causes trouble for writing test.

requestIdleCallback(this._reindex, { timeout: 1000 });

I think I can add a simple check whether the environment supports requestIdleCallback

@doodlewind doodlewind added mod:infra Environment related issues and discussions type:feat Non-bug feature improvements labels Jan 25, 2024
@fourdim
Copy link
Contributor

fourdim commented Jan 25, 2024

vitest-dev/vitest#5027

@hi-ogawa
Copy link

hi-ogawa commented Feb 11, 2024

@fourdim Just a friendly ping as you might be interested. I raised an issue on @sinonjs/fake-timersregarding some inconsistency between setImmediate and other timers (which include requestIdleCallback) sinonjs/fake-timers#490 and they might end up changing the behavior to not allow mocking requestIdleCallback in NodeJS environment where it's originally not available, so you might require adjusting the code there eventually.

If you have a valid use case, they might want to know the detail. I'll just a link to their PR here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mod:infra Environment related issues and discussions type:feat Non-bug feature improvements
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants