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

fs.statSync no longer mocked from NodeJS 20.8.0 #380

Open
andrewnicols opened this issue Oct 2, 2023 · 3 comments
Open

fs.statSync no longer mocked from NodeJS 20.8.0 #380

andrewnicols opened this issue Oct 2, 2023 · 3 comments

Comments

@andrewnicols
Copy link

Mocking with mock-fs and call fs.statSync no longer mocks from v20.8.0
https://nodejs.org/en/blog/release/v20.8.0

I believe this is due to performance improvements in fs.*Sync methods from this commit: https://github.com/nodejs/node/pull/49593/files#diff-9b2c5bf36570be7a09ba2597abdf6d9bc2cc1e19866b6674b0cf275c1188dcad

All *Sync commans hae moved to syncFs.

github-merge-queue bot pushed a commit to aws/jsii-rosetta that referenced this issue Nov 15, 2023
We are affected by this `mock-fs` bug:
tschaub/mock-fs#380
Seems like there is no activity on the repo recently, so we switch to a
new tool.

However `memfs` only works for the test case in `assemblies.test.ts`.
So we keep `mock-fs` for the `rosetta.test.ts` test cases.

---

By submitting this pull request, I confirm that my contribution is made
under the terms of the [Apache 2.0 license].

[Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
@Sayan751
Copy link

Sayan751 commented Dec 2, 2023

I am also facing issues on Node 20 with exists*.

patrickjuchli added a commit to patrickjuchli/basic-ftp that referenced this issue Dec 9, 2023
Mock-FS is no longer reliable, see tschaub/mock-fs#380.
Rewrite tests to use real file system instead.
@fregante
Copy link

This pushed me to just use async methods instead of *Sync. Those work perfectly in Node 20 with mock-fs 🎉

hegemonic added a commit to hegemonic/jsdoc-baseline that referenced this issue Dec 20, 2023
It has some nasty, hard-to-fix bugs in current versions of Node.js (tschaub/mock-fs#377, tschaub/mock-fs#380) and an uncertain future (tschaub/mock-fs#383).

Also, this package's tests don't really need to mock the entire filesystem; they just need to write files to a temp directory that can be deleted when the tests are complete.
@Sayan751
Copy link

Sayan751 commented Jan 3, 2024

This pushed me to just use async methods instead of *Sync. Those work perfectly in Node 20 with mock-fs 🎉

Thanks @fregante! This works!

aws-cdk-automation pushed a commit to aws/jsii-rosetta that referenced this issue Jan 10, 2024
We are affected by this `mock-fs` bug:
tschaub/mock-fs#380
Seems like there is no activity on the repo recently, so we switch to a
new tool.

However `memfs` only works for the test case in `assemblies.test.ts`.
So we keep `mock-fs` for the `rosetta.test.ts` test cases.

---

By submitting this pull request, I confirm that my contribution is made
under the terms of the [Apache 2.0 license].

[Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0

(cherry picked from commit f25a394)

# Conflicts:
#	.projen/deps.json
#	.projen/tasks.json
#	package.json
#	yarn.lock
aws-cdk-automation pushed a commit to aws/jsii-rosetta that referenced this issue Jan 10, 2024
We are affected by this `mock-fs` bug:
tschaub/mock-fs#380
Seems like there is no activity on the repo recently, so we switch to a
new tool.

However `memfs` only works for the test case in `assemblies.test.ts`.
So we keep `mock-fs` for the `rosetta.test.ts` test cases.

---

By submitting this pull request, I confirm that my contribution is made
under the terms of the [Apache 2.0 license].

[Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0

(cherry picked from commit f25a394)

# Conflicts:
#	.projen/deps.json
#	.projen/tasks.json
#	package.json
#	yarn.lock
aws-cdk-automation pushed a commit to aws/jsii-rosetta that referenced this issue Jan 10, 2024
We are affected by this `mock-fs` bug:
tschaub/mock-fs#380
Seems like there is no activity on the repo recently, so we switch to a
new tool.

However `memfs` only works for the test case in `assemblies.test.ts`.
So we keep `mock-fs` for the `rosetta.test.ts` test cases.

---

By submitting this pull request, I confirm that my contribution is made
under the terms of the [Apache 2.0 license].

[Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0

(cherry picked from commit f25a394)

# Conflicts:
#	.projen/deps.json
#	.projen/tasks.json
#	package.json
#	yarn.lock
aws-cdk-automation pushed a commit to aws/jsii-rosetta that referenced this issue Jan 10, 2024
We are affected by this `mock-fs` bug:
tschaub/mock-fs#380
Seems like there is no activity on the repo recently, so we switch to a
new tool.

However `memfs` only works for the test case in `assemblies.test.ts`.
So we keep `mock-fs` for the `rosetta.test.ts` test cases.

---

By submitting this pull request, I confirm that my contribution is made
under the terms of the [Apache 2.0 license].

[Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0

(cherry picked from commit f25a394)

# Conflicts:
#	.projen/deps.json
#	.projen/tasks.json
#	package.json
#	yarn.lock
aws-cdk-automation pushed a commit to aws/jsii-rosetta that referenced this issue Jan 10, 2024
We are affected by this `mock-fs` bug:
tschaub/mock-fs#380
Seems like there is no activity on the repo recently, so we switch to a
new tool.

However `memfs` only works for the test case in `assemblies.test.ts`.
So we keep `mock-fs` for the `rosetta.test.ts` test cases.

---

By submitting this pull request, I confirm that my contribution is made
under the terms of the [Apache 2.0 license].

[Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0

(cherry picked from commit f25a394)

# Conflicts:
#	.projen/deps.json
#	.projen/tasks.json
#	package.json
#	yarn.lock
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

No branches or pull requests

3 participants