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

test(box/file): extend the mocha timeout to prevent the async file read test from failing #5601

Merged
merged 3 commits into from
Jan 7, 2025

Conversation

yoshinorin
Copy link
Member

What does it do?

As shown in the logs below, we occasionally face an issue where the file async read test fails due to a timeout. This PR extends the timeout for the file test to 20000ms.

  1) File
       "before all" hook for "read()":
     Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/runner/work/hexo/hexo/test/scripts/box/file.ts)
      at createTimeoutError (/home/runner/work/hexo/hexo/node_modules/mocha/lib/errors.js:498:15)
      at Hook.Runnable._timeoutError (/home/runner/work/hexo/hexo/node_modules/mocha/lib/runnable.js:429:10)
      at done (/home/runner/work/hexo/hexo/node_modules/mocha/lib/runnable.js:306:18)
      at /home/runner/work/hexo/hexo/node_modules/mocha/lib/runnable.js:369:11

P.S:

If we are allowed to change the timeout setting for the entire test, we can also specify the --timeout option for the mocha command.

Screenshots

N/A

Pull request tasks

  • Add test cases for the changes.
  • Passed the CI test.

Copy link

How to test

git clone -b test/change-box-file-timeout https://github.com/hexojs/hexo.git
cd hexo
npm install
npm test

@yoshinorin
Copy link
Member Author

yoshinorin commented Dec 31, 2024

Another test started failing on Ubuntu & Node.js 22... 😢


P.S:

However, the above error is occurring in other PRs as well. At the very least, I believe this PR is effective as a response to the timeout issue in file async reads.

@yoshinorin yoshinorin marked this pull request as draft December 31, 2024 05:00
@yoshinorin yoshinorin marked this pull request as ready for review December 31, 2024 09:16
@uiolee
Copy link
Member

uiolee commented Dec 31, 2024

I've tried this before, increasing the timeout length may have alleviated the problem, but it didn't really solve the problem.
But I haven't figured out why yet.

@uiolee uiolee merged commit bb2a874 into master Jan 7, 2025
12 of 15 checks passed
@uiolee uiolee deleted the test/change-box-file-timeout branch January 7, 2025 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants