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

fix: replace fs.watch with chokidar #75

Merged
merged 1 commit into from
Aug 9, 2021

Conversation

ampersarnie
Copy link
Member

@ampersarnie ampersarnie commented Aug 5, 2021

Description

fs.watch has presented numerous compatibility issues that cause failures in some environments and machines. This seems to most prominently affect Linux distros but not providing Node with the adequate means of recursively watching directories. As a result we need to replace the watch features with something more compatible. Chokidar was chosen as it has a proven record since being installed in numerous JS based systems, such as VSCode and webpack.

Reported Error

Opening Cypress...
The function exported by the plugins file threw an error.

We invoked the function exported by `/home/circleci/project/cypress/plugins/index.js`, but it threw an error.

 TypeError [ERR_FEATURE_UNAVAILABLE_ON_PLATFORM]: The feature watch recursively is unavailable on the current platform, which is being used to run Node.js
    at Object.watch (fs.js:1521:11)
    at watchDir (/home/circleci/project/node_modules/@bigbite/wp-cypress/lib/utils/watchDir.js:6:6)
    at module.exports (/home/circleci/project/node_modules/@bigbite/wp-cypress/lib/cypress-plugin/index.js:36:5)
    at module.exports (/home/circleci/project/cypress/plugins/index.js:22:40)
    at /home/circleci/.cache/Cypress/7.7.0/Cypress/resources/app/packages/server/lib/plugins/child/run_plugins.js:90:12
    at tryCatcher (/home/circleci/.cache/Cypress/7.7.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/util.js:16:23)
    at Function.Promise.attempt.Promise.try (/home/circleci/.cache/Cypress/7.7.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/method.js:39:29)
    at load (/home/circleci/.cache/Cypress/7.7.0/Cypress/resources/app/packages/server/lib/plugins/child/run_plugins.js:87:7)
    at EventEmitter.<anonymous> (/home/circleci/.cache/Cypress/7.7.0/Cypress/resources/app/packages/server/lib/plugins/child/run_plugins.js:198:5)
    at EventEmitter.emit (events.js:315:20)
    at process.<anonymous> (/home/circleci/.cache/Cypress/7.7.0/Cypress/resources/app/packages/server/lib/plugins/util.js:19:22)
    at process.emit (events.js:315:20)
    at emit (internal/child_process.js:903:12)
    at processTicksAndRejections (internal/process/task_queues.js:81:21)
error Command failed with exit code 1.

Change Log

  • Add Chokidar package.
  • Change fs.watch for chokidar equivalent.

Screenshots/Videos

If PR includes visual changes, please include a screenshot (or short video if applicable).

Types of changes (if applicable):

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).

Checklist (if applicable):

  • Meets provided linting standards.

fs.watch has presented numerous compatibility issues that cause failures
in some environments and machines. This seems to most prominently
affect Linux distros but not providing Node with the adaquate means of
recursively watching directories. As a result we need to replace the
watch features with something more compatible. Chokidar was chosen as
it has a proven record since beeing installed in numerous JS based
systems, such as VSCode and webpac
@ampersarnie ampersarnie requested a review from con322 August 5, 2021 22:38
@ampersarnie ampersarnie added the bug Something isn't working label Aug 5, 2021
@ampersarnie ampersarnie marked this pull request as ready for review August 5, 2021 22:49
@ampersarnie ampersarnie merged commit fd78887 into bigbite:master Aug 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants