Skip to content

Log temp-dir contents when test teardown fails to delete it#368

Open
chrisdp wants to merge 1 commit into
masterfrom
task/diagnose-temp-dir-teardown
Open

Log temp-dir contents when test teardown fails to delete it#368
chrisdp wants to merge 1 commit into
masterfrom
task/diagnose-temp-dir-teardown

Conversation

@chrisdp

@chrisdp chrisdp commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Diagnostic for the intermittent Windows CI failure where a test's afterEach fails to delete the shared .tmp dir:

Error: ENOTEMPTY: directory not empty, rmdir '...\.tmp'

The victim spec varies (LocationManager, BreakpointManager, ...) and it only happens on Windows, which means an earlier test leaves a file/handle open in the shared .tmp and whichever teardown runs while it's held is the one that throws. We can't tell which leftovers are locking it from the failure alone.

This wraps the .tmp remove/empty calls in the global teardown and the specs that share the dir with a helper that, on failure, logs every path still present under .tmp (and which teardown hit it), then re-throws. It diagnoses the failure without masking it.

  • No production code changes; test-infra only.
  • Silent on success (verified: full suite passes locally with zero diagnostic output).
  • Intended to be reverted once the next Windows failure names the offending leftovers.

The shared .tmp teardown intermittently fails on Windows with ENOTEMPTY when an
earlier test leaves a file/handle open. Wrap the remove/empty calls so that on
failure we log every path still present under .tmp (and which teardown hit it),
then re-throw. Diagnostic only; no production changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant