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

[BUG] Spec tests fail in node 20.8.0+ #2185

Open
chrismclarke opened this issue Jan 29, 2024 · 1 comment
Open

[BUG] Spec tests fail in node 20.8.0+ #2185

chrismclarke opened this issue Jan 29, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@chrismclarke
Copy link
Member

chrismclarke commented Jan 29, 2024

Describe the bug
Some scripts tests populate a virtual file system to test various file creation/modification methods, e.g. assets postprocessor spec.
These rely on the package mock-fs which is currently broken on Node 20
https://github.com/tschaub/mock-fs/issues/380
https://github.com/tschaub/mock-fs/issues/384

and may not be fixed any time soon...
https://github.com/tschaub/mock-fs/issues/383

To Reproduce
Using a system running Node 20.8.0:
yarn workspace scripts test

Additional context
Short term workaround is to avoid Node 20 (stick to 20.7.0 or 18) for CI and local tests.

I've tried replacing with alternatives but neither of the options below seem to be a perfect drop-in replacement:

mock-tmp
Uses slightly different folder structures which would mean refactoring tests

memfs
Can't find any way to force memfs methods to be called when running service code. Likely custom utility functions required to replace library fs methods with memfs and restore after tests, in the same way that mock-fs does

The other workaround is to use all async methods for fs operations both in spec and test code (importing from fs/promises), however

Spike PR used while testing possible fixes: #2186

@chrismclarke chrismclarke added the bug Something isn't working label Jan 29, 2024
@chrismclarke chrismclarke changed the title [BUG] Spec tests fail in node 20 [BUG] Spec tests fail in node 20.7.0+ Jan 29, 2024
@chrismclarke chrismclarke changed the title [BUG] Spec tests fail in node 20.7.0+ [BUG] Spec tests fail in node 20.8.0+ Jan 29, 2024
@chrismclarke
Copy link
Member Author

chrismclarke commented Mar 29, 2024

Just to note, recent angular 17.3 update requires "^18.13.0 || >=20.9.0"
which means either using v18 (>18.13.0), or v20 (>20.9.0)

So if wanting to update to angular 17.3 or beyond (when released), will either need developers using node 20.7.0 (last known compatible) to downgrade to node 18 - which isn't ideal.

As of recent comment mock-fs repo owner says open to PRs but not planning to fix, so we may need to discuss alternatives when next planning for core updates
https://github.com/tschaub/mock-fs/issues/384

May be of interest @jfmcquade

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 a pull request may close this issue.

1 participant