[READ-ONLY] Mirror of https://github.com/vitest-dev/vitest. Next generation testing framework powered by Vite. vitest.dev
test testing-tools vite
12

Configure Feed

Select the types of activity you want to include in your feed.

test: fix static-collect on rolldown (#9456)

authored by

Vladimir and committed by
GitHub
(Jan 15, 2026, 12:53 PM +0100) 1ba14a2f de8a3a43

+16 -4
+14 -4
test/cli/test/static-collect.test.ts
··· 1 1 import type { CliOptions, TestCase, TestModule, TestSuite } from 'vitest/node' 2 2 import { expect, test } from 'vitest' 3 - import { createVitest } from 'vitest/node' 3 + import { createVitest, rolldownVersion } from 'vitest/node' 4 4 5 5 test('correctly collects a simple test', async () => { 6 6 const testModule = await collectTests(` ··· 575 575 "each tests": { 576 576 "barTest with each %i": { 577 577 "dynamic": true, 578 + "each": true, 578 579 "errors": [], 579 580 "fullName": "each tests > barTest with each %i", 580 581 "id": "-1732721377_0_2-dynamic", ··· 584 585 }, 585 586 "test with each %i": { 586 587 "dynamic": true, 588 + "each": true, 587 589 "errors": [], 588 590 "fullName": "each tests > test with each %i", 589 591 "id": "-1732721377_0_0-dynamic", ··· 593 595 }, 594 596 "testFoo with each %i": { 595 597 "dynamic": true, 598 + "each": true, 596 599 "errors": [], 597 600 "fullName": "each tests > testFoo with each %i", 598 601 "id": "-1732721377_0_1-dynamic", ··· 812 815 } 813 816 814 817 function testItem(testCase: TestCase) { 818 + let location: string | undefined 819 + if (testCase.location) { 820 + // rolldown's column is moved by 1 when using test.each/test.for 821 + const column = rolldownVersion && testCase.options.each 822 + ? testCase.location.column - 1 823 + : testCase.location.column 824 + location = `${testCase.location.line}:${column}` 825 + } 815 826 return { 816 827 id: testCase.id, 817 - location: testCase.location 818 - ? `${testCase.location.line}:${testCase.location.column}` 819 - : undefined, 828 + location, 820 829 mode: testCase.options.mode, 821 830 fullName: testCase.fullName, 822 831 state: testCase.result().state, 823 832 errors: testCase.result().errors || [], 824 833 ...(testCase.task.dynamic ? { dynamic: true } : {}), 834 + ...(testCase.options.each ? { each: true } : {}), 825 835 } 826 836 }
+2
packages/vitest/src/node/ast-collect.ts
··· 338 338 file, 339 339 tasks: [], 340 340 mode, 341 + each: definition.dynamic, 341 342 name: definition.name, 342 343 fullName: createTaskName([latestSuite.fullName, definition.name]), 343 344 fullTestName: createTaskName([latestSuite.fullTestName, definition.name]), ··· 357 358 id: '', 358 359 suite: latestSuite, 359 360 file, 361 + each: definition.dynamic, 360 362 mode, 361 363 context: {} as any, // not used on the server 362 364 name: definition.name,