Skip to content

Conversation

@lucgonp
Copy link

@lucgonp lucgonp commented Nov 26, 2025

…ormance

  • Replace fs.readFileSync with async fs.readFile
  • Add proper error handling with debug logs
  • Improve performance by avoiding event loop blocking
  • Remove TODO comment about async fs methods

This follows Node.js best practices and improves DX with faster build times.

  • Closes

Additional details

Steps to test

How has the user experience changed?

PR Tasks


Note

Replaces sync file reads with async fs/promises, adds a cached async loader for initCypressTests.js, and updates HTML transform to await loader with debug/error handling.

  • Vite Dev Server Plugin (npm/vite-dev-server/src/plugins/cypress.ts):
    • Switch import from fs to fs/promises; replace sync readFileSync with async readFile.
    • Add cached async init loader:
      • Introduce loaderPromise and getLoaderPromise() wrapping loadInitFile() for one-time read of INIT_FILEPATH with retry-on-error behavior.
      • Add debug logs and explicit error handling for loader read failures.
    • Update transformIndexHtml:
      • Read index.html via async fs.readFile.
      • Inject collected <script> tags into <head> and append <script>${loader}</script> before </body> using awaited loader content.
    • Remove synchronous I/O and related TODO; add minor debug logging for paths and events.

Written by Cursor Bugbot for commit 3b1d560. This will update automatically on new commits. Configure here.

…ormance

- Replace fs.readFileSync with async fs.readFile
- Add proper error handling with debug logs
- Improve performance by avoiding event loop blocking
- Remove TODO comment about async fs methods

This follows Node.js best practices and improves DX with faster build times.
@cypress-app-bot
Copy link
Collaborator

@lucgonp lucgonp marked this pull request as draft November 28, 2025 16:54
@lucgonp lucgonp marked this pull request as ready for review November 28, 2025 16:54
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