@cosmicdrift/kumiko-testing 0.351.0 → 0.353.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.351.0",
3
+ "version": "0.353.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>",
@@ -75,9 +75,9 @@
75
75
  "kumiko-testing": "./bin/kumiko-testing.ts"
76
76
  },
77
77
  "dependencies": {
78
- "@cosmicdrift/kumiko-bundled-features": "0.351.0",
79
- "@cosmicdrift/kumiko-dev-server": "0.351.0",
80
- "@cosmicdrift/kumiko-framework": "0.351.0",
78
+ "@cosmicdrift/kumiko-bundled-features": "0.353.0",
79
+ "@cosmicdrift/kumiko-dev-server": "0.353.0",
80
+ "@cosmicdrift/kumiko-framework": "0.353.0",
81
81
  "zod": "^4.4.3"
82
82
  },
83
83
  "peerDependencies": {
package/src/changes.json CHANGED
@@ -1,4 +1,10 @@
1
1
  [
2
+ {
3
+ "version": "0.353.0",
4
+ "type": "fix",
5
+ "title": "E2E webServer infra defaults no longer override keys defined in the app's .env",
6
+ "detail": "E2E webServer infra defaults no longer override keys defined in the app's `.env`; precedence is shell environment, then `.env`, then the template default"
7
+ },
2
8
  {
3
9
  "version": "0.351.0",
4
10
  "type": "improvement",
@@ -1,5 +1,8 @@
1
1
  import { randomUUID } from "node:crypto";
2
+ import { existsSync, readFileSync } from "node:fs";
2
3
  import { availableParallelism } from "node:os";
4
+ import { join } from "node:path";
5
+ import { parseEnv } from "node:util";
3
6
  import { isRealProviderRun } from "@cosmicdrift/kumiko-framework/testing/real-providers";
4
7
  import {
5
8
  defineConfig,
@@ -32,16 +35,25 @@ const OPT_IN_SERVICE_ENV_KEYS: readonly string[] = [
32
35
  "MEILI_MASTER_KEY",
33
36
  ] satisfies readonly (keyof typeof SERVICE_ENV_DEFAULTS)[];
34
37
 
35
- // A `??` merge per key, not a raw process.env spread — CI or the shell
36
- // environment wins over the local-dev default without leaking unrelated
37
- // host env vars into the webServer process.
38
+ // Bun never overrides a variable that is already set, so a default placed in
39
+ // webServer.env would beat the same key in the app's `.env`. Keys the app's
40
+ // `.env` defines are therefore left out and stay with the server's own loading.
41
+ function keysDefinedInAppDotenv(): ReadonlySet<string> {
42
+ const dotenvPath = join(process.cwd(), ".env");
43
+ if (!existsSync(dotenvPath)) return new Set();
44
+ return new Set(Object.keys(parseEnv(readFileSync(dotenvPath, "utf-8"))));
45
+ }
46
+
47
+ // Precedence per key: shell/CI environment, then the app's `.env`, then the local-dev default.
38
48
  function infraEnvDefaults(): Record<string, string> {
49
+ const definedInAppDotenv = keysDefinedInAppDotenv();
39
50
  return Object.fromEntries(
40
51
  Object.entries(SERVICE_ENV_DEFAULTS).flatMap(([key, value]) => {
41
52
  const fromEnvironment = process.env[key];
42
53
  if (OPT_IN_SERVICE_ENV_KEYS.includes(key)) {
43
54
  return fromEnvironment === undefined ? [] : [[key, fromEnvironment]];
44
55
  }
56
+ if (fromEnvironment === undefined && definedInAppDotenv.has(key)) return [];
45
57
  return [[key, fromEnvironment ?? value]];
46
58
  }),
47
59
  );
@@ -714,6 +714,10 @@ async function growViewportToContent(page: Page, name: string, width: number): P
714
714
  // spec (solon's `shot(page, id)`, offlot's inline docs/screenshots/e2e/* writes) —
715
715
  // reuses the runner's settle logic and reduced-motion default, and is a no-op
716
716
  // when SCREENSHOT_DIR is unset so a plain e2e run never writes into the repo.
717
+ // Limitation: the in-flight tracker attaches on the first call per page, so data
718
+ // requests already running at that moment are invisible to it. Right after a
719
+ // click, `await expect(...)` the loaded state (or call this once earlier on the
720
+ // page) before the first shot.
717
721
  export async function captureScreenshot(
718
722
  page: Page,
719
723
  name: string,