Skip to content

Commit

Permalink
refactor: destructure process.env in reporter
Browse files Browse the repository at this point in the history
  • Loading branch information
ChALkeR committed Sep 5, 2024
1 parent 12be541 commit f1ea071
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions bin/reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { inspect } from 'node:util'
import { relative } from 'node:path'
import { spec as SpecReporter } from 'node:test/reporters'

const haveColors = process.stdout.hasColors?.() || process.env.FORCE_COLOR === '1' // 0 is already handled by hasColors()
const { FORCE_COLOR, CI, LERNA_PACKAGE_NAME } = process.env
const haveColors = process.stdout.hasColors?.() || FORCE_COLOR === '1' // 0 is already handled by hasColors()
const colors = new Map(Object.entries(inspect.colors))
const reportCI = process.env.CI
const dim = reportCI ? 'gray' : 'dim'
const dim = CI ? 'gray' : 'dim'

export const color = (text, color) => {
if (!haveColors || text === '') return text
Expand All @@ -28,7 +28,7 @@ export const format = (chunk) => {

const formatTime = (ms) => (ms ? color(` (${ms}ms)`, dim) : '')

const groupCI = reportCI && !process.execArgv.includes('--watch') && !process.env.LERNA_PACKAGE_NAME // lerna+nx groups already
const groupCI = CI && !process.execArgv.includes('--watch') && !LERNA_PACKAGE_NAME // lerna+nx groups already
export const timeLabel = color('Total time', dim)
export const head = groupCI ? () => {} : (file) => console.log(color(`# ${file}`, 'bold'))
export const middle = (file, ok, ms) => {
Expand Down

0 comments on commit f1ea071

Please sign in to comment.