fix: Select tests when a transformer's own configuration changes in turbo trace
The compilers behind jest's transformers find their configuration on disk
without the jest configuration naming it, and a vitest project that
processes style sheets hands them to PostCSS, which does the same. A change
to such a file changes the code the tests run, and it selected no test in
`turbo trace affected`, also with `--strict`.
For a jest project whose transformer is `babel-jest` (jest's default when no
`transform` is set, a table entry that names it, a first-party transformer
that loads it or `@babel/core`, `ts-jest` with `babelConfig`), these are now
inputs of every test of the project:
- `babel.config.*` in the project root and in each directory above it up to
the repository root. Babel's root is the working directory of the run, or
with `rootMode: "upward"` the first directory above it that has one.
- `.babelrc*` at any depth below the project root, and between the root and
the directory of its `package.json`.
- `.browserslistrc` and `browserslist` from the root upward.
For `@swc/jest`, or a first-party transformer that loads it or `@swc/core`:
`.swcrc` in the same places, and the browserslist files. A configuration
from `next/jest` sets its own transformer, which reads neither.
For a vitest project with `test.css` set: `postcss.config.*`, `.postcssrc*`,
`tailwind.config.*` and the browserslist files from the root upward. Without
that option a style sheet is an empty module and nothing is read.
A configuration written in code is traced like a setup file, so what it
imports is an input too. A name that does not exist is watched: creating the
file selects the tests.
Not covered: a `.babelrc` of another workspace package that `babelrcRoots`
admits, a file that a JSON configuration names with `extends`, and the files
Tailwind CSS scans for class names.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>