MCPcopy
hub / github.com/vitest-dev/vitest / testItem

Function testItem

test/cli/test/static-collect.test.ts:1704–1731  ·  view source on GitHub ↗
(
  testCase: TestCase,
  // A function returning a function (like test.runIf()('name'))
  // rolldown's column is moved by 1 in that case
  fnFn?: boolean,
)

Source from the content-addressed store, hash-verified

1702}
1703
1704function testItem(
1705 testCase: TestCase,
1706 // A function returning a function (like test.runIf()('name'))
1707 // rolldown's column is moved by 1 in that case
1708 fnFn?: boolean,
1709) {
1710 let location: string | undefined
1711 const state = testCase.result().state
1712 if (testCase.location) {
1713 // rolldown's column is moved by 1 when using test.each/test.for
1714 const column = rolldownVersion && (testCase.options.each || fnFn)
1715 ? testCase.location.column - 1
1716 : testCase.location.column
1717 location = `${testCase.location.line}:${column}`
1718 }
1719 return {
1720 id: testCase.id,
1721 location,
1722 mode: testCase.options.mode,
1723 fullName: testCase.fullName,
1724 state,
1725 errors: testCase.result().errors || [],
1726 ...(testCase.task.dynamic ? { dynamic: true } : {}),
1727 ...(testCase.options.each ? { each: true } : {}),
1728 ...(testCase.options.concurrent ? { concurrent: true } : {}),
1729 ...(testCase.task.tags?.length ? { tags: testCase.task.tags } : {}),
1730 }
1731}

Callers 1

testTreeFunction · 0.85

Calls 1

resultMethod · 0.80

Tested by

no test coverage detected