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

node 20: mock-fs breaks #834

Closed
josephjclark opened this issue Dec 1, 2024 · 2 comments
Closed

node 20: mock-fs breaks #834

josephjclark opened this issue Dec 1, 2024 · 2 comments
Assignees

Comments

@josephjclark
Copy link
Collaborator

When updating to node 20, mock-fs breaks.

We use mock-fs extensively in unit tests to load fake adaptor files and such. Bumping the mock-fs version helps, but we also have a problem dynamically importing modues.

Basically mock-fs will only mock the filesystem for node:fs. When using import() (as we do in the runtime to load adaptors), the file system isn't mocked out at all.

@josephjclark
Copy link
Collaborator Author

josephjclark commented Dec 1, 2024

Notes on the problem form @doc-han 👍

  1. readFileSync Issue: readFileSync with 'utf-8' option broken by node v20.5.0 tschaub/mock-fs#377 (fixed via a version bump to 5)

  2. don't see a good issue around mock-fs not working with dynamic import in node v20. closest issue for mock-fs@v3Can't require files with mocked filesystem tschaub/mock-fs#130

Our only failing tests are in packages/cli/test/commands.test.ts

@github-project-automation github-project-automation bot moved this to New Issues in v2 Dec 1, 2024
@josephjclark
Copy link
Collaborator Author

I think we need to look for a different solution to commands.test.ts. The options as I see it right now:

  1. Remove CLI tests that use the file system for adaptors
  2. Actually use the file system for adaptors (maybe with a helper librry ot support us). As in - don't mock modules, but actually create them. We do actually do this in many tests today IIRC.
  3. Remove the failing tests entirely. At the time of writing I don't know how valuable these tests are - but this is unlikely to be my preferred choice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants