Skip to content

Commit f548d1c

Browse files
authored
[test] fix eventHubConsumerClientUnitTests compile error (#36692)
This error exists and only surfaced recently because of possible improvements in latest vitest version. The problem is that `_createEventProcessor` is private in `EventHubConsumerClient` but is public in the intersection type, leading to a resolved type of `never` for the first parameter of `spyOn`. Previous versions of vitest didn't report on this. This PR casts `client` to `any` instead, which should be fine in tests.
1 parent 1845b7e commit f548d1c

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

sdk/eventhub/event-hubs/test/internal/eventHubConsumerClientUnitTests.spec.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,7 @@ function mockCreateEventProcessor(
1919
client: EventHubConsumerClient,
2020
mockImpl: (typeof client)["_createEventProcessor"],
2121
): void {
22-
vi.spyOn(
23-
client as EventHubConsumerClient & {
24-
_createEventProcessor: (typeof client)["_createEventProcessor"];
25-
},
26-
"_createEventProcessor",
27-
).mockImplementation(mockImpl as any);
22+
vi.spyOn(client as any, "_createEventProcessor").mockImplementation(mockImpl as any);
2823
}
2924

3025
describe("EventHubConsumerClient", () => {

sdk/eventhub/event-hubs/vitest.browser.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Licensed under the MIT License.
33

44
import { defineConfig, mergeConfig } from "vitest/config";
5-
import viteConfig from "../../../vitest.shared.config.js";
5+
import viteConfig from "../../../vitest.browser.base.config.ts";
66
import browserMap from "@azure-tools/vite-plugin-browser-test-map";
77
import inject from "@rollup/plugin-inject";
88
import { fileURLToPath } from "node:url";

0 commit comments

Comments
 (0)