Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,33 @@ describe('withDevtools feature', () => {
},
)

it("should throw 'No QueryClient found' when 'loadDevtools' is 'true' and no 'QueryClient' is provided", async () => {
const consoleErrorSpy = vi
.spyOn(console, 'error')
.mockImplementation(() => undefined)

TestBed.configureTestingModule({
providers: [
provideZonelessChangeDetection(),
withDevtools(() => ({
loadDevtools: true,
})).ɵproviders,
],
})

TestBed.inject(ENVIRONMENT_INITIALIZER)
TestBed.tick()
await vi.dynamicImportSettled()

expect(mockTanstackQueryDevtools).not.toHaveBeenCalled()
expect(consoleErrorSpy).toHaveBeenCalledWith(
'Install @tanstack/query-devtools or reinstall without --omit=optional.',
expect.objectContaining({ message: 'No QueryClient found' }),
)

consoleErrorSpy.mockRestore()
})

it('should not continue loading devtools after injector is destroyed', async () => {
TestBed.configureTestingModule({
providers: [
Expand Down
Loading