Skip to content

Commit

Permalink
refactor: use ansicolor instead of colors
Browse files Browse the repository at this point in the history
  • Loading branch information
snowyu committed Sep 30, 2024
1 parent ccf4745 commit d2bf2da
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"@oclif/core": "^4",
"@offline-ai/cli-common": "workspace:*",
"@offline-ai/cli-plugin-core": "workspace:*",
"ansicolor": "^2.0.3",
"color-json": "^3.0.5",
"colors": "^1.4.0",
"diff": "^7.0.0",
"lodash-es": "^4.17.21"
},
Expand All @@ -28,11 +28,11 @@
"@types/lodash-es": "^4.17.12",
"@types/mocha": "^10",
"@types/node": "^20",
"chai": "^5",
"eslint": "^8",
"eslint-config-oclif": "^5.2.0",
"eslint-config-oclif-typescript": "^3",
"eslint-config-prettier": "^9",
"chai": "^5",
"mocha": "^10",
"oclif": "^4.13.12",
"shx": "^0.3.4",
Expand Down
6 changes: 3 additions & 3 deletions src/lib/to-match-object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// } from '@vitest/expect'
import { getKeysPath, isRegExp, toRegExp } from '@isdk/ai-tool'
import { cloneDeep, get as getByPath } from 'lodash-es'
import 'colors'
import colors from 'ansicolor'
import { diffChars } from 'diff'

// // allows using expect.extend instead of chai.use to extend plugins
Expand All @@ -32,8 +32,8 @@ export function toMatchObject(actual: any, expected: any, failedKeys: string[] =
const diff = diffChars(actualValue, v)
// const diffStr = diff.map(d => d.added ? `+${d.value}` : d.removed ? `-${d.value}` : d.value).join('')
const diffStr = diff.map(d =>
d.added ? d.value.bgGreen :
d.removed ? d.value.bgRed : d.value).join('')
d.added ? colors.green('+'+d.value) :
d.removed ? colors.red('-'+d.value) : colors.darkGray(d.value)).join('')
failedKeys.push(k+ ':' + diffStr)
}
} else {
Expand Down

0 comments on commit d2bf2da

Please sign in to comment.