Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reporter summary failing when used with custom pool #7551

Open
6 tasks done
nazarhussain opened this issue Feb 24, 2025 · 0 comments
Open
6 tasks done

Reporter summary failing when used with custom pool #7551

nazarhussain opened this issue Feb 24, 2025 · 0 comments

Comments

@nazarhussain
Copy link

Describe the bug

When we use a custom pool with default reporter settings, it failed withe following error.

Error: Task instance was not found for suite "testing skipped"
 ❯ getReportedTask node_modules/.pnpm/[email protected]_@[email protected]/node_modules/vitest/dist/chunks/cli-api.Dkt_XoKq.js:11494:11
 ❯ TestCollection.[Symbol.iterator] node_modules/.pnpm/[email protected]_@[email protected]/node_modules/vitest/dist/chunks/cli-api.Dkt_XoKq.js:11359:13
 ❯ TestCollection.allTests node_modules/.pnpm/[email protected]_@[email protected]/node_modules/vitest/dist/chunks/cli-api.Dkt_XoKq.js:11305:16
 ❯ SummaryReporter.onTestModuleCollected node_modules/.pnpm/[email protected]_@[email protected]/node_modules/vitest/dist/chunks/index.C1f-_gvH.js:1215:25
 ❯ DefaultReporter.onTestModuleCollected node_modules/.pnpm/[email protected]_@[email protected]/node_modules/vitest/dist/chunks/index.C1f-_gvH.js:1429:19
 ❯ node_modules/.pnpm/[email protected]_@[email protected]/node_modules/vitest/dist/chunks/cli-api.Dkt_XoKq.js:13221:58

And this happens for any root level test suite.

Reproduction

Can be tried on the following repo.

https://github.com/nazarhussain/vitest-in-process-pool/tree/nh/vitest-3-support

If following reporter settings are added, then the error is resolved.

    reporters: [["default", {"summary": false}]]

Additionally following patch can also fix the problem.

diff --git a/dist/chunks/cli-api.Dkt_XoKq.js b/dist/chunks/cli-api.Dkt_XoKq.js
index 1f830be315a74e43db34d9d7a418f0067721ba9c..9096fa32920e30a458cbe763bbfdcd0ecc08d759 100644
--- a/dist/chunks/cli-api.Dkt_XoKq.js
+++ b/dist/chunks/cli-api.Dkt_XoKq.js
@@ -11489,7 +11489,7 @@ function storeTask(project, runnerTask, reportedTask) {
   project.vitest.state.reportedTasksMap.set(runnerTask, reportedTask);
 }
 function getReportedTask(project, runnerTask) {
-  const reportedTask = project.vitest.state.getReportedEntity(runnerTask);
+  const reportedTask = project.vitest.state.getReportedEntity(runnerTask.type === "suite" ? runnerTask.file : runnerTask);
   if (!reportedTask) {
     throw new Error(
       `Task instance was not found for ${runnerTask.type} "${runnerTask.name}"`

System Info

System:
    OS: macOS 15.3.1
    CPU: (11) arm64 Apple M3 Pro
    Memory: 312.45 MB / 18.00 GB
    Shell: 5.9 - /Users/nazar/.flox/run/aarch64-darwin.default.dev/bin/zsh
  Binaries:
    Node: 22.13.0 - ~/.asdf/installs/nodejs/22.13.0/bin/node
    Yarn: 1.22.22 - ~/.asdf/installs/nodejs/22.13.0/bin/yarn
    npm: 10.9.2 - ~/.asdf/plugins/nodejs/shims/npm
    pnpm: 10.2.0 - ~/.asdf/installs/nodejs/22.13.0/bin/pnpm
    bun: 1.1.38 - ~/.asdf/shims/bun
  Browsers:
    Brave Browser: 133.1.75.175
    Edge: 133.0.3065.69
    Safari: 18.3
  npmPackages:
    vitest: ^3.0.6 => 3.0.6

Used Package Manager

pnpm

Validations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant