Skip to content

Commit

Permalink
fixed codspeed
Browse files Browse the repository at this point in the history
  • Loading branch information
XantreDev committed Aug 17, 2024
1 parent 08c8b08 commit 6c5ed9a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions benchmarks/twMerge.bench.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { bench, describe } from 'vitest'
import { bench, describe, beforeEach, BenchOptions } from 'vitest'

import { createTailwindMerge, getDefaultConfig } from '../src'

Expand All @@ -21,12 +21,15 @@ describe('twMerge', () => {
twMerge()
}
describe(cached ? 'cached' : 'pure', () => {
// codespeed tries to optimize function, before actual setup call - we need to adopt
process.env.CI && beforeEach(setup)
const options: BenchOptions | undefined = process.env.CI ? undefined : { setup }
bench(
withSuffix('simple'),
() => {
twMerge('flex mx-10 px-10', 'mr-5 pr-5')
},
{ setup },
options,
)

bench(
Expand All @@ -45,7 +48,7 @@ describe('twMerge', () => {
null,
)
},
{ setup },
options,
)
bench(
withSuffix('collection'),
Expand All @@ -55,7 +58,7 @@ describe('twMerge', () => {
twMerge(...(testData[i] as Exclude<Item, true>[]))
}
},
{ setup },
options,
)
})
}
Expand Down

0 comments on commit 6c5ed9a

Please sign in to comment.