Skip to content

Commit effe9ef

Browse files
committed
chore: replace picocolors with tinyrainbow
1 parent af7fec5 commit effe9ef

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+2120
-451
lines changed

docs/config/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2181,7 +2181,7 @@ Path to a diff config that will be used to generate diff interface. Useful if yo
21812181
:::code-group
21822182
```ts [vitest.diff.ts]
21832183
import type { DiffOptions } from 'vitest'
2184-
import c from 'picocolors'
2184+
import c from 'tinyrainbow'
21852185

21862186
export default {
21872187
aIndicator: c.bold('--'),

packages/browser/src/node/plugin.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -183,16 +183,9 @@ export default (browserServer: BrowserServer, base = '/'): Plugin[] => {
183183
'msw/browser',
184184
],
185185
include: [
186-
'vitest > @vitest/utils > pretty-format',
187-
'vitest > @vitest/snapshot > pretty-format',
188186
'vitest > @vitest/snapshot > magic-string',
189-
'vitest > pretty-format',
190-
'vitest > pretty-format > ansi-styles',
191-
'vitest > pretty-format > ansi-regex',
192187
'vitest > chai',
193188
'vitest > chai > loupe',
194-
'vitest > @vitest/runner > pretty-format',
195-
'vitest > @vitest/utils > diff-sequences',
196189
'vitest > @vitest/utils > loupe',
197190
'@vitest/browser > @testing-library/user-event',
198191
'@vitest/browser > @testing-library/dom',

packages/coverage-istanbul/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252
"istanbul-lib-source-maps": "^5.0.6",
5353
"istanbul-reports": "^3.1.7",
5454
"magicast": "^0.3.4",
55-
"picocolors": "^1.0.1",
56-
"test-exclude": "^7.0.1"
55+
"test-exclude": "^7.0.1",
56+
"tinyrainbow": "^1.1.2"
5757
},
5858
"devDependencies": {
5959
"@types/debug": "^4.1.12",

packages/coverage-istanbul/src/provider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
coverageConfigDefaults,
1818
} from 'vitest/config'
1919
import { BaseCoverageProvider } from 'vitest/coverage'
20-
import c from 'picocolors'
20+
import c from 'tinyrainbow'
2121
import { parseModule } from 'magicast'
2222
import createDebug from 'debug'
2323
import libReport from 'istanbul-lib-report'

packages/coverage-v8/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@
5353
"istanbul-reports": "^3.1.7",
5454
"magic-string": "^0.30.10",
5555
"magicast": "^0.3.4",
56-
"picocolors": "^1.0.1",
5756
"std-env": "^3.7.0",
5857
"strip-literal": "^2.1.0",
59-
"test-exclude": "^7.0.1"
58+
"test-exclude": "^7.0.1",
59+
"tinyrainbow": "^1.1.2"
6060
},
6161
"devDependencies": {
6262
"@types/debug": "^4.1.12",

packages/coverage-v8/src/provider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import MagicString from 'magic-string'
1717
import { parseModule } from 'magicast'
1818
import remapping from '@ampproject/remapping'
1919
import { normalize, resolve } from 'pathe'
20-
import c from 'picocolors'
20+
import c from 'tinyrainbow'
2121
import { provider } from 'std-env'
2222
import { stripLiteral } from 'strip-literal'
2323
import createDebug from 'debug'

packages/expect/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@
3636
"dependencies": {
3737
"@vitest/spy": "workspace:*",
3838
"@vitest/utils": "workspace:*",
39-
"chai": "^5.1.1"
39+
"chai": "^5.1.1",
40+
"tinyrainbow": "^1.1.2"
4041
},
4142
"devDependencies": {
4243
"@types/chai": "4.3.6",
4344
"@vitest/runner": "workspace:*",
44-
"picocolors": "^1.0.1",
4545
"rollup-plugin-copy": "^3.5.0"
4646
}
4747
}

packages/expect/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ export { getState, setState } from './state'
66
export { JestChaiExpect } from './jest-expect'
77
export { addCustomEqualityTesters } from './jest-matcher-utils'
88
export { JestExtend } from './jest-extend'
9-
export { setupColors } from '@vitest/utils'

packages/expect/src/jest-expect.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { assertTypes, getColors } from '@vitest/utils'
1+
import { assertTypes } from '@vitest/utils'
2+
import c from 'tinyrainbow'
23
import type { Constructable } from '@vitest/utils'
34
import type { MockInstance, MockResult, MockSettledResult } from '@vitest/spy'
45
import { isMockFunction } from '@vitest/spy'
@@ -35,7 +36,6 @@ declare class DOMTokenList {
3536
// Jest Expect Compact
3637
export const JestChaiExpect: ChaiPlugin = (chai, utils) => {
3738
const { AssertionError } = chai
38-
const c = () => getColors()
3939
const customTesters = getCustomEqualityTesters()
4040

4141
function def(
@@ -530,10 +530,10 @@ export const JestChaiExpect: ChaiPlugin = (chai, utils) => {
530530
showActualCall?: any,
531531
) => {
532532
if (spy.mock.calls) {
533-
msg += c().gray(
533+
msg += c.gray(
534534
`\n\nReceived: \n\n${spy.mock.calls
535535
.map((callArg, i) => {
536-
let methodCall = c().bold(
536+
let methodCall = c.bold(
537537
` ${ordinalOf(i + 1)} ${spy.getMockName()} call:\n\n`,
538538
)
539539
if (showActualCall) {
@@ -554,8 +554,8 @@ export const JestChaiExpect: ChaiPlugin = (chai, utils) => {
554554
.join('\n')}`,
555555
)
556556
}
557-
msg += c().gray(
558-
`\n\nNumber of calls: ${c().bold(spy.mock.calls.length)}\n`,
557+
msg += c.gray(
558+
`\n\nNumber of calls: ${c.bold(spy.mock.calls.length)}\n`,
559559
)
560560
return msg
561561
}
@@ -565,10 +565,10 @@ export const JestChaiExpect: ChaiPlugin = (chai, utils) => {
565565
msg: string,
566566
showActualReturn?: any,
567567
) => {
568-
msg += c().gray(
568+
msg += c.gray(
569569
`\n\nReceived: \n\n${results
570570
.map((callReturn, i) => {
571-
let methodCall = c().bold(
571+
let methodCall = c.bold(
572572
` ${ordinalOf(i + 1)} ${spy.getMockName()} call return:\n\n`,
573573
)
574574
if (showActualReturn) {
@@ -588,8 +588,8 @@ export const JestChaiExpect: ChaiPlugin = (chai, utils) => {
588588
})
589589
.join('\n')}`,
590590
)
591-
msg += c().gray(
592-
`\n\nNumber of calls: ${c().bold(spy.mock.calls.length)}\n`,
591+
msg += c.gray(
592+
`\n\nNumber of calls: ${c.bold(spy.mock.calls.length)}\n`,
593593
)
594594
return msg
595595
}

packages/expect/src/jest-matcher-utils.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
import { getColors, getType, stringify } from '@vitest/utils'
1+
import { getType, stringify } from '@vitest/utils'
2+
import c from 'tinyrainbow'
23
import type { MatcherHintOptions, Tester } from './types'
34
import { JEST_MATCHERS_OBJECT } from './constants'
45

56
export { diff } from '@vitest/utils/diff'
67
export { stringify }
78

89
export function getMatcherUtils() {
9-
const c = () => getColors()
10-
11-
const EXPECTED_COLOR = c().green
12-
const RECEIVED_COLOR = c().red
13-
const INVERTED_COLOR = c().inverse
14-
const BOLD_WEIGHT = c().bold
15-
const DIM_COLOR = c().dim
10+
const EXPECTED_COLOR = c.green
11+
const RECEIVED_COLOR = c.red
12+
const INVERTED_COLOR = c.inverse
13+
const BOLD_WEIGHT = c.bold
14+
const DIM_COLOR = c.dim
1615

1716
function matcherHint(
1817
matcherName: string,

0 commit comments

Comments
 (0)