Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Sep 8, 2023
1 parent ca804ef commit 0db9ca9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/ui/client/components/views/ViewReport.vue
Expand Up @@ -35,7 +35,7 @@ function escapeHtml(unsafe: string) {
function createHtmlError(filter: Convert, error: ErrorWithDiff) {
let htmlError = ''
if (error.message.includes('\x1B'))
if (error.message?.includes('\x1B'))
htmlError = `<b>${error.nameStr || error.name}</b>: ${filter.toHtml(escapeHtml(error.message))}`
const startStrWithX1B = error.stackStr?.includes('\x1B')
Expand Down
4 changes: 2 additions & 2 deletions packages/vitest/src/api/setup.ts
Expand Up @@ -71,12 +71,12 @@ export function setup(vitestOrWorkspace: Vitest | WorkspaceProject, server?: Vit
},
async readSnapshotFile(snapshotPath) {
if (!ctx.snapshot.resolvedPaths.has(snapshotPath) || !existsSync(snapshotPath))
throw new Error(`Snapshot file "${snapshotPath}" does not exist.`)
return null
return fs.readFile(snapshotPath, 'utf-8')
},
async readTestFile(id) {
if (!ctx.state.filesMap.has(id) || !existsSync(id))
throw new Error(`Test file "${id}" was not registered, so it cannot be read using the API.`)
return null
return fs.readFile(id, 'utf-8')
},
async saveTestFile(id, content) {
Expand Down

0 comments on commit 0db9ca9

Please sign in to comment.