This repository demonstrates how Jest version 25.5.0 breaks
the functionality of path.resolve()
after chdir
ing, if
you happen to have another (older) version of graceful-fs
already
in your dependencies.
Having different versions of graceful-fs in the closure will prevent full deduplication of dependencies, which leads to
(for some reason), process.chdir()
in the test and process.cwd()
as used by the path
module lead to be
different graceful-fs
modules, which makes their cwd-caches be different and makes path.resolve()
fail.
In this demo I brought in the older graceful-fs
by depending on it directly using my own package.json
,
and so it would be easy enough to change.
In an actual practical case where we encountered this graceful-fs
was being brought in by another
dependency, which we don't control. Hence we have no control over the versions in the tree and the deduplication.