colocated-vitest-test-discovery: Colocated Vitest Test Discovery #5

Open
std-bot wants to merge 2 commits from task/colocated-vitest-test-discovery into main
First-time contributor

Assigned idea

Benchmark authoring specification.

Summary: Update zca-bridge's Vitest configuration so source-adjacent tests under src/**/*.test.ts are discovered while preserving the existing Node test setup and coverage boundaries.

Task intent: Make an ordinary upstream-facing config change: Vitest should continue running test//*.test.ts, also run colocated src//.test.ts files, keep globals enabled, keep environment set to node, keep v8 coverage for src/**/.ts, and keep src/main.ts plus colocated test files out of coverage.

Benchmark plan: Construct the package from the fixed commit and present the solver with only the upstream-facing request to support colocated Vitest tests. The expected patch is a small config edit. The hidden checker should add temporary tests under src/ and test/ to prove both discovery paths work and then verify coverage exclusion behavior.

Environment plan: Task/environment: use a Node.js environment with the repository dependencies installed and Vitest available. Environment/repo: materialize diendh/zca-bridge at 27a88edaf4d96eb037dc3aef3f54872e9435481f, run the repo's normal dependency install process, and execute checks from the repository root without changing package metadata for this config-only change.

Verifier plan: test_outputs.py should require that vitest.config.ts still defines globals: true, environment: "node", coverage provider "v8", coverage include src/**/*.ts, and coverage exclude src/main.ts. It should create temporary files such as src/vitest_config_colocated.test.ts and test/vitest_config_legacy.test.ts, run Vitest with the repo config, assert both files are collected, then run coverage and assert the colocated test file and src/main.ts do not appear in the coverage-final.json paths.

Oracle plan: The oracle solution edits vitest.config.ts only: extend test.include from ["test//*.test.ts"] to include "src//.test.ts" as well, and extend coverage.exclude so colocated test files such as "src/**/.test.ts" are excluded while preserving "src/main.ts".

Difficulty plan: Coding agents may replace the existing include glob instead of appending to it, accidentally disable globals, change the Node environment, remove the v8 provider, or forget that adding src/**/*.test.ts also requires excluding those test files from coverage.

Repo patch scope: Expected upstream edit scope is limited to vitest.config.ts. The verifier may create temporary check files under src/ and test/, but the submitted patch should not modify application source, dependency manifests, or package scripts.

Anti-leakage notes: Do not expose solver-facing benchmark, harness, Snorkel, Harbor, std-ts, agent, stage, attempt, retry, generated task, or evaluation context. The prompt should read like a normal maintainer request about Vitest configuration.

Approach: Use the existing Vitest config as the anchor: preserve its Node/global/v8 coverage behavior, add source-adjacent test discovery, and protect coverage from counting test files.

Verification: Run python3 test_outputs.py; it should inspect vitest.config.ts, invoke npx vitest --config vitest.config.ts run --reporter=json --outputFile .vitest-config-report.json __vitest_config_, and run a coverage command such as npx vitest --config vitest.config.ts run --coverage --coverage.reporter=json --coverage.reportsDirectory .vitest-coverage __vitest_config_.

Risk: If the repository lacks the v8 coverage package in its installed dependencies, the coverage portion could fail for environmental reasons; the checker should report that distinctly from a config failure.

Path rules: task package is tasks/; mutable upstream checkout is tasks//environment/repo; benchmark package files are under tasks//task; verifier/container environment belongs under tasks//task/environment; regular and UI verifier logic belongs in task/tests/test_outputs.py and test.sh only runs that file through pytest.

Agent context

Task slug: colocated-vitest-test-discovery
Branch: task/colocated-vitest-test-discovery

## Assigned idea Benchmark authoring specification. Summary: Update zca-bridge's Vitest configuration so source-adjacent tests under src/**/*.test.ts are discovered while preserving the existing Node test setup and coverage boundaries. Task intent: Make an ordinary upstream-facing config change: Vitest should continue running test/**/*.test.ts, also run colocated src/**/*.test.ts files, keep globals enabled, keep environment set to node, keep v8 coverage for src/**/*.ts, and keep src/main.ts plus colocated test files out of coverage. Benchmark plan: Construct the package from the fixed commit and present the solver with only the upstream-facing request to support colocated Vitest tests. The expected patch is a small config edit. The hidden checker should add temporary tests under src/ and test/ to prove both discovery paths work and then verify coverage exclusion behavior. Environment plan: Task/environment: use a Node.js environment with the repository dependencies installed and Vitest available. Environment/repo: materialize diendh/zca-bridge at 27a88edaf4d96eb037dc3aef3f54872e9435481f, run the repo's normal dependency install process, and execute checks from the repository root without changing package metadata for this config-only change. Verifier plan: test_outputs.py should require that vitest.config.ts still defines globals: true, environment: "node", coverage provider "v8", coverage include src/**/*.ts, and coverage exclude src/main.ts. It should create temporary files such as src/__vitest_config_colocated__.test.ts and test/__vitest_config_legacy__.test.ts, run Vitest with the repo config, assert both files are collected, then run coverage and assert the colocated test file and src/main.ts do not appear in the coverage-final.json paths. Oracle plan: The oracle solution edits vitest.config.ts only: extend test.include from ["test/**/*.test.ts"] to include "src/**/*.test.ts" as well, and extend coverage.exclude so colocated test files such as "src/**/*.test.ts" are excluded while preserving "src/main.ts". Difficulty plan: Coding agents may replace the existing include glob instead of appending to it, accidentally disable globals, change the Node environment, remove the v8 provider, or forget that adding src/**/*.test.ts also requires excluding those test files from coverage. Repo patch scope: Expected upstream edit scope is limited to vitest.config.ts. The verifier may create temporary check files under src/ and test/, but the submitted patch should not modify application source, dependency manifests, or package scripts. Anti-leakage notes: Do not expose solver-facing benchmark, harness, Snorkel, Harbor, std-ts, agent, stage, attempt, retry, generated task, or evaluation context. The prompt should read like a normal maintainer request about Vitest configuration. Approach: Use the existing Vitest config as the anchor: preserve its Node/global/v8 coverage behavior, add source-adjacent test discovery, and protect coverage from counting test files. Verification: Run `python3 test_outputs.py`; it should inspect `vitest.config.ts`, invoke `npx vitest --config vitest.config.ts run --reporter=json --outputFile .vitest-config-report.json __vitest_config_`, and run a coverage command such as `npx vitest --config vitest.config.ts run --coverage --coverage.reporter=json --coverage.reportsDirectory .vitest-coverage __vitest_config_`. Risk: If the repository lacks the v8 coverage package in its installed dependencies, the coverage portion could fail for environmental reasons; the checker should report that distinctly from a config failure. Path rules: task package is tasks/<slug>; mutable upstream checkout is tasks/<slug>/environment/repo; benchmark package files are under tasks/<slug>/task; verifier/container environment belongs under tasks/<slug>/task/environment; regular and UI verifier logic belongs in task/tests/test_outputs.py and test.sh only runs that file through pytest. ## Agent context Task slug: colocated-vitest-test-discovery Branch: task/colocated-vitest-test-discovery <!-- std-ts:idea-pr-body -->
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin task/colocated-vitest-test-discovery:task/colocated-vitest-test-discovery
git switch task/colocated-vitest-test-discovery

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff task/colocated-vitest-test-discovery
git switch task/colocated-vitest-test-discovery
git rebase main
git switch main
git merge --ff-only task/colocated-vitest-test-discovery
git switch task/colocated-vitest-test-discovery
git rebase main
git switch main
git merge --no-ff task/colocated-vitest-test-discovery
git switch main
git merge --squash task/colocated-vitest-test-discovery
git switch main
git merge --ff-only task/colocated-vitest-test-discovery
git switch main
git merge task/colocated-vitest-test-discovery
git push origin main
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
snorkel/root-repository-maintenance-e2b9480e3cde42!5
No description provided.