mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-26 02:05:31 +00:00
Tests import packages/*/dist at run time. On a cold cache each worker transpiled the same files and wrote them into Playwright's shared transform cache without locking, so a worker could read an entry mid-write, load an empty module, and fail with "does not provide an export named". Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
60 lines
2.1 KiB
TypeScript
60 lines
2.1 KiB
TypeScript
import { defineConfig, devices } from "@playwright/test";
|
|
|
|
// E2E_METRO_PORT is set dynamically by global-setup.ts after finding a free port
|
|
// This allows multiple test runs in parallel across different worktrees
|
|
const baseURL =
|
|
process.env.E2E_BASE_URL ?? `http://localhost:${process.env.E2E_METRO_PORT ?? "8081"}`;
|
|
const relayDeploymentSpec = "**/relay-deployment-reconnect.real.spec.ts";
|
|
|
|
function videoMode(): "on" | "on-first-retry" | "retain-on-failure" {
|
|
if (process.env.E2E_RECORD_VIDEO === "1") return "on";
|
|
if (process.env.CI) return "on-first-retry";
|
|
return "retain-on-failure";
|
|
}
|
|
|
|
export default defineConfig({
|
|
testDir: "./e2e/browser",
|
|
globalSetup: "./e2e/support/global-setup.ts",
|
|
timeout: 60_000,
|
|
expect: {
|
|
timeout: 10_000,
|
|
},
|
|
// Files run concurrently, while each worker owns its daemon state. Keeping a
|
|
// spec on one worker avoids repeating its file-level setup across daemons.
|
|
fullyParallel: false,
|
|
workers: Number(process.env.E2E_WORKERS ?? (process.env.CI ? "2" : "1")),
|
|
// Workspace packages are already compiled. Tests import them at run time, so
|
|
// on a cold cache every worker transpiles the same files and writes them into
|
|
// Playwright's shared transform cache without locking. A worker that reads an
|
|
// entry mid-write loads an empty module and fails with "does not provide an
|
|
// export named".
|
|
build: { external: ["**/packages/*/dist/**"] },
|
|
retries: process.env.CI ? 1 : 0,
|
|
reporter: [["list"]],
|
|
use: {
|
|
baseURL,
|
|
trace: process.env.CI ? "on-first-retry" : "retain-on-failure",
|
|
screenshot: "only-on-failure",
|
|
video: videoMode(),
|
|
},
|
|
projects: [
|
|
{
|
|
name: "browser",
|
|
testIgnore: ["**/*.real.spec.ts"],
|
|
use: { ...devices["Desktop Chrome"] },
|
|
},
|
|
{
|
|
name: "real-provider",
|
|
testMatch: ["**/*.real.spec.ts"],
|
|
testIgnore: [relayDeploymentSpec],
|
|
use: { ...devices["Desktop Chrome"] },
|
|
},
|
|
{
|
|
name: "relay-deployment",
|
|
testMatch: [relayDeploymentSpec],
|
|
use: { ...devices["Desktop Chrome"] },
|
|
},
|
|
],
|
|
// Note: Metro is started by global-setup.ts on a dynamic port to allow parallel test runs
|
|
});
|