diff --git a/packages/misc/driver-test-suite/src/mod.ts b/packages/misc/driver-test-suite/src/mod.ts
index 8a971da22..c070fd993 100644
--- a/packages/misc/driver-test-suite/src/mod.ts
+++ b/packages/misc/driver-test-suite/src/mod.ts
@@ -17,6 +17,7 @@ import { createNodeWebSocket, type NodeWebSocket } from "@hono/node-ws";
import invariant from "invariant";
import { bundleRequire } from "bundle-require";
import { getPort } from "actor-core/test";
+import { Transport } from "actor-core/client";
export interface DriverTestConfig {
/** Deploys an app and returns the connection endpoint. */
@@ -32,6 +33,10 @@ export interface DriverTestConfig {
HACK_skipCleanupNet?: boolean;
}
+export interface DriverTestConfigWithTransport extends DriverTestConfig {
+ transport: Transport;
+}
+
export interface DriverDeployOutput {
endpoint: string;
@@ -41,10 +46,18 @@ export interface DriverDeployOutput {
/** Runs all Vitest tests against the provided drivers. */
export function runDriverTests(driverTestConfig: DriverTestConfig) {
- describe("driver tests", () => {
- runActorDriverTests(driverTestConfig);
- runManagerDriverTests(driverTestConfig);
- });
+ for (const transport of ["websocket", "sse"] as Transport[]) {
+ describe(`driver tests (${transport})`, () => {
+ runActorDriverTests({
+ ...driverTestConfig,
+ transport,
+ });
+ runManagerDriverTests({
+ ...driverTestConfig,
+ transport,
+ });
+ });
+ }
}
/**
diff --git a/packages/misc/driver-test-suite/src/tests/actor-driver.ts b/packages/misc/driver-test-suite/src/tests/actor-driver.ts
index 66d702b03..c4ec937dc 100644
--- a/packages/misc/driver-test-suite/src/tests/actor-driver.ts
+++ b/packages/misc/driver-test-suite/src/tests/actor-driver.ts
@@ -1,5 +1,5 @@
import { describe, test, expect, vi } from "vitest";
-import type { DriverTestConfig } from "@/mod";
+import type { DriverTestConfig, DriverTestConfigWithTransport } from "@/mod";
import { setupDriverTest } from "@/utils";
import { resolve } from "node:path";
import type { App as CounterApp } from "../../fixtures/apps/counter";
@@ -20,7 +20,7 @@ export async function waitFor(
return Promise.resolve();
}
}
-export function runActorDriverTests(driverTestConfig: DriverTestConfig) {
+export function runActorDriverTests(driverTestConfig: DriverTestConfigWithTransport) {
describe("Actor Driver Tests", () => {
describe("State Persistence", () => {
test("persists state between actor instances", async (c) => {
@@ -110,4 +110,4 @@ export function runActorDriverTests(driverTestConfig: DriverTestConfig) {
});
});
});
-}
\ No newline at end of file
+}
diff --git a/packages/misc/driver-test-suite/src/tests/manager-driver.ts b/packages/misc/driver-test-suite/src/tests/manager-driver.ts
index 1e66ce973..6b1b63534 100644
--- a/packages/misc/driver-test-suite/src/tests/manager-driver.ts
+++ b/packages/misc/driver-test-suite/src/tests/manager-driver.ts
@@ -1,11 +1,11 @@
import { describe, test, expect, vi } from "vitest";
-import { waitFor, type DriverTestConfig } from "@/mod";
+import { DriverTestConfigWithTransport, waitFor, type DriverTestConfig } from "@/mod";
import { setupDriverTest } from "@/utils";
import { resolve } from "node:path";
import type { App as CounterApp } from "../../fixtures/apps/counter";
import { ConnectionError } from "actor-core/client";
-export function runManagerDriverTests(driverTestConfig: DriverTestConfig) {
+export function runManagerDriverTests(driverTestConfig: DriverTestConfigWithTransport) {
describe("Manager Driver Tests", () => {
describe("Client Connection Methods", () => {
test("connect() - finds or creates an actor", async (c) => {
diff --git a/packages/misc/driver-test-suite/src/utils.ts b/packages/misc/driver-test-suite/src/utils.ts
index 671837138..859aa082e 100644
--- a/packages/misc/driver-test-suite/src/utils.ts
+++ b/packages/misc/driver-test-suite/src/utils.ts
@@ -1,12 +1,12 @@
import type { ActorCoreApp } from "actor-core";
import { type TestContext, vi } from "vitest";
-import { createClient, type Client } from "actor-core/client";
-import type { DriverTestConfig } from "./mod";
+import { createClient, Transport, type Client } from "actor-core/client";
+import type { DriverTestConfig, DriverTestConfigWithTransport } from "./mod";
// Must use `TestContext` since global hooks do not work when running concurrently
export async function setupDriverTest>(
c: TestContext,
- driverTestConfig: DriverTestConfig,
+ driverTestConfig: DriverTestConfigWithTransport,
appPath: string,
): Promise<{
client: Client;
@@ -20,7 +20,9 @@ export async function setupDriverTest>(
c.onTestFinished(cleanup);
// Create client
- const client = createClient(endpoint);
+ const client = createClient(endpoint, {
+ transport: driverTestConfig.transport,
+ });
if (!driverTestConfig.HACK_skipCleanupNet) {
c.onTestFinished(async () => await client.dispose());
}