Open Mnigos opened 3 months ago
I will try to verify if this an issue of this lib or vitest it self. Thx for raising.
Hey @eratio08 have you had a chance to take a look? I'm experiencing the same issue with vitest-mock-extended
.
@mthenw sadly not, I need to make time for this, sorry!
@Mnigos Could you provide me a minimal repo to debug this? Would be high appreciated.
Using the following I could not reproduce any freezing behavior
interface HistoryTrack { }
interface SdkTrack { }
interface PlayHistory {
track: SdkTrack
played_at: string
}
describe('updateOrCreateHistoryByUser', () => {
let historyTrack: MockProxy<HistoryTrack>
let historyTracks: MockProxy<HistoryTrack[]>
let playHistoryMock: DeepMockProxy<PlayHistory[]>
beforeEach(() => {
historyTrack = mock<HistoryTrack>()
historyTracks = [historyTrack]
})
it('should be true', () => {
expect(true).toBeTruthy()
})
})
describe('updateOrCreateHistoryByUserDeep', () => {
let historyTrack: MockProxy<HistoryTrack>
let historyTracks: MockProxy<HistoryTrack[]>
let playHistoryMock: DeepMockProxy<PlayHistory[]>
const sdkTracksMock: MockProxy<SdkTrack>[] = [mock()]
beforeEach(() => {
historyTrack = mock<HistoryTrack>()
historyTracks = [historyTrack]
playHistoryMock = mockDeep<PlayHistory[]>(
sdkTracksMock.map((track) => ({
track,
played_at: new Date().toISOString(),
})),
)
})
it('should be true', () => {
expect(true).toBeTruthy()
})
})
@Mnigos Could you provide me a minimal repo to debug this? Would be high appreciated.
Sure I will try to create some minimal reproduction soon.
good:
This test completes almost instantly
bad:
Takes up to 25s to complete the test or freezes test runner and doesn't complete at all
I'm using vitest
v1.4.0
, but issue also apears onv1.0.1
. I guess it might work with0.34.0
, but not with V1