@owlmeans/test-integration 0.1.18-rc.31 → 0.1.18-rc.33

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 (53) hide show
  1. package/README.md +3 -3
  2. package/agent-meta/manifest.json +2 -2
  3. package/agent-meta/skills/testing-integration/SKILL.md +23 -23
  4. package/build/cleanup/types.d.ts +20 -0
  5. package/build/cleanup/types.d.ts.map +1 -0
  6. package/build/cleanup/types.js +2 -0
  7. package/build/cleanup/types.js.map +1 -0
  8. package/build/cleanup.d.ts +5 -13
  9. package/build/cleanup.d.ts.map +1 -1
  10. package/build/cleanup.js +23 -25
  11. package/build/cleanup.js.map +1 -1
  12. package/build/consts.local.d.ts +6 -0
  13. package/build/consts.local.d.ts.map +1 -0
  14. package/build/consts.local.js +28 -0
  15. package/build/consts.local.js.map +1 -0
  16. package/build/gates/types.d.ts +18 -0
  17. package/build/gates/types.d.ts.map +1 -0
  18. package/build/gates/types.js +2 -0
  19. package/build/gates/types.js.map +1 -0
  20. package/build/gates.d.ts +8 -40
  21. package/build/gates.d.ts.map +1 -1
  22. package/build/gates.js +39 -27
  23. package/build/gates.js.map +1 -1
  24. package/build/index.d.ts +3 -0
  25. package/build/index.d.ts.map +1 -1
  26. package/build/index.js.map +1 -1
  27. package/build/reachability/types.d.ts +27 -0
  28. package/build/reachability/types.d.ts.map +1 -0
  29. package/build/reachability/types.js +2 -0
  30. package/build/reachability/types.js.map +1 -0
  31. package/build/reachability.d.ts +3 -32
  32. package/build/reachability.d.ts.map +1 -1
  33. package/build/reachability.js +69 -97
  34. package/build/reachability.js.map +1 -1
  35. package/build/types.d.ts +43 -0
  36. package/build/types.d.ts.map +1 -0
  37. package/build/types.js +2 -0
  38. package/build/types.js.map +1 -0
  39. package/build/types.local.d.ts +12 -0
  40. package/build/types.local.d.ts.map +1 -0
  41. package/build/types.local.js +2 -0
  42. package/build/types.local.js.map +1 -0
  43. package/package.json +4 -4
  44. package/src/cleanup/types.ts +18 -0
  45. package/src/cleanup.ts +25 -24
  46. package/src/consts.local.ts +29 -0
  47. package/src/gates/types.ts +18 -0
  48. package/src/gates.ts +54 -90
  49. package/src/index.ts +3 -0
  50. package/src/reachability/types.ts +27 -0
  51. package/src/reachability.ts +66 -107
  52. package/src/types.local.ts +11 -0
  53. package/src/types.ts +49 -0
package/README.md CHANGED
@@ -4,10 +4,10 @@ Env-gated harness for integration tests of packages that talk to external servic
4
4
 
5
5
  Helpers exported here:
6
6
 
7
- - `mongoGate()`, `redisGate()`, `postgresGate()`, `s3Gate()`, `kubeGate()`, `smtpGate()` — read the env keys documented in `.env.example` and return `{ skip, reason?, env }`. A `tests/context.ts` uses these to decide whether to register the corresponding service in the real test context.
7
+ - `gateHelper.mongoGate()`, `.redisGate()`, `.postgresGate()`, `.s3Gate()`, `.kubeGate()`, `.smtpGate()` — read the env keys documented in `.env.example` and return `{ skip, reason?, env }`. A `tests/context.ts` uses these to decide whether to register the corresponding service in the real test context.
8
8
  - The three datastore gates (`mongoGate`, `redisGate`, `postgresGate`) also require a host in the connection string to accept a TCP connect. A set variable pointing at nothing — a port-forward that is not running — closes the gate with a printed reason naming the variable and `host:port`, instead of failing the suite on a refused connection. The probe is synchronous, so gates keep being read at module scope.
9
9
  - `randomNamespace(prefix)` — short random suffix to keep DB names, key prefixes, and S3 prefixes unique per test run so suites can safely run in parallel.
10
- - `registerCleanup(fn)` + `runCleanups()` — opt-in `afterAll` cleanup queue.
10
+ - `cleanupHelper.registerCleanup(fn)` + `cleanupHelper.runCleanups()` — opt-in `afterAll` cleanup queue.
11
11
 
12
12
  Specs do not call services through these helpers — they consume the per-package real test context built in `tests/context.ts` and only check `gates.<svc>.skip` to self-skip when the dependency is missing. See `testing-integration` skill for the full pattern.
13
13
 
@@ -19,7 +19,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
19
19
  your project's skill store (`.agents/skills/`):
20
20
 
21
21
  ```sh
22
- npx @owlmeans/agent-skills@^0.1.18-rc.47
22
+ npx @owlmeans/agent-skills@^0.1.18-rc.49
23
23
  ```
24
24
 
25
25
  The embedded files are version-matched to this package release. Do not edit them
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 2,
3
3
  "package": "@owlmeans/test-integration",
4
- "version": "0.1.18-rc.31",
5
- "generatedAt": "2026-10-03T20:05:07.591Z",
4
+ "version": "0.1.18-rc.33",
5
+ "generatedAt": "2026-10-05T21:03:06.387Z",
6
6
  "canonicalRepo": "https://github.com/owlmeans/common",
7
7
  "entries": [
8
8
  {
@@ -6,7 +6,7 @@ description: Category-C integration tests for OwlMeans Common packages that talk
6
6
 
7
7
  # Integration Tests — Category C
8
8
 
9
- **Install:** `"@owlmeans/test-integration": "^0.1.18-rc.31"` in `devDependencies`
9
+ **Install:** `"@owlmeans/test-integration": "^0.1.18-rc.33"` in `devDependencies`
10
10
 
11
11
  Category C applies to packages that integrate with external services: `postgres`,
12
12
  `postgres-resource`, `mongo`, `mongo-resource`, `redis`, `redis-resource`, `redis-queue`,
@@ -25,29 +25,29 @@ service hands it is category C even when it names no driver of its own.
25
25
 
26
26
  | Helper | Purpose |
27
27
  |---|---|
28
- | `postgresGate()`, `mongoGate()`, `redisGate()`, `s3Gate()`, `kubeGate()`, `smtpGate()` | Read env (and, for the three datastores, probe the address — below), return `IntegrationGate<E>` = `{ skip, reason?, env }`. |
28
+ | `gateHelper` — `.postgresGate()`, `.mongoGate()`, `.redisGate()`, `.s3Gate()`, `.kubeGate()`, `.smtpGate()` | Read env (and, for the three datastores, probe the address — below), return `IntegrationGate<E>` = `{ skip, reason?, env }`. |
29
29
  | `IntegrationGate<E>` | `{ skip: boolean, reason?: string, env: Partial<E> }`. `env` holds only the variables that were actually populated. `skip` is a plain `boolean`, not a discriminant, so `env` stays `Partial<E>` on the open branch too — a suite reads a required variable through a cast: `gate.env.MONGO_URL as string`. |
30
30
  | `PostgresEnv`, `MongoEnv`, `RedisEnv`, `S3Env`, `KubeEnv`, `SmtpEnv` | The variable set each gate reads, so `tests/context.ts` types its exported gate. |
31
31
  | `randomNamespace(prefix, len?)` | Schema / DB / key / object-prefix namespacing for parallel-safe runs. Default 6 hex chars. |
32
- | `registerCleanup(fn)` + `runCleanups()` | Process-global LIFO queue. Only where **one** spec file of the package provisions anything — see below. |
32
+ | `cleanupHelper.registerCleanup(fn)` + `.runCleanups()` | Process-global LIFO queue. Only where **one** spec file of the package provisions anything — see below. |
33
33
 
34
34
  Each gate fails closed on its **required** variables and treats the rest as optional:
35
35
 
36
36
  | Gate | Required | Optional |
37
37
  |---|---|---|
38
- | `mongoGate()` | `MONGO_URL` | `MONGO_TEST_DB_PREFIX` |
39
- | `postgresGate()` | `POSTGRES_URL` | `POSTGRES_TEST_DB_PREFIX` |
40
- | `redisGate()` | `REDIS_URL` | `REDIS_TEST_KEY_PREFIX` |
41
- | `s3Gate()` | `S3_ENDPOINT`, `S3_KEY`, `S3_SECRET`, `S3_TEST_BUCKET` | `S3_REGION` |
42
- | `kubeGate()` | `KUBE_CONFIG`, `KUBE_TEST_OK` | — |
43
- | `smtpGate()` | `SMTP_HOST`, `SMTP_USER`, `SMTP_PASSWORD`, `SMTP_FROM`, `SMTP_TEST_TO` | `SMTP_PORT`, `SMTP_SECURE` |
38
+ | `gateHelper.mongoGate()` | `MONGO_URL` | `MONGO_TEST_DB_PREFIX` |
39
+ | `gateHelper.postgresGate()` | `POSTGRES_URL` | `POSTGRES_TEST_DB_PREFIX` |
40
+ | `gateHelper.redisGate()` | `REDIS_URL` | `REDIS_TEST_KEY_PREFIX` |
41
+ | `gateHelper.s3Gate()` | `S3_ENDPOINT`, `S3_KEY`, `S3_SECRET`, `S3_TEST_BUCKET` | `S3_REGION` |
42
+ | `gateHelper.kubeGate()` | `KUBE_CONFIG`, `KUBE_TEST_OK` | — |
43
+ | `gateHelper.smtpGate()` | `SMTP_HOST`, `SMTP_USER`, `SMTP_PASSWORD`, `SMTP_FROM`, `SMTP_TEST_TO` | `SMTP_PORT`, `SMTP_SECURE` |
44
44
 
45
45
  `SMTP_TEST_TO` is required rather than optional because an open SMTP gate sends **real mail** — the
46
46
  suite must never guess a recipient.
47
47
 
48
48
  ### A datastore gate also asks whether the server answers
49
49
 
50
- `mongoGate()`, `redisGate()` and `postgresGate()` open only when their connection string is set
50
+ `gateHelper.mongoGate()`, `.redisGate()` and `.postgresGate()` open only when their connection string is set
51
51
  **and** one of the hosts in it accepts a TCP connect (default ports 27017 / 6379 / 5432). A local
52
52
  `.env` keeps the port-forward address long after the forward is gone, and a gate that trusted the
53
53
  variable alone left `beforeAll` to spend its whole budget on `ECONNREFUSED` and fail the suite. An
@@ -64,12 +64,12 @@ Bun decides `test` vs `test.skip` synchronously and every consumer reads its gat
64
64
  so no `tests/context.ts` changes to get it. It is TCP only: no driver and no login, so a wrong
65
65
  password still opens the gate and fails in the suite, where it belongs. It answers "reachable" when
66
66
  it cannot tell — an SRV (`mongodb+srv://`) or unix-socket address, a string it cannot parse, a probe
67
- that cannot spawn — which is exactly the behaviour a gate had before it probed. `s3Gate()`,
68
- `kubeGate()` and `smtpGate()` do not probe: they name remote services, not a local forward.
67
+ that cannot spawn — which is exactly the behaviour a gate had before it probed. `gateHelper.s3Gate()`,
68
+ `.kubeGate()` and `.smtpGate()` do not probe: they name remote services, not a local forward.
69
69
 
70
70
  An optional variable is only in `env` when it was actually populated, which is why a suite reads a
71
71
  defaulted one — `POSTGRES_TEST_DB_PREFIX ?? 'omt'` — straight from `process.env` instead: calling
72
- any gate has already run `loadEnv`, so the `.env` values are in `process.env` by then.
72
+ any gate has already run `envHelper.loadEnv`, so the `.env` values are in `process.env` by then.
73
73
 
74
74
  **Six services, six gates — a category-C package outside that set writes its own.** There is no
75
75
  gate for an LLM provider or for the Mailgun HTTP API, and none should be added to
@@ -90,7 +90,7 @@ asserts on the request it builds and the API's reply.
90
90
  ## Env contract
91
91
 
92
92
  One `.env.example` at the workspace root documents every variable, grouped by service, with
93
- comments; the `.env` beside it supplies real values for local runs and `loadEnv` (from
93
+ comments; the `.env` beside it supplies real values for local runs and `envHelper.loadEnv` (from
94
94
  `@owlmeans/test`) picks it up. CI sets the same variables from secrets. **Empty value = skip, and
95
95
  so is a datastore address nothing answers at** — never a failure. A developer's `.env` may keep the
96
96
  port-forward address permanently: with the forward up the suites run, without it they skip.
@@ -143,7 +143,7 @@ A resource package (`*-resource`) owns the `Resource<T>` contract; the db packag
143
143
  translation — live in the **resource** package and gate on nothing: they leave the process
144
144
  alone. `@owlmeans/postgres-resource` is entirely this shape.
145
145
  - **Raw-driver specs** belong there too when the subject is the round trip and not the service.
146
- `@owlmeans/mongo-resource` opens `mongoGate()`, derives a namespaced database with
146
+ `@owlmeans/mongo-resource` opens `gateHelper.mongoGate()`, derives a namespaced database with
147
147
  `randomNamespace`, registers a cleanup that drops it, and drives `mongodb` directly with the
148
148
  driver as its own devDependency — legitimate precisely because it never constructs the db
149
149
  service. It is also the one package that may use the global cleanup queue, because only that
@@ -156,10 +156,10 @@ A resource package (`*-resource`) owns the `Resource<T>` contract; the db packag
156
156
  ## Per-suite namespaces, not the global cleanup queue
157
157
 
158
158
  Bun runs **every spec file of a package in one process** with one shared module registry, and the
159
- queue is one array for that whole process. A process-global `registerCleanup`/`runCleanups()`
159
+ queue is one array for that whole process. A process-global `cleanupHelper.registerCleanup`/`.runCleanups()`
160
160
  therefore misfires as soon as two spec files provision: the first to reach `afterAll` drains the
161
161
  entire queue and drops the namespaces of the files still to come. The queue is safe only where a
162
- **single** spec file provisions anything and that same file calls `runCleanups()`. That is the
162
+ **single** spec file provisions anything and that same file calls `cleanupHelper.runCleanups()`. That is the
163
163
  shape `@owlmeans/mongo-resource` has — one gated round-trip spec registering one dropped database,
164
164
  beside two ungated spec files that translate criteria and references in memory and open nothing.
165
165
 
@@ -168,7 +168,7 @@ own teardown instead:
168
168
 
169
169
  ```ts
170
170
  // tests/context.ts
171
- export const gate: IntegrationGate<PostgresEnv> = postgresGate()
171
+ export const gate: IntegrationGate<PostgresEnv> = gateHelper.postgresGate()
172
172
 
173
173
  export const makeSuite = (label: string): PgSuite => {
174
174
  const prefix = process.env.POSTGRES_TEST_DB_PREFIX ?? 'omt'
@@ -228,7 +228,7 @@ maker that runs more than once for the same alias re-declares the same entries a
228
228
  A `boot()` builds a whole new context, but the declarations belong to the module registry rather
229
229
  than to any context, so they carry across every boot in the process — deliberately.
230
230
  Never reset them inside a shared `boot()` helper: a `.migration()` registered before the boot
231
- would be silently dropped. A spec that wants a clean slate calls `resetDeclarations(alias)`
231
+ would be silently dropped. A spec that wants a clean slate calls `pgDeclarationHelper.resetDeclarations(alias)` (or `mongoDeclarationHelper`'s)
232
232
  itself, which is what a spec simulating a restarted process should have to say out loud.
233
233
 
234
234
  Migration bodies belong at **module scope**, not inside the spec callback: the checksum
@@ -275,11 +275,11 @@ devDependencies.
275
275
 
276
276
  **Nothing auto-loads the workspace `.env`.** Bun reads a `.env` beside the working directory, so
277
277
  `bun test` inside a package never sees the one at the workspace root. The gates work because
278
- `@owlmeans/test`'s `loadEnv` does the loading itself and every gate calls it before reading a
278
+ `@owlmeans/test`'s `envHelper.loadEnv` does the loading itself and every gate calls it before reading a
279
279
  variable: it walks up from the working directory for a `bun.lock`, or for a `package.json`
280
280
  sitting beside a directory named `packages`, and reads the `.env` it finds there. A variable
281
281
  already set to a non-empty value always wins, so `MONGO_URL=… bun test ./tests` still overrides
282
- the file. A workspace shaped any other way names the file itself — `loadEnv({ file })` at the top
282
+ the file. A workspace shaped any other way names the file itself — `envHelper.loadEnv({ file })` at the top
283
283
  of `tests/context.ts`, before the gates run.
284
284
 
285
285
  Bun's per-test timeout is 5s, and **`bunfig.toml`'s `[test] timeout` does not raise it** — bun
@@ -301,7 +301,7 @@ bun test --timeout=60000 ./tests
301
301
  value instead, which also proves the call returned:
302
302
 
303
303
  ```ts
304
- expect(pgErrorToResourceError(circular)).toBe(circular) // not: expect(() => …).not.toThrow()
304
+ expect(pgErrorHelper.pgErrorToResourceError(circular)).toBe(circular) // not: expect(() => …).not.toThrow()
305
305
  ```
306
306
 
307
307
  ## Rules
@@ -320,5 +320,5 @@ expect(pgErrorToResourceError(circular)).toBe(circular) // not: expect(() =>
320
320
  ## When the env is partially populated
321
321
 
322
322
  Each gate fails closed. A test that needs both `S3_KEY` and `S3_SECRET` does not run if only
323
- one is set — `s3Gate()` reports `skip: true`. This is intentional: a half-configured
323
+ one is set — `gateHelper.s3Gate()` reports `skip: true`. This is intentional: a half-configured
324
324
  environment must not produce false positives or partial coverage.
@@ -0,0 +1,20 @@
1
+ export interface CleanupFn {
2
+ (): void | Promise<void>;
3
+ }
4
+ /** The opt-in teardown queue a suite's `tests/context.ts` fills and its `afterAll` drains. */
5
+ export interface CleanupHelper {
6
+ /**
7
+ * Register a cleanup function that {@link CleanupHelper.runCleanups} will execute (LIFO).
8
+ * Use from `tests/context.ts` `setup()` to schedule teardown of resources
9
+ * that were provisioned for the suite (DB drop, key namespace flush,
10
+ * uploaded objects).
11
+ */
12
+ registerCleanup: (fn: CleanupFn) => void;
13
+ /**
14
+ * Run all pending cleanup functions in reverse registration order.
15
+ * Errors are swallowed and logged as warnings so a failing cleanup
16
+ * cannot mask a test failure.
17
+ */
18
+ runCleanups: () => Promise<void>;
19
+ }
20
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/cleanup/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IAAG,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE;AAEvD,8FAA8F;AAC9F,MAAM,WAAW,aAAa;IAC5B;;;;;OAKG;IACH,eAAe,EAAE,CAAC,EAAE,EAAE,SAAS,KAAK,IAAI,CAAA;IACxC;;;;OAIG;IACH,WAAW,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CACjC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/cleanup/types.ts"],"names":[],"mappings":""}
@@ -1,16 +1,8 @@
1
- type CleanupFn = () => void | Promise<void>;
2
- /**
3
- * Register a cleanup function that `runCleanups()` will execute (LIFO).
4
- * Use from `tests/context.ts` `setup()` to schedule teardown of resources
5
- * that were provisioned for the suite (DB drop, key namespace flush,
6
- * uploaded objects).
7
- */
1
+ import type { CleanupFn, CleanupHelper } from './cleanup/types.js';
2
+ export declare const createCleanupHelper: () => CleanupHelper;
3
+ export declare const cleanupHelper: CleanupHelper;
4
+ /** @deprecated compat:factory-refactor — use `cleanupHelper.registerCleanup(…)` */
8
5
  export declare const registerCleanup: (fn: CleanupFn) => void;
9
- /**
10
- * Run all pending cleanup functions in reverse registration order.
11
- * Errors are swallowed and logged as warnings so a failing cleanup
12
- * cannot mask a test failure.
13
- */
6
+ /** @deprecated compat:factory-refactor — use `cleanupHelper.runCleanups()` */
14
7
  export declare const runCleanups: () => Promise<void>;
15
- export {};
16
8
  //# sourceMappingURL=cleanup.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cleanup.d.ts","sourceRoot":"","sources":["../src/cleanup.ts"],"names":[],"mappings":"AAIA,KAAK,SAAS,GAAG,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;AAI3C;;;;;GAKG;AACH,eAAO,MAAM,eAAe,OAAQ,SAAS,KAAG,IAE/C,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW,QAAa,OAAO,CAAC,IAAI,CAUhD,CAAA"}
1
+ {"version":3,"file":"cleanup.d.ts","sourceRoot":"","sources":["../src/cleanup.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAOlE,eAAO,MAAM,mBAAmB,QAAO,aAkBtC,CAAA;AAED,eAAO,MAAM,aAAa,eAAwB,CAAA;AAElD,mFAAmF;AACnF,eAAO,MAAM,eAAe,OAAQ,SAAS,KAAG,IAAyC,CAAA;AAEzF,8EAA8E;AAC9E,eAAO,MAAM,WAAW,QAAa,OAAO,CAAC,IAAI,CAAsC,CAAA"}
package/build/cleanup.js CHANGED
@@ -1,31 +1,29 @@
1
1
  import { logger } from '@owlmeans/log';
2
2
  const log = logger('test-integration');
3
+ // Process-wide on purpose: every spec file of a run registers into, and drains, the same queue.
3
4
  const queue = [];
4
- /**
5
- * Register a cleanup function that `runCleanups()` will execute (LIFO).
6
- * Use from `tests/context.ts` `setup()` to schedule teardown of resources
7
- * that were provisioned for the suite (DB drop, key namespace flush,
8
- * uploaded objects).
9
- */
10
- export const registerCleanup = (fn) => {
11
- queue.push(fn);
12
- };
13
- /**
14
- * Run all pending cleanup functions in reverse registration order.
15
- * Errors are swallowed and logged as warnings so a failing cleanup
16
- * cannot mask a test failure.
17
- */
18
- export const runCleanups = async () => {
19
- while (queue.length > 0) {
20
- const fn = queue.pop();
21
- if (fn == null)
22
- continue;
23
- try {
24
- await fn();
25
- }
26
- catch (err) {
27
- log.warn('Cleanup failed', err);
5
+ export const createCleanupHelper = () => {
6
+ const registerCleanup = (fn) => {
7
+ queue.push(fn);
8
+ };
9
+ const runCleanups = async () => {
10
+ while (queue.length > 0) {
11
+ const fn = queue.pop();
12
+ if (fn == null)
13
+ continue;
14
+ try {
15
+ await fn();
16
+ }
17
+ catch (err) {
18
+ log.warn('Cleanup failed', err);
19
+ }
28
20
  }
29
- }
21
+ };
22
+ return { registerCleanup, runCleanups };
30
23
  };
24
+ export const cleanupHelper = createCleanupHelper();
25
+ /** @deprecated compat:factory-refactor — use `cleanupHelper.registerCleanup(…)` */
26
+ export const registerCleanup = (fn) => cleanupHelper.registerCleanup(fn);
27
+ /** @deprecated compat:factory-refactor — use `cleanupHelper.runCleanups()` */
28
+ export const runCleanups = async () => await cleanupHelper.runCleanups();
31
29
  //# sourceMappingURL=cleanup.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cleanup.js","sourceRoot":"","sources":["../src/cleanup.ts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G,KAAK,CAAC,GAAG,EAAE,CAAA;YACtB,IAAI,EAAE,IAAI,IAAI;gBAAE,SAAQ;YACxB,IAAI,CAAC;gBACH,MAAM,EAAE,EAAE,CAAA;YACZ,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,GAAG,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAA;YACjC,CAAC;QACH,CAAC;IACH,CAAC,CAAA;IAED,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,CAAA;AACzC,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,mBAAmB,EAAE,CAAA;AAElD,mFAAmF;AACnF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAAa,EAAQ,EAAE,CAAC,aAAa,CAAC,eAAe,CAAC,EAAE,CAAC,CAAA;AAEzF,8EAA8E;AAC9E,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,IAAmB,EAAE,CAAC,MAAM,aAAa,CAAC,WAAW,EAAE,CAAA"}
@@ -0,0 +1,6 @@
1
+ /** How long one connect may take before the address counts as unreachable. */
2
+ export declare const CONNECT_TIMEOUT_MS = 1500;
3
+ /** The probe runs in a child process; this covers its own startup on a loaded machine. */
4
+ export declare const SPAWN_GRACE_MS = 5000;
5
+ export declare const PROBE_SCRIPT = "\nconst net = require('net')\nconst [targets, timeout] = JSON.parse(process.env.OWLMEANS_TEST_PROBE)\nlet pending = targets.length\nlet last = ''\nfor (const target of targets) {\n let settled = false\n const socket = net.connect({ host: target.host, port: target.port })\n const fail = code => {\n if (settled) return\n settled = true\n socket.destroy()\n last = code\n if (--pending === 0) { process.stdout.write(last); process.exit(1) }\n }\n socket.setTimeout(timeout)\n socket.once('connect', () => process.exit(0))\n socket.once('timeout', () => fail('ETIMEDOUT'))\n socket.once('error', error => fail(error.code || String(error)))\n}\n";
6
+ //# sourceMappingURL=consts.local.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consts.local.d.ts","sourceRoot":"","sources":["../src/consts.local.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,eAAO,MAAM,kBAAkB,OAAQ,CAAA;AAEvC,0FAA0F;AAC1F,eAAO,MAAM,cAAc,OAAQ,CAAA;AAInC,eAAO,MAAM,YAAY,8pBAoBxB,CAAA"}
@@ -0,0 +1,28 @@
1
+ /** How long one connect may take before the address counts as unreachable. */
2
+ export const CONNECT_TIMEOUT_MS = 1_500;
3
+ /** The probe runs in a child process; this covers its own startup on a loaded machine. */
4
+ export const SPAWN_GRACE_MS = 5_000;
5
+ // Runs under whichever runtime runs the suite (`process.execPath`), so it is plain CommonJS
6
+ // that both `bun -e` and `node -e` evaluate.
7
+ export const PROBE_SCRIPT = `
8
+ const net = require('net')
9
+ const [targets, timeout] = JSON.parse(process.env.OWLMEANS_TEST_PROBE)
10
+ let pending = targets.length
11
+ let last = ''
12
+ for (const target of targets) {
13
+ let settled = false
14
+ const socket = net.connect({ host: target.host, port: target.port })
15
+ const fail = code => {
16
+ if (settled) return
17
+ settled = true
18
+ socket.destroy()
19
+ last = code
20
+ if (--pending === 0) { process.stdout.write(last); process.exit(1) }
21
+ }
22
+ socket.setTimeout(timeout)
23
+ socket.once('connect', () => process.exit(0))
24
+ socket.once('timeout', () => fail('ETIMEDOUT'))
25
+ socket.once('error', error => fail(error.code || String(error)))
26
+ }
27
+ `;
28
+ //# sourceMappingURL=consts.local.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consts.local.js","sourceRoot":"","sources":["../src/consts.local.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAA;AAEvC,0FAA0F;AAC1F,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,CAAA;AAEnC,4FAA4F;AAC5F,6CAA6C;AAC7C,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;CAoB3B,CAAA"}
@@ -0,0 +1,18 @@
1
+ import type { IntegrationGate, KubeEnv, MongoEnv, PostgresEnv, RedisEnv, S3Env, SmtpEnv } from '../types.js';
2
+ /**
3
+ * The env gates of the integration suites: each reads the variables documented in `.env.example`
4
+ * and answers `{ skip, reason?, env }`, so a `tests/context.ts` decides whether to register the
5
+ * real service and a spec self-skips when it is missing.
6
+ */
7
+ export interface GateHelper {
8
+ /** `MONGO_URL` set AND a host in it accepting a TCP connect; `MONGO_TEST_DB_PREFIX` optional. */
9
+ mongoGate: () => IntegrationGate<MongoEnv>;
10
+ /** `REDIS_URL` set AND a host in it accepting a TCP connect; `REDIS_TEST_KEY_PREFIX` optional. */
11
+ redisGate: () => IntegrationGate<RedisEnv>;
12
+ s3Gate: () => IntegrationGate<S3Env>;
13
+ kubeGate: () => IntegrationGate<KubeEnv>;
14
+ /** `POSTGRES_URL` set AND a host in it accepting a TCP connect; `POSTGRES_TEST_DB_PREFIX` optional. */
15
+ postgresGate: () => IntegrationGate<PostgresEnv>;
16
+ smtpGate: () => IntegrationGate<SmtpEnv>;
17
+ }
18
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/gates/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAE5G;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,iGAAiG;IACjG,SAAS,EAAE,MAAM,eAAe,CAAC,QAAQ,CAAC,CAAA;IAC1C,kGAAkG;IAClG,SAAS,EAAE,MAAM,eAAe,CAAC,QAAQ,CAAC,CAAA;IAC1C,MAAM,EAAE,MAAM,eAAe,CAAC,KAAK,CAAC,CAAA;IACpC,QAAQ,EAAE,MAAM,eAAe,CAAC,OAAO,CAAC,CAAA;IACxC,uGAAuG;IACvG,YAAY,EAAE,MAAM,eAAe,CAAC,WAAW,CAAC,CAAA;IAChD,QAAQ,EAAE,MAAM,eAAe,CAAC,OAAO,CAAC,CAAA;CACzC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/gates/types.ts"],"names":[],"mappings":""}
package/build/gates.d.ts CHANGED
@@ -1,45 +1,13 @@
1
- export interface IntegrationGate<E> {
2
- skip: boolean;
3
- reason?: string;
4
- env: Partial<E>;
5
- }
6
- export interface MongoEnv {
7
- MONGO_URL: string;
8
- MONGO_TEST_DB_PREFIX: string;
9
- }
1
+ import type { IntegrationGate, MongoEnv, PostgresEnv, RedisEnv, SmtpEnv } from './types.js';
2
+ import type { GateHelper } from './gates/types.js';
3
+ export declare const createGateHelper: () => GateHelper;
4
+ export declare const gateHelper: GateHelper;
5
+ /** @deprecated compat:factory-refactor — use `gateHelper.mongoGate()` */
10
6
  export declare const mongoGate: () => IntegrationGate<MongoEnv>;
11
- export interface RedisEnv {
12
- REDIS_URL: string;
13
- REDIS_TEST_KEY_PREFIX: string;
14
- }
7
+ /** @deprecated compat:factory-refactor — use `gateHelper.redisGate()` */
15
8
  export declare const redisGate: () => IntegrationGate<RedisEnv>;
16
- export interface S3Env {
17
- S3_ENDPOINT: string;
18
- S3_KEY: string;
19
- S3_SECRET: string;
20
- S3_TEST_BUCKET: string;
21
- S3_REGION: string;
22
- }
23
- export declare const s3Gate: () => IntegrationGate<S3Env>;
24
- export interface KubeEnv {
25
- KUBE_CONFIG: string;
26
- KUBE_TEST_OK: string;
27
- }
28
- export declare const kubeGate: () => IntegrationGate<KubeEnv>;
29
- export interface PostgresEnv {
30
- POSTGRES_URL: string;
31
- POSTGRES_TEST_DB_PREFIX: string;
32
- }
9
+ /** @deprecated compat:factory-refactor — use `gateHelper.postgresGate()` */
33
10
  export declare const postgresGate: () => IntegrationGate<PostgresEnv>;
34
- export interface SmtpEnv {
35
- SMTP_HOST: string;
36
- SMTP_PORT: string;
37
- SMTP_SECURE: string;
38
- SMTP_USER: string;
39
- SMTP_PASSWORD: string;
40
- SMTP_FROM: string;
41
- /** Mailbox the specs deliver to. Required — these tests send real mail. */
42
- SMTP_TEST_TO: string;
43
- }
11
+ /** @deprecated compat:factory-refactor — use `gateHelper.smtpGate()` */
44
12
  export declare const smtpGate: () => IntegrationGate<SmtpEnv>;
45
13
  //# sourceMappingURL=gates.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gates.d.ts","sourceRoot":"","sources":["../src/gates.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,IAAI,EAAE,OAAO,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,CAAA;CAChB;AAqCD,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE,MAAM,CAAA;IACjB,oBAAoB,EAAE,MAAM,CAAA;CAC7B;AAED,eAAO,MAAM,SAAS,QAAO,eAAe,CAAC,QAAQ,CAC2D,CAAA;AAEhH,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE,MAAM,CAAA;IACjB,qBAAqB,EAAE,MAAM,CAAA;CAC9B;AAED,eAAO,MAAM,SAAS,QAAO,eAAe,CAAC,QAAQ,CAC2D,CAAA;AAEhH,MAAM,WAAW,KAAK;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,eAAO,MAAM,MAAM,QAAO,eAAe,CAAC,KAAK,CAI5C,CAAA;AAEH,MAAM,WAAW,OAAO;IACtB,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,eAAO,MAAM,QAAQ,QAAO,eAAe,CAAC,OAAO,CACU,CAAA;AAE7D,MAAM,WAAW,WAAW;IAC1B,YAAY,EAAE,MAAM,CAAA;IACpB,uBAAuB,EAAE,MAAM,CAAA;CAChC;AAED,eAAO,MAAM,YAAY,QAAO,eAAe,CAAC,WAAW,CACgE,CAAA;AAE3H,MAAM,WAAW,OAAO;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;IACjB,2EAA2E;IAC3E,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,eAAO,MAAM,QAAQ,QAAO,eAAe,CAAC,OAAO,CAIhD,CAAA"}
1
+ {"version":3,"file":"gates.d.ts","sourceRoot":"","sources":["../src/gates.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAW,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAS,OAAO,EAAE,MAAM,YAAY,CAAA;AAC3G,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,eAAO,MAAM,gBAAgB,QAAO,UAiDnC,CAAA;AAED,eAAO,MAAM,UAAU,YAAqB,CAAA;AAE5C,yEAAyE;AACzE,eAAO,MAAM,SAAS,QAAO,eAAe,CAAC,QAAQ,CAA2B,CAAA;AAEhF,yEAAyE;AACzE,eAAO,MAAM,SAAS,QAAO,eAAe,CAAC,QAAQ,CAA2B,CAAA;AAEhF,4EAA4E;AAC5E,eAAO,MAAM,YAAY,QAAO,eAAe,CAAC,WAAW,CAA8B,CAAA;AAEzF,wEAAwE;AACxE,eAAO,MAAM,QAAQ,QAAO,eAAe,CAAC,OAAO,CAA0B,CAAA"}
package/build/gates.js CHANGED
@@ -1,29 +1,41 @@
1
- import { hasEnv, requireEnv } from '@owlmeans/test';
2
- import { unreachableReason } from './reachability.js';
3
- const collect = (keys) => {
4
- const env = {};
5
- for (const k of keys) {
6
- if (hasEnv(k))
7
- env[k] = process.env[k];
8
- }
9
- return env;
1
+ import { envHelper } from '@owlmeans/test';
2
+ import { reachabilityUtils } from './reachability.js';
3
+ export const createGateHelper = () => {
4
+ const collect = (keys) => {
5
+ const env = {};
6
+ for (const k of keys) {
7
+ if (envHelper.hasEnv(k))
8
+ env[k] = process.env[k];
9
+ }
10
+ return env;
11
+ };
12
+ const toIntegrationGate = (required, optional = [], reachable) => {
13
+ const gate = envHelper.requireEnv(required);
14
+ const env = collect([...required, ...optional]);
15
+ if (!('ok' in gate))
16
+ return { skip: true, reason: gate.reason, env };
17
+ if (reachable != null) {
18
+ const reason = reachabilityUtils.unreachableReason(reachable.key, process.env[reachable.key], reachable.defaultPort);
19
+ if (reason != null)
20
+ return { skip: true, reason, env };
21
+ }
22
+ return { skip: false, env };
23
+ };
24
+ const mongoGate = () => toIntegrationGate(['MONGO_URL'], ['MONGO_TEST_DB_PREFIX'], { key: 'MONGO_URL', defaultPort: 27017 });
25
+ const redisGate = () => toIntegrationGate(['REDIS_URL'], ['REDIS_TEST_KEY_PREFIX'], { key: 'REDIS_URL', defaultPort: 6379 });
26
+ const s3Gate = () => toIntegrationGate(['S3_ENDPOINT', 'S3_KEY', 'S3_SECRET', 'S3_TEST_BUCKET'], ['S3_REGION']);
27
+ const kubeGate = () => toIntegrationGate(['KUBE_CONFIG', 'KUBE_TEST_OK']);
28
+ const postgresGate = () => toIntegrationGate(['POSTGRES_URL'], ['POSTGRES_TEST_DB_PREFIX'], { key: 'POSTGRES_URL', defaultPort: 5432 });
29
+ const smtpGate = () => toIntegrationGate(['SMTP_HOST', 'SMTP_USER', 'SMTP_PASSWORD', 'SMTP_FROM', 'SMTP_TEST_TO'], ['SMTP_PORT', 'SMTP_SECURE']);
30
+ return { mongoGate, redisGate, s3Gate, kubeGate, postgresGate, smtpGate };
10
31
  };
11
- const toIntegrationGate = (required, optional = [], reachable) => {
12
- const gate = requireEnv(required);
13
- const env = collect([...required, ...optional]);
14
- if (!('ok' in gate))
15
- return { skip: true, reason: gate.reason, env };
16
- if (reachable != null) {
17
- const reason = unreachableReason(reachable.key, process.env[reachable.key], reachable.defaultPort);
18
- if (reason != null)
19
- return { skip: true, reason, env };
20
- }
21
- return { skip: false, env };
22
- };
23
- export const mongoGate = () => toIntegrationGate(['MONGO_URL'], ['MONGO_TEST_DB_PREFIX'], { key: 'MONGO_URL', defaultPort: 27017 });
24
- export const redisGate = () => toIntegrationGate(['REDIS_URL'], ['REDIS_TEST_KEY_PREFIX'], { key: 'REDIS_URL', defaultPort: 6379 });
25
- export const s3Gate = () => toIntegrationGate(['S3_ENDPOINT', 'S3_KEY', 'S3_SECRET', 'S3_TEST_BUCKET'], ['S3_REGION']);
26
- export const kubeGate = () => toIntegrationGate(['KUBE_CONFIG', 'KUBE_TEST_OK']);
27
- export const postgresGate = () => toIntegrationGate(['POSTGRES_URL'], ['POSTGRES_TEST_DB_PREFIX'], { key: 'POSTGRES_URL', defaultPort: 5432 });
28
- export const smtpGate = () => toIntegrationGate(['SMTP_HOST', 'SMTP_USER', 'SMTP_PASSWORD', 'SMTP_FROM', 'SMTP_TEST_TO'], ['SMTP_PORT', 'SMTP_SECURE']);
32
+ export const gateHelper = createGateHelper();
33
+ /** @deprecated compat:factory-refactor — use `gateHelper.mongoGate()` */
34
+ export const mongoGate = () => gateHelper.mongoGate();
35
+ /** @deprecated compat:factory-refactor — use `gateHelper.redisGate()` */
36
+ export const redisGate = () => gateHelper.redisGate();
37
+ /** @deprecated compat:factory-refactor — use `gateHelper.postgresGate()` */
38
+ export const postgresGate = () => gateHelper.postgresGate();
39
+ /** @deprecated compat:factory-refactor — use `gateHelper.smtpGate()` */
40
+ export const smtpGate = () => gateHelper.smtpGate();
29
41
  //# sourceMappingURL=gates.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"gates.js","sourceRoot":"","sources":["../src/gates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,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ACxE,MAAM,CAAC,MAAM,QAAQ,GAAG,GAA6B,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAA"}
package/build/index.d.ts CHANGED
@@ -1,4 +1,7 @@
1
1
  export * from './gates.js';
2
+ export type * from './gates/types.js';
3
+ export type * from './types.js';
2
4
  export * from './naming.js';
3
5
  export * from './cleanup.js';
6
+ export type * from './cleanup/types.js';
4
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,mBAAmB,kBAAkB,CAAA;AACrC,mBAAmB,YAAY,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,mBAAmB,oBAAoB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAG1B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA"}
@@ -0,0 +1,27 @@
1
+ import type { ProbeTarget } from '../types.js';
2
+ /**
3
+ * Whether the server a connection string names answers at all — asked synchronously, because
4
+ * Bun decides `test` vs `test.skip` synchronously and every gate is read at module scope.
5
+ */
6
+ export interface ReachabilityUtils {
7
+ /**
8
+ * Every `host:port` in the authority of a connection string, or `null` when the string names
9
+ * nothing a TCP connect can check — an SRV record, a unix socket, or a shape this cannot read.
10
+ * `null` leaves the gate exactly as the variable alone would have it.
11
+ */
12
+ parseTargets: (url: string, defaultPort: number) => ProbeTarget[] | null;
13
+ /**
14
+ * `null` when at least one target accepts a TCP connection, otherwise the reason none did.
15
+ *
16
+ * A probe that cannot run at all also answers `null`: not knowing is not evidence the service is
17
+ * down, and the suite then behaves exactly as it did before probes existed.
18
+ */
19
+ probeTargets: (targets: ProbeTarget[]) => string | null;
20
+ /**
21
+ * The skip reason for a populated connection-string variable whose server does not answer, or
22
+ * `null` when it answers or cannot be probed. Printed once per variable and address, so a closed
23
+ * gate is never mistaken for a suite that has nothing to run.
24
+ */
25
+ unreachableReason: (variable: string, url: string, defaultPort: number) => string | null;
26
+ }
27
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/reachability/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,YAAY,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,WAAW,EAAE,GAAG,IAAI,CAAA;IACxE;;;;;OAKG;IACH,YAAY,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,MAAM,GAAG,IAAI,CAAA;IACvD;;;;OAIG;IACH,iBAAiB,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAA;CACzF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/reachability/types.ts"],"names":[],"mappings":""}