Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/vitest-dev/vitest. Next generation testing framework powered by Vite. vitest.dev
test testing-tools vite
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354<script setup lang="ts">import type { ErrorWithDiff } from '#types'import { openInEditor, shouldOpenInEditor } from '~/composables/error'
const props = defineProps<{ root: string filename?: string error: ErrorWithDiff}>()
function relative(p: string) { if (p.startsWith(props.root)) return p.slice(props.root.length) return p}
const filter = computed(() => createAnsiToHtmlFilter(isDark.value))
const isDiffShowable = computed(() => { return !!props.error?.diff})
const diff = computed(() => props.error.diff ? filter.value.toHtml(props.error.diff) : undefined)</script>
<template> <div class="scrolls scrolls-rounded task-error"> <pre><b>{{ error.name || error.nameStr }}</b>: {{ error.message }}</pre> <div v-for="(stack, i) of error.stacks" :key="i" class="op80 flex gap-x-2 items-center" data-testid="stack"> <pre> - {{ relative(stack.file) }}:{{ stack.line }}:{{ stack.column }}</pre> <div v-if="shouldOpenInEditor(stack.file, filename)" v-tooltip.bottom="'Open in Editor'" class="i-carbon-launch c-red-600 dark:c-red-400 hover:cursor-pointer min-w-1em min-h-1em" tabindex="0" aria-label="Open in Editor" @click.passive="openInEditor(stack.file, stack.line, stack.column)" /> </div> <template v-if="isDiffShowable"> <pre data-testid="diff" v-html="diff" /> </template> </div></template>
<style scoped>.task-error { --cm-ttc-c-thumb: #CCC;}html.dark .task-error { --cm-ttc-c-thumb: #444;}</style>