Open chrismclarke opened 6 months ago
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
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 20https://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
), howeverSpike PR used while testing possible fixes: #2186