The process.cwd() has a weird behaviour when the app is a part of monorepo,
always returning the directory of this specific project,
this causes integration tests to fail, because they are specifically testing ability to respect actual current dirs.
Gaunt Sloth is a command line tool and it is always supposed to function in the current directory.
Using INIT_CWD forces to always use actual CWD. cwd() fallback is just in case.
In environments where INIT_CWD is available (npm and alike) - INIT_CWD is the correct choice,
since they are likely to juggle the process.cwd(), where it is unavailable process.cwd() is used.
The process.cwd() has a weird behaviour when the app is a part of monorepo, always returning the directory of this specific project, this causes integration tests to fail, because they are specifically testing ability to respect actual current dirs. Gaunt Sloth is a command line tool and it is always supposed to function in the current directory. Using INIT_CWD forces to always use actual CWD. cwd() fallback is just in case. In environments where INIT_CWD is available (npm and alike) - INIT_CWD is the correct choice, since they are likely to juggle the process.cwd(), where it is unavailable process.cwd() is used.