Skip to content

test(web-pkg): raise timeout for flaky real web worker unit tests#13896

Open
dj4oC wants to merge 2 commits into
masterfrom
fix/web-pkg/flaky-web-worker-test-timeout
Open

test(web-pkg): raise timeout for flaky real web worker unit tests#13896
dj4oC wants to merge 2 commits into
masterfrom
fix/web-pkg/flaky-web-worker-test-timeout

Conversation

@dj4oC

@dj4oC dj4oC commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Problem

The packages/web-pkg/tests/unit/composables/webWorkers/*/worker.spec.ts suites
spin up real web workers (useWebWorker(... ?worker)) and await the worker's
postMessage reply. Under heavy CI fork-parallelism (e.g. when the full
vitest projects run with many concurrent forks) the worker thread is starved and
does not reply within vitest's 5s default testTimeout. The result is flaky
failures like:

AssertionError: expected "vi.fn()" to be called 1 times, but got 0 times
Error: Test timed out in 5000ms.

across deleteWorker, pasteWorker, restoreWorker and exportAsPdfWorker. The
tests pass locally and in lighter runs, so this is a timing/contention flake, not a
product bug.

Fix

Raise testTimeout (and hookTimeout) to 20s for the five real-worker specs via a
per-file vi.setConfig. The timeout only affects tests that would otherwise exceed
5s, so fast runs are unchanged; it simply gives the real workers enough headroom to
reply under CI load. The change is scoped to exactly the affected spec files.

Testing

  • pnpm --filter @ownclouders/web-pkg exec vitest run tests/unit/composables/webWorkers -> 15 files / 129 tests pass.
  • prettier and eslint clean on the changed files.

The webWorkers/*/worker.spec.ts tests spin up real web workers via useWebWorker
and await their postMessage reply. Under heavy CI fork-parallelism the workers
are starved and do not reply within vitest's 5s default, producing flaky
"Test timed out in 5000ms" failures (the awaited callback never runs, so the
webdav mock shows 0 calls). Raise testTimeout/hookTimeout to 20s for these five
specs so they have enough headroom; fast runs are unaffected.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: David Walter <david.walter@kiteworks.com>
@update-docs

update-docs Bot commented Jun 19, 2026

Copy link
Copy Markdown

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@kw-security

kw-security commented Jun 19, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Raises Vitest timeouts for unit specs that spin up real Web Workers in @ownclouders/web-pkg, reducing CI flakiness under heavy parallelism/fork contention.

Changes:

  • Set per-file vi.setConfig({ testTimeout: 20000, hookTimeout: 20000 }) for affected real-worker spec suites.
  • Add brief in-file rationale comments explaining the increased headroom for CI.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/web-pkg/tests/unit/composables/webWorkers/tokenTimerWorker/worker.spec.ts Increases per-file Vitest timeouts for the real token timer worker tests.
packages/web-pkg/tests/unit/composables/webWorkers/restoreWorker/worker.spec.ts Increases per-file Vitest timeouts for the real restore worker tests.
packages/web-pkg/tests/unit/composables/webWorkers/pasteWorker/worker.spec.ts Increases per-file Vitest timeouts for the real paste worker tests.
packages/web-pkg/tests/unit/composables/webWorkers/exportAsPdfWorker/worker.spec.ts Increases per-file Vitest timeouts for the real export-as-PDF worker tests.
packages/web-pkg/tests/unit/composables/webWorkers/deleteWorker/worker.spec.ts Increases per-file Vitest timeouts for the real delete worker tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/web-pkg/tests/unit/composables/webWorkers/restoreWorker/worker.spec.ts Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@sonarqubecloud

Copy link
Copy Markdown

@LukasHirt LukasHirt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last commit is not conventional.

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.

4 participants