Closed IPWright83 closed 2 years ago
What are you expecting to be cached in this example? If I understand correctly, outputs: []
says there are no cache artifacts (except logs).
@mehulkar yes, that's correct. So in this case I'd expect the logs to be cached - so if we were to re-run the same script the log would just repeat. Not very useful with the reproduction, but very useful if just running a linter again.
It's probably related to us using this flag https://eslint.org/docs/latest/user-guide/command-line-interface#--max-warnings which exits with a 1 if there are any warnings.
This is working as intended. turbo
intentionally does not cache results from scripts that appear to have failed. If you would like to use something other than the exit code from your lint script, you can wrap it with your own script to determine whether or not it has failed and produce an appropriate exit code.
What version of Turborepo are you using?
1.4.3
What package manager are you using / does the bug impact?
pnpm
What operating system are you using?
Linux
Describe the Bug
If the process exits with a non 0 exit code then Turborepo doesn't use the cache. While sometimes this is desirable, other times it is not and it would be better to use the cache.
This is particularly relevant when running tools such as linters, that encounter lint errors. As the process exits with a code 1, the linter will have to run manually again each time, where-as if the hash hasn't changed we can use the same output from the linter.
Expected Behavior
Turborepo should use the cached output (if requested).
To Reproduce
A noddy (non linting example):
package.json
turbo.json:
apps/myApp/package.json:
apps/myApp/helloWorld.js:
Running
pnpm hello
at the root will never use the cache.