@zerotal/testing 1.7.0 → 1.7.3

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.
Files changed (2) hide show
  1. package/package.json +6 -6
  2. package/src/TestApp.ts +15 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zerotal/testing",
3
- "version": "1.7.0",
3
+ "version": "1.7.3",
4
4
  "license": "MIT",
5
5
  "maturity": "stable",
6
6
  "private": false,
@@ -32,14 +32,14 @@
32
32
  "typecheck": "tsc --noEmit"
33
33
  },
34
34
  "dependencies": {
35
- "@zerotal/core": "1.7.0",
36
- "@zerotal/orm": "1.7.0",
37
- "@zerotal/queue": "1.7.0",
38
- "@zerotal/notifications": "1.7.0"
35
+ "@zerotal/core": "1.7.3",
36
+ "@zerotal/orm": "1.7.3",
37
+ "@zerotal/queue": "1.7.3",
38
+ "@zerotal/notifications": "1.7.3"
39
39
  },
40
40
  "devDependencies": {
41
41
  "typescript": "^5.8.0",
42
- "@zerotal/session": "1.7.0"
42
+ "@zerotal/session": "1.7.3"
43
43
  },
44
44
  "description": "Testing utilities for Zerotal — an in-process test app, HTTP helpers, and database refresh.",
45
45
  "keywords": [
package/src/TestApp.ts CHANGED
@@ -603,6 +603,21 @@ export async function createTestApp(
603
603
  // here, the fresh one after its own reset. Adopting before the reset is what is
604
604
  // unsafe: it hands back an app whose scope has just been torn down, and the first
605
605
  // facade to touch it throws E_FACADE_BEFORE_BOOT.
606
+ // Declare the runtime mode before anything boots.
607
+ //
608
+ // The suite runs under `zt test`, which is a console command, so `APP_TYPE`
609
+ // arrives as "console". Providers scoped to the test runtime are then filtered
610
+ // out before a single request is made — `SessionProvider` is `["web", "test"]`,
611
+ // so a test app had no session at all: flashed validation errors were
612
+ // unreadable and `assertInvalid()` reported "the response had none", blaming
613
+ // the app for a binding the harness had excluded. `actingAs()` failed for the
614
+ // same reason.
615
+ //
616
+ // Set rather than defaulted: calling `createTestApp` *is* the declaration that
617
+ // this process is a test, and the value it would otherwise inherit is the one
618
+ // that breaks it.
619
+ Bun.env["APP_TYPE"] = "test";
620
+
606
621
  if (!setup && _sharedApps.size > 0) {
607
622
  resetTestState();
608
623
  const booted = await bootstrap();