rules_jest
rules_jest copied to clipboard
[FR]: Default cacheDirectory to TEST_TMPDIR
What is the current behavior?
Jest provides a config option cacheDirectory which specifies where intermediate file system outputs are written such as transformations or haste map. If left unspecified, the default is approximately ${os.tmpdir()}/jest_${process.uid}
. The contents of this directory are not deleted when jest exits and files are written even when --no-cache
is set.
Describe the feature
Bazel's TEST_TMPDIR should be integrated to set the jest cacheDirectory in the generated configuration.
- TEST_TMPDIR in Bazel is available to every test action as an ENV. The directory is writable, guaranteed to be empty, and unique to a given test target.
- This enforces hermeticity at the file system level between different jest_test targets and brings rules_jest more in line with the bazel test specification.
- TEST_TMPDIR can either be provided via CLI flag via "make variable" expansion or set in the generated config template by reading from
process.env
.
More context on Bazel Slack: https://bazelbuild.slack.com/archives/C04281DTLH0/p1706234301711269