Skip to content

Commit

Permalink
fix: use TTY reporter when running in Deno (#5972)
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinhagemeister authored Jun 25, 2024
1 parent 2a2c908 commit e0f45cb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/vitest/src/node/reporters/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
hasFailed,
hasFailedSnapshot,
isCI,
isDeno,
isNode,
relativePath,
toArray,
Expand Down Expand Up @@ -75,7 +76,7 @@ export abstract class BaseReporter implements Reporter {
private _offUnhandledRejection?: () => void

constructor(options: BaseOptions = {}) {
this.isTTY = options.isTTY ?? (isNode && process.stdout?.isTTY && !isCI)
this.isTTY = options.isTTY ?? ((isNode || isDeno) && process.stdout?.isTTY && !isCI)
this.registerUnhandledRejection()
}

Expand Down
6 changes: 5 additions & 1 deletion packages/vitest/src/utils/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ export const isNode: boolean
&& typeof process.stdout < 'u'
&& !process.versions?.deno
&& !globalThis.window
export const isWindows = isNode && process.platform === 'win32'
export const isDeno: boolean
= typeof process < 'u'
&& typeof process.stdout < 'u'
&& process.versions?.deno !== undefined
export const isWindows = (isNode || isDeno) && process.platform === 'win32'
export const isBrowser: boolean = typeof window !== 'undefined'
export { isCI, provider as stdProvider } from 'std-env'

0 comments on commit e0f45cb

Please sign in to comment.