@ai-ecoverse/slicc-shared-web 2.13.1 → 2.13.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.
- package/README.md +2 -2
- package/package.json +12 -4
package/README.md
CHANGED
|
@@ -73,7 +73,7 @@ The caller cancels superseded runs on pull requests only, so a push to `main` ne
|
|
|
73
73
|
|
|
74
74
|
**Deploy** runs on pull requests only, never in the merge queue, with `id-token: write` for an OIDC-authenticated deploy. The merge queue's tests therefore run without `STAGING_URL`: a test that needs it skips when it's empty. It runs the pull request's own code, so it gets no secret unless `deploy-secrets` names it: a newline- or space-separated list of secret names, which the step exports as environment variables. The pipeline's own `AWS_BEARER_TOKEN_BEDROCK`, `SLICC_ISSUES_TOKEN`, `CLOUDFLARE_API_TOKEN` and `github_token` are never exported. The command writes `url=<staging URL>` to `$GITHUB_OUTPUT`; the tests and the reviewers get it as `STAGING_URL`.
|
|
75
75
|
|
|
76
|
-
**Integration tests** install Chrome for Testing with `slicc-cdp install-browser` (with `--with-deps` where the runner has root or passwordless sudo) (`--version` from the `chrome` input, stable without it), then each runs its share of the files matching `test-glob`. `lint` plans the split once for all `shards`, so the shards can't disagree: it weighs each file by the most it took in the last
|
|
76
|
+
**Integration tests** install Chrome for Testing with `slicc-cdp install-browser` (with `--with-deps` where the runner has root or passwordless sudo) (`--version` from the `chrome` input, stable without it), then each runs its share of the files matching `test-glob`. `lint` plans the split once for all `shards`, so the shards can't disagree: it weighs each file by the most it took in the last ten completed runs of the same workflow that uploaded `timings` (merge queue runs first, then pull request runs, none from a fork), since a file that downloads a lot can take several times its median when the network is slow. Files whose most is over twice their median go first, longest first, each to the shard with the fewest of them (then the least time), so the files that are slow together in a slow run don't pile up on one shard; then every other file goes to the shard with the least time so far, longest first; a file without a timing counts as the average, and without any timings every file counts the same. `integration` uploads each run's `junit/**/*.times` and `junit/**/*.xml` as one `timings` artifact, so `lint` downloads one artifact per earlier run through the REST API with the job token (about a dozen requests a run, of the repo's 1,000 an hour); until a run has one, it reads the `junit-*` artifacts of the newest run that has them. Its log names the predicted seconds of each shard, how many files had timings, from which runs, and which files took over twice their median. A file's time is its own wall time where `shard.cjs` recorded one: it preloads `harness/file-time.cjs` into each test file's own process, which writes the file's wall time to `junit/<shard>-<pid>.times` when it exits, so tests registered through a shared helper still count for the file that ran them. Otherwise it is the sum of the JUnit times of the tests that name the file, and Node names the file that calls `test()`. Each shard runs the repo's own `test` command unchanged: `harness/shard.cjs`, preloaded through `NODE_OPTIONS`, makes the outermost `node --test` run only the shard's files that its own patterns match, writes `junit/<shard>.xml` next to the usual spec output, and then takes itself out of the environment, so a `node --test` that a test starts runs as it would without it. Files a `node --test` call would run that are not in `test-glob` (unit tests, say, whether in the same call or another) run on shard 0 only, so nothing is dropped; when `test-glob` matches nothing, shard 0 runs the command unchanged and the others run nothing. Each call keeps its own JUnit report (`junit/<shard>-<pid>.xml` for all but the last). Each shard uploads `coverage/`, `artifacts/` and `junit/` as `integration-<shard>`. Before its tests, each shard restores the harness's download cache, `node_modules/.cache/slicc-harness/cdn` (after `npm ci`, which would remove it), from the newest cache whose key starts with `slicc-harness-cdn-<OS>-<hash of every package-lock.json and pnpm-lock.yaml>`, else `slicc-harness-cdn-<OS>-`, so a lockfile change still starts warm. The harness's `download()` lists each npm tarball and exact-version jsdelivr file it served in the file `SLICC_TEST_DOWNLOADS` names, which the shard sets to `junit/<shard>.downloads` (an older `@ai-ecoverse/slicc-shared-web` lists nothing, so its cache stays empty). Shards only restore: a cache saved on a pull request or in the merge queue would be scoped to that ref, so no later run could use it. On a push to `main`, `downloads` reads those lists from the newest successful merge queue run (else pull request run, never a fork's), restores the cache, fetches what's missing (only tarballs from `registry.npmjs.org` and exact-version files from `cdn.jsdelivr.net`), deletes what no shard listed, and saves it under the key plus a hash of the list, only when the list changed. The cache never holds packuments, attestations or other files that can change, so a restored cache can't serve stale metadata; those are fetched fresh as before. `integration` passes only when every shard did and their JUnit reports add up to at least one test that ran, not skipped, and no failure or error (the placeholder an empty shard runs doesn't count), and every file matching `test-glob` was handed to `node --test` on exactly one shard (`shard.cjs` lists the files it hands over next to its JUnit report, as `junit/<shard>-<pid>.files`, since a test registered through a helper is attributed to the helper); a file that ran on no shard or on two is named as an error, and it prints `integration: PASS <n> tests (<k> skipped) in <m> JUnit reports, <f> of <f> test-glob files on exactly one shard` or `integration: FAIL <why>`; a repo without node tests sets `require-tests: false`. Setting `NODE_OPTIONS` in `test` would replace the pipeline's own, which carry the shard preload and the JUnit reporter, so extra node flags (a bigger heap, say) go in `node-options`. `integration` is therefore the one check to require for the tests, under the caller's job name (`ci / integration`). A suite whose last step reads every test's artifacts, as this repo's `verify.mjs` does, sets `shards: 1`.
|
|
77
77
|
|
|
78
78
|
**Windows.** With `windows-test` set, a `windows` job runs after lint on pull requests and in the merge queue, on GitHub-hosted `windows-latest`: checkout, setup-node at `node-version`, `npm ci`, then `windows-test` as a PowerShell 7 (`pwsh`) command, raw like the other commands, so a package script is `npm run test:windows`; a program that exits non-zero stops it, as `bash -e` would. Its token can only read and it gets no secrets. `integration` fails unless it passed, so `ci / integration` covers it and no other check needs requiring; without the input it is skipped, costs no Windows minutes, and `integration` doesn't wait for it. This repo's own CI runs it with `node -e "process.platform==='win32'||process.exit(1)"` only on a pull request labelled `windows` (the label counts from the next push).
|
|
79
79
|
|
|
@@ -272,7 +272,7 @@ and the PR commits the `.githooks/` directory that the first `npm install` write
|
|
|
272
272
|
|
|
273
273
|
The diff-coverage hook, `slicc-unit-cover`, runs only the unit tests that cover the staged change, then `slicc-diff-cover` on their `coverage/unit/lcov.info`, so every staged line in `src/` still has to run:
|
|
274
274
|
|
|
275
|
-
- **Which directories are source:** `src/` by default, anywhere in the path, as before. A repo whose code lives elsewhere lists its directories in `package.json`: `"slicc": { "unitSources": ["extension", "six", "scripts"] }`, repo-relative, without `.` or `..` segments. `mcr.config.mjs` then collects coverage only from those directories, and the hook treats a staged file outside them as no code. A malformed list fails the hook.
|
|
275
|
+
- **Which directories are source:** `src/` by default, anywhere in the path, as before. A repo whose code lives elsewhere lists its directories in `package.json`: `"slicc": { "unitSources": ["extension", "six", "scripts"] }`, repo-relative, without `.` or `..` segments. `mcr.config.mjs` then collects coverage only from those directories, and the hook treats a staged file outside them as no code. A malformed list fails the hook. This repo lists its own `bin`, `harness`, `testing` and `unit`, and its `test:unit` uses the root `mcr.config.mjs`.
|
|
276
276
|
- **What counts as changed:** the staged files (`git diff --cached --name-only`), and nothing else. `test/unit/` is gitignored, and repos that keep their unit tests in a store outside git sync the whole store into it before a commit, which brings in tests for code that is on other branches; so a unit test that is new or edited runs only when its imports reach a staged file, like any other. One that reaches nothing staged adds no coverage to the staged lines.
|
|
277
277
|
- **Committing a merge, cherry-pick or rebase:** while `MERGE_HEAD` or `CHERRY_PICK_HEAD` exists, or a rebase is running and has stopped at `REBASE_HEAD`, only lines that are new against `HEAD` and against each of those commits count: conflict resolutions and edits made during the merge, not what the other side brought, which was covered where it was written. Diff coverage checks only those lines; the tests that run and the missing-lcov check follow the files that hold them, and files the merge itself deleted lines from, renamed, added empty or changed the mode of. A merge with no changes of its own is no code staged. A revert counts as usual.
|
|
278
278
|
- **A unit test for code this tree doesn't have:** a test whose imports reach a staged file but also a code module under the sources that doesn't exist, isn't gitignored and isn't a staged deletion (a store test for a module on another branch) is skipped, and the hook names it in one line before the count. A missing `new URL(…, import.meta.url)` target, a missing non-code file such as `.wasm` or `.json`, and a missing file outside the sources or gitignored (a build output such as `dist/` or a bundled worker) don't skip the test.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-ecoverse/slicc-shared-web",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.3",
|
|
4
4
|
"description": "Shared Renovate, Biome, TypeScript, lefthook and GitHub Actions configuration, plus the CDP integration-test harness, for SLICC's web repos",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -11,6 +11,14 @@
|
|
|
11
11
|
"engines": {
|
|
12
12
|
"node": ">=24"
|
|
13
13
|
},
|
|
14
|
+
"slicc": {
|
|
15
|
+
"unitSources": [
|
|
16
|
+
"bin",
|
|
17
|
+
"harness",
|
|
18
|
+
"testing",
|
|
19
|
+
"unit"
|
|
20
|
+
]
|
|
21
|
+
},
|
|
14
22
|
"fledgling": {
|
|
15
23
|
"provider": "github",
|
|
16
24
|
"workflow": "ci.yml",
|
|
@@ -61,14 +69,14 @@
|
|
|
61
69
|
"lint": "bin/slicc-lint.sh && shellcheck bin/*.sh",
|
|
62
70
|
"pretest": "slicc-cdp install-browser",
|
|
63
71
|
"test": "SLICC_PROFILE=1 node --test --test-global-setup=harness/global.mjs test/integration/*.test.mjs && node test/integration/verify.mjs",
|
|
64
|
-
"test:unit": "mcr -c
|
|
72
|
+
"test:unit": "mcr -c mcr.config.mjs node --test 'test/unit/**/*.test.mjs'",
|
|
65
73
|
"trust": "npx fledgling sync -y --skip-publish",
|
|
66
74
|
"trust:dry": "npx fledgling sync --dry-run -y --skip-publish",
|
|
67
75
|
"release": "semantic-release"
|
|
68
76
|
},
|
|
69
77
|
"devDependencies": {
|
|
70
|
-
"@ai-ecoverse/slicc-browsers": "1.18.
|
|
71
|
-
"@ai-ecoverse/slicc-cdp": "1.
|
|
78
|
+
"@ai-ecoverse/slicc-browsers": "1.18.16",
|
|
79
|
+
"@ai-ecoverse/slicc-cdp": "1.42.2",
|
|
72
80
|
"@biomejs/biome": "2.5.15",
|
|
73
81
|
"lefthook": "2.2.2",
|
|
74
82
|
"monocart-coverage-reports": "2.13.2",
|