Skip to content

fix(test): add missing await to unlink in save_database test#5753

Merged
uiolee merged 1 commit intohexojs:masterfrom
KentarouTakeda:fix/flaky-save-database-test
Apr 5, 2026
Merged

fix(test): add missing await to unlink in save_database test#5753
uiolee merged 1 commit intohexojs:masterfrom
KentarouTakeda:fix/flaky-save-database-test

Conversation

@KentarouTakeda
Copy link
Copy Markdown
Contributor

What does it do?

Summary

  • Fix race condition in test/scripts/filters/save_database.ts where unlink(dbPath) was not awaited
  • The missing await caused the "do nothing if hexo is not initialized" test to intermittently fail because the database file from the previous test had not been deleted yet

Failure log before fix

4. Save database
  do nothing if hexo is not initialized:
 AssertionError: expected true to be false
  - expected - actual
 -true
 +false
 at Context. (test/scripts/filters/save_database.ts:30:21)

Test plan

  • Ran the test 5 times consecutively with no failures

Pull request tasks

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

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 3, 2026

How to test

git clone -b fix/flaky-save-database-test https://github.com/KentarouTakeda/hexojs-hexo.git
cd hexo
npm install
npm test

@uiolee uiolee merged commit 127cc36 into hexojs:master Apr 5, 2026
16 checks passed
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