mirror of
https://github.com/hanzoai/vitest.git
synced 2026-09-24 17:04:25 +00:00
16 lines
549 B
TypeScript
16 lines
549 B
TypeScript
import type { RunnerTestCase, TestArtifactLocation } from 'vitest'
|
|
import { relative } from 'pathe'
|
|
import { config } from './client'
|
|
import { showAttachmentSource } from './codemirror'
|
|
|
|
export function openLocation(test: RunnerTestCase, location?: TestArtifactLocation) {
|
|
return showAttachmentSource(test, location)
|
|
}
|
|
|
|
export function getLocationString(location: TestArtifactLocation) {
|
|
const root = config.value.root
|
|
const path = root ? relative(root, location.file) : location.file
|
|
|
|
return `${path}:${location.line}:${location.column}`
|
|
}
|