Support `.ava` cacheDir for better compatibility with Yarn PnP
andrewzey opened this issue · 3 comments
Hello,
We're using Yarn 3 with PnP in our mono-repo, and find that ava is creating unwanted node_modules
directories in our workspace (with node_modules/.cache/ava/failing-tests.json
) This is a result of
Line 256 in f047694
Sometimes the existence of node_modules
confuses the pnp patched executables (eg. eslint
), so the mere existence of node_modules
can sometimes cause issues with things working reliable.
It would be great if you supported some manner of specifying the cache directory or simply defaulted to projectDir/.ava
and recommended adding .ava
to the .gitignore
.
Thanks!
I was thinking about this the other day actually, and yes I agree that should be an option. Placing it under node_modules
by default does provide the best out-of-the box experience though.
cache
is currently configurable as a boolean, I propose we add '.ava'
as a valid value which would then use path.join(projectDir, '.ava')
as the cache dir. All other values should result in a configuration error, I don't think we should make this super configurable just yet.
However this does leave us with the following code:
Lines 210 to 217 in 4dc385b
The way this could work is:
- If
cache
is notfalse
, use the computedcacheDir
- Otherwise, insist on using this
node_modules/.cache/ava
directory
And then we'd have to document that as a caveat.
What do you think?