Skip to content

Commit

Permalink
test: skip more problematic tests
Browse files Browse the repository at this point in the history
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
  • Loading branch information
jerome-benoit committed Dec 1, 2024
1 parent f9b1ee9 commit f164133
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -512,23 +512,27 @@ test('task beforeAll, afterAll, beforeEach, afterEach', async () => {
expect(beforeEach.mock.calls.length).toBe(afterEach.mock.calls.length)
})

test('task with promiseLike return', async () => {
const bench = new Bench({ iterations: 16, time: 100 })

bench
.add('foo', () => ({
then: (resolve: () => void) => setTimeout(resolve, 50),
}))
.add('fum', () => ({
then: (resolve: () => void) => Promise.resolve(setTimeout(resolve, 50)),
}))
.add('bar', () => new Promise(resolve => setTimeout(resolve, 50)))
await bench.run()

expect(bench.getTask('foo')?.result?.latency.mean).toBeGreaterThan(50)
expect(bench.getTask('fum')?.result?.latency.mean).toBeGreaterThan(50)
expect(bench.getTask('bar')?.result?.latency.mean).toBeGreaterThan(50)
})
test(
'task with promiseLike return',
{ skip: platform() !== 'linux' },
async () => {
const bench = new Bench({ iterations: 16, time: 100 })

bench
.add('foo', () => ({
then: (resolve: () => void) => setTimeout(resolve, 50),
}))
.add('fum', () => ({
then: (resolve: () => void) => Promise.resolve(setTimeout(resolve, 50)),
}))
.add('bar', () => new Promise(resolve => setTimeout(resolve, 50)))
await bench.run()

expect(bench.getTask('foo')?.result?.latency.mean).toBeGreaterThan(50)
expect(bench.getTask('fum')?.result?.latency.mean).toBeGreaterThan(50)
expect(bench.getTask('bar')?.result?.latency.mean).toBeGreaterThan(50)
}
)

test.each(['warmup', 'run'])('%s error handling', async mode => {
const bench = new Bench({ warmup: mode === 'warmup' })
Expand Down

0 comments on commit f164133

Please sign in to comment.