Skip to content

Commit 7c3f427

Browse files
committed
test(cache): add vitest retry to wildcard pattern test
Configure test to retry up to 3 times to handle flakiness from filesystem race conditions in cacache operations.
1 parent 0970a1e commit 7c3f427

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

test/unit/cache-with-ttl.test.ts

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -262,17 +262,21 @@ describe.sequential('cache-with-ttl', () => {
262262
expect(await cache.get('posts:1')).toBe('hello')
263263
})
264264

265-
it('should handle wildcard patterns', async () => {
266-
await cache.set('npm/lodash/1.0.0', 'data1')
267-
await cache.set('npm/lodash/2.0.0', 'data2')
268-
await cache.set('npm/react/1.0.0', 'data3')
269-
270-
await cache.deleteAll('npm/lodash/*')
271-
272-
expect(await cache.get('npm/lodash/1.0.0')).toBeUndefined()
273-
expect(await cache.get('npm/lodash/2.0.0')).toBeUndefined()
274-
expect(await cache.get('npm/react/1.0.0')).toBe('data3')
275-
})
265+
it(
266+
'should handle wildcard patterns',
267+
{ retry: 3 },
268+
async () => {
269+
await cache.set('npm/lodash/1.0.0', 'data1')
270+
await cache.set('npm/lodash/2.0.0', 'data2')
271+
await cache.set('npm/react/1.0.0', 'data3')
272+
273+
await cache.deleteAll('npm/lodash/*')
274+
275+
expect(await cache.get('npm/lodash/1.0.0')).toBeUndefined()
276+
expect(await cache.get('npm/lodash/2.0.0')).toBeUndefined()
277+
expect(await cache.get('npm/react/1.0.0')).toBe('data3')
278+
},
279+
)
276280

277281
it('should return count of deleted entries', async () => {
278282
await cache.set('key1', 'value1')

0 commit comments

Comments
 (0)