@cosmicdrift/kumiko-testing 0.306.0 → 0.308.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-testing",
3
- "version": "0.306.0",
3
+ "version": "0.308.0",
4
4
  "description": "Test template for Kumiko apps: per-flow seedTenant, app test stack, canonical test preloads, bunfig generator and integration runner.",
5
5
  "license": "BUSL-1.1",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
@@ -63,9 +63,9 @@
63
63
  "kumiko-testing": "./bin/kumiko-testing.ts"
64
64
  },
65
65
  "dependencies": {
66
- "@cosmicdrift/kumiko-bundled-features": "0.306.0",
67
- "@cosmicdrift/kumiko-dev-server": "0.306.0",
68
- "@cosmicdrift/kumiko-framework": "0.306.0",
66
+ "@cosmicdrift/kumiko-bundled-features": "0.308.0",
67
+ "@cosmicdrift/kumiko-dev-server": "0.308.0",
68
+ "@cosmicdrift/kumiko-framework": "0.308.0",
69
69
  "zod": "^4.4.3"
70
70
  },
71
71
  "peerDependencies": {
package/src/changes.json CHANGED
@@ -1,4 +1,19 @@
1
1
  [
2
+ {
3
+ "version": "0.308.0",
4
+ "type": "fix",
5
+ "title": "E2E default worker count no longer floors at 2"
6
+ },
7
+ {
8
+ "version": "0.308.0",
9
+ "type": "fix",
10
+ "title": "E2E worker default respects the container CPU limit"
11
+ },
12
+ {
13
+ "version": "0.307.0",
14
+ "type": "fix",
15
+ "title": "seedTenant loginAs switches users via clearSession"
16
+ },
2
17
  {
3
18
  "version": "0.306.0",
4
19
  "type": "improvement",
@@ -1,7 +1,7 @@
1
1
  import { currentTotpCode } from "@cosmicdrift/kumiko-bundled-features/auth-mfa/testing";
2
2
  import type { WriteErrorInfo } from "@cosmicdrift/kumiko-framework/errors";
3
3
  import { type APIRequestContext, type APIResponse, expect, type Page } from "@playwright/test";
4
- import { z } from "zod";
4
+ import * as z from "zod";
5
5
  import type { BoundApi } from "../seed-types";
6
6
  import { CSRF_COOKIE_NAME, CSRF_HEADER_NAME } from "./constants";
7
7
 
@@ -23,6 +23,10 @@ export const REAL_PROVIDERS_ENV = "KUMIKO_REAL_PROVIDERS";
23
23
  // that Bun-toolchain-adjacent module.
24
24
  export const STYLESHEET_WATCH_ENV = "KUMIKO_DEV_STYLESHEET_WATCH";
25
25
 
26
+ // Same literal as kumiko-dev-server's createKumikoServer (PROD_BUNDLES_ENV),
27
+ // duplicated for the same Node/Bun-toolchain reason.
28
+ export const PROD_BUNDLES_ENV = "KUMIKO_DEV_PROD_BUNDLES";
29
+
26
30
  export const SEED_ROUTE_PREFIX = "/__test";
27
31
 
28
32
  export const SEED_ROUTES = {
@@ -1,5 +1,5 @@
1
1
  import { randomUUID } from "node:crypto";
2
- import { cpus } from "node:os";
2
+ import { availableParallelism } from "node:os";
3
3
  import {
4
4
  defineConfig,
5
5
  devices,
@@ -11,6 +11,7 @@ import {
11
11
  import {
12
12
  E2E_WORKERS_ENV,
13
13
  PLAYWRIGHT_DEMO_ENV,
14
+ PROD_BUNDLES_ENV,
14
15
  REAL_PROVIDERS_ENV,
15
16
  SEED_ENABLE_ENV,
16
17
  SEED_TOKEN_ENV,
@@ -28,7 +29,13 @@ const TEMPLATE_OWNED_PROJECT_KEYS = [
28
29
  ] as const;
29
30
  const TEMPLATE_OWNED_USE_KEYS = ["actionTimeout", "navigationTimeout"] as const;
30
31
  const REAL_SPEC_GLOB = "**/*.real.spec.ts";
31
- const RESERVED_ENV_KEYS = ["PORT", SEED_ENABLE_ENV, SEED_TOKEN_ENV, STYLESHEET_WATCH_ENV] as const;
32
+ const RESERVED_ENV_KEYS = [
33
+ "PORT",
34
+ SEED_ENABLE_ENV,
35
+ SEED_TOKEN_ENV,
36
+ STYLESHEET_WATCH_ENV,
37
+ PROD_BUNDLES_ENV,
38
+ ] as const;
32
39
 
33
40
  type ProjectUse = Partial<PlaywrightTestOptions & PlaywrightWorkerOptions>;
34
41
 
@@ -54,11 +61,15 @@ function mutableTestMatch(
54
61
 
55
62
  export function resolveE2eWorkers(
56
63
  env: Readonly<Record<string, string | undefined>> = process.env,
57
- cpuCount: number = cpus().length,
64
+ // cpus() reports every host core inside a CPU-limited container (1.5 CPU CI
65
+ // pods got 4 workers); availableParallelism() honours the cgroup quota.
66
+ cpuCount: number = availableParallelism(),
58
67
  ): number {
59
68
  const override = env[E2E_WORKERS_ENV];
60
69
  if (override === undefined || override === "") {
61
- return Math.max(2, Math.min(4, Math.floor(cpuCount / 2)));
70
+ // 1.5 CPU CI pod, publicstatus 59 tests: 1/2/4 workers = 2.6/2.6/2.7 min;
71
+ // saturated at 1.
72
+ return Math.max(1, Math.min(4, Math.floor(cpuCount / 2)));
62
73
  }
63
74
  const workers = Number(override);
64
75
  if (!Number.isInteger(workers) || workers < 1) {
@@ -147,6 +158,9 @@ export function defineAppE2eConfig(input: AppE2eConfigInput): PlaywrightTestConf
147
158
  // recursively (Tailwind v4, no gitignore filter); every Playwright
148
159
  // artifact write under test-results/ would then count as a rebuild.
149
160
  [STYLESHEET_WATCH_ENV]: "0",
161
+ // E2E runs against prod-shaped bundles: splitting, no sourcemap,
162
+ // NODE_ENV=production — matches what actually ships.
163
+ [PROD_BUNDLES_ENV]: "1",
150
164
  },
151
165
  reuseExistingServer: false,
152
166
  timeout: E2E_TIMEOUT_MS.webServer,
@@ -1,5 +1,5 @@
1
1
  import { ROLES } from "@cosmicdrift/kumiko-framework/auth";
2
- import { z } from "zod";
2
+ import * as z from "zod";
3
3
 
4
4
  export const SEEDABLE_ROLES = [ROLES.TenantAdmin, ROLES.Member] as const;
5
5
  export const MAX_SEED_MEMBERS = 10;
@@ -11,7 +11,7 @@ import {
11
11
  type SignatureExtraRouteVerifyRequest,
12
12
  signatureRoute,
13
13
  } from "@cosmicdrift/kumiko-framework/api";
14
- import type { z } from "zod";
14
+ import type * as z from "zod";
15
15
  import {
16
16
  persistTenantRows,
17
17
  persistUserRows,
@@ -7,7 +7,7 @@ import {
7
7
  type PlaywrightTestOptions,
8
8
  type PlaywrightWorkerArgs,
9
9
  } from "@playwright/test";
10
- import type { z } from "zod";
10
+ import type * as z from "zod";
11
11
  import {
12
12
  type BoundApi,
13
13
  type SeededCredentials,
@@ -16,7 +16,7 @@ import {
16
16
  type SeedTenantOptions,
17
17
  withSession,
18
18
  } from "../seed-types";
19
- import { createHttpApi, loginViaApi } from "./auth-kit";
19
+ import { clearSession, createHttpApi, loginViaApi } from "./auth-kit";
20
20
  import { SEED_ROUTES } from "./constants";
21
21
  import { seedRouteHeaders } from "./mail-capture";
22
22
  import {
@@ -93,7 +93,7 @@ export async function provideSeedTenant(
93
93
  };
94
94
 
95
95
  const loginAs = async (page: Page, user: SeededUser): Promise<void> => {
96
- await page.context().clearCookies();
96
+ await clearSession(page);
97
97
  await loginViaApi(page.context().request, user);
98
98
  };
99
99