signalk-container 1.10.0 → 1.10.1

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/AGENTS.md +9 -4
  2. package/package.json +5 -2
package/AGENTS.md CHANGED
@@ -35,11 +35,16 @@ Do not add error handling, fallbacks, or validation for scenarios that cannot ha
35
35
 
36
36
  ### Testing
37
37
 
38
- - Test runner is `node:test`. Tests in `src/test/*.ts`, compiled to `dist/test/*.js`, run via `node --test "dist/test/**/*.test.js"`. The glob **must** be double-quoted so Windows expands it.
38
+ - Test runner is `node:test`. Tests in `src/test/*.ts`, compiled to `dist/test/*.js`. Globs in `package.json` **must** be double-quoted so Windows expands them.
39
+ - Unit tests live directly under `src/test/`. Integration tests that need a real container runtime (image pulls, cgroup probes, etc.) live under `src/test/integration/`. The split keeps `npm test` runnable in restricted sandboxes where outbound network access may be unavailable.
40
+ - Three scripts:
41
+ - `npm test` — unit only (`dist/test/*.test.js`, no recursion). Safe to run anywhere.
42
+ - `npm run test:integration` — integration only (`dist/test/integration/*.test.js`). Requires podman or docker; tests still self-skip on Windows and when no runtime is found.
43
+ - `npm run test:all` — both. The pre-PR full sweep on a dev box.
39
44
  - All new code requires tests. Test behavior at the function boundary, not internal control flow.
40
45
  - Inject `exec: ExecFn = execRuntime` rather than calling the runtime directly. Tests stub via `fakeExec`. See `src/test/getLiveResources.test.ts` for the canonical pattern: synthetic `{stdout, stderr, exitCode}`, no real podman invocations.
41
- - Container-integration tests (those that actually pull `alpine:3.19`) gate on `hasContainerRuntime()` which returns `null` on Windows. Do not add new tests that pull real Linux images without the same guard.
42
- - All tests must pass on every commit. Run `npm test` after `npm run build` (or `npm run build:all` to do both); `node --test` runs the compiled `dist/test/**/*.test.js` glob, so a fresh build is required before testing.
46
+ - Container-integration tests (those that actually pull `alpine:3.19`) live under `src/test/integration/` and gate on `hasContainerRuntime()` which returns `null` on Windows. Do not add new tests that pull real Linux images without putting them under `src/test/integration/` AND gating on the helper.
47
+ - All tests must pass on every commit. Run `npm run build:all:integration` (= `build && test:all`) locally before opening a PR; CI's `npm test` covers the unit half and you cover the integration half.
43
48
 
44
49
  ## Runtime Invariants
45
50
 
@@ -152,7 +157,7 @@ This repo is maintained by Dirk Wahrheit. Workflow is deliberate; AI tools shoul
152
157
  Before pushing or opening a PR:
153
158
 
154
159
  1. `npm run format` — `prettier --write .` + `eslint --fix` (writes back fixes)
155
- 2. `npm run build:all` — `build && test`, where `build` = `clean && build:server (tsc) && build:configpanel (vite build)`. All tests must pass.
160
+ 2. `npm run build:all:integration` — `build && test:all`, where `build` = `clean && build:server (tsc) && build:configpanel (vite build)`. All tests (unit + integration) must pass. CI runs `npm test` (unit only), so the integration coverage is your responsibility before pushing.
156
161
  3. `npm run ci-lint` — `eslint && prettier --check .` — read-only verification of step 1's output; this is what CI runs and what catches uncommitted format/lint drift.
157
162
  4. `cr review --plain | tee /tmp/cr-review-<branch>.txt` — local CodeRabbit pass. `cr` only sees committed changes, so commit first, then review. The CLI is rate-limited (~50min cooldown); pipe to a file so reruns aren't needed.
158
163
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "signalk-container",
3
- "version": "1.10.0",
3
+ "version": "1.10.1",
4
4
  "description": "Shared container runtime management (Podman/Docker) for Signal K plugins",
5
5
  "keywords": [
6
6
  "signalk-node-server-plugin",
@@ -28,8 +28,11 @@
28
28
  "lint": "eslint --fix",
29
29
  "format": "npm run prettier && npm run lint",
30
30
  "ci-lint": "eslint && prettier --check .",
31
- "test": "node --test \"dist/test/**/*.test.js\"",
31
+ "test": "node --test \"dist/test/*.test.js\"",
32
+ "test:integration": "node --test \"dist/test/integration/*.test.js\"",
33
+ "test:all": "node --test \"dist/test/**/*.test.js\"",
32
34
  "build:all": "npm run build && npm test",
35
+ "build:all:integration": "npm run build && npm run test:all",
33
36
  "prepublishOnly": "npm run build"
34
37
  },
35
38
  "engines": {