Skip to content

Fixed: FileSystem.waitForFile: do not crash if directory does not exist yet - #5421

Open
danielrentz wants to merge 1 commit into
codeceptjs:4.xfrom
danielrentz:issue5420
Open

danielrentz wants to merge 1 commit into
codeceptjs:4.xfrom
danielrentz:issue5420

Conversation

@danielrentz

@danielrentz danielrentz commented Jan 29, 2026 •

Copy link
Copy Markdown
Contributor

Motivation/Description of the PR

Reworked the complex implementation of FileSystem.waitForFile, now it contains a simple polling loop that uses the existing fileExists helper function like FileSystem.seeFile does.

Applicable helpers:

  • Playwright
  • Puppeteer
  • WebDriver
  • REST
  • FileHelper
  • Appium
  • TestCafe

Applicable plugins:

  • allure
  • autoDelay
  • autoLogin
  • customLocator
  • pauseOnFail
  • coverage
  • retryFailedStep
  • screenshotOnFail
  • selenoid
  • stepByStepReport
  • stepTimeout
  • wdio
  • subtitles

Type of change

  • 🔥 Breaking changes
  • 🚀 New functionality
  • 🐛 Bug fix
  • 🧹 Chore
  • 📋 Documentation changes/updates
  • ♨️ Hot fix
  • 🔨 Markdown files fix - not related to source code
  • 💅 Polish code

Checklist:

  • Tests have been added
  • Documentation has been added (Run npm run docs)
  • Lint checking (Run npm run lint)
  • Local tests are passed (Run npm test)

Comment thread lib/helper/FileSystem.js Resolved
@kobenguyent
kobenguyent changed the base branch from 3.x to 4.x June 5, 2026 05:44
@kobenguyent kobenguyent added the bug label Jun 5, 2026
…st yet (codeceptjs#5420)

fs.watch() throws for a missing directory, and the timeout callback
then accesses the uninitialized watcher, which kills the process with
a ReferenceError. Poll with fileExists() instead, like seeFile() does.
@danielrentz

Copy link
Copy Markdown
Contributor Author

Branch has been rebased, and a unit test has been added. Can somebody please take care?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

I.waitForFile (FileSystem helper) fails if directory does not exist (yet)

3 participants