next.js
2f43b359 - fix(turbopack-tests): Ignore or clean up empty snapshot test directories, fix non-nextest execution testing (#81479)

Commit
176 days ago
fix(turbopack-tests): Ignore or clean up empty snapshot test directories, fix non-nextest execution testing (#81479) This PR fixes two bugs I ran into while trying to add a test case. ## Empty Snapshot Tests With No Input Git tracks files, not directories, so it doesn't track or delete empty directories. This can lead to broken behavior in our test cases: 1. Somebody deletes a test case, git no longer has any files in that directory to track. They push this to canary. 2. Somebody else runs `git pull` and git deletes the files, but leaves behind a directory structure. 3. Later, they run the snapshot tests with `UPDATE=1`. The snapshot test script sees the directory and tries running the test. 4. There's no input files, so it just tries to do a compilation with no files, which of course fails, but generates some output of the failure. 5. We accumulate these broken tests with an output directory but no input directory. ## Tracing Subscriber Init in Execution Tests - You can only call tracing-subscriber's `init()` once per-process as it sets global state. - We need each tracing-subscriber to be configured with a different output directory. - `cargo test` runs multiple tests in parallel inside the same process. Therefore, our use of `tracing-subscriber` is unfortunately incompatible with `cargo test`. In contrast, `cargo nextest` runs every test case in an isolated process. The use of `tracing-subscriber` here is just as a debugging tool (we don't commit these traces), so only enable it when we're running under `cargo nextest`. I tested running the execution tests with both `cargo test` and `cargo nextest` and observed the trace file was written out only when using `nextest`.
Author
bgw bgw
Parents
Loading