Skip to content

ci(web): run the four src/lib test files no script named - #689

Open
shuhuNB515 wants to merge 1 commit into
BaaRai:mainfrom
shuhuNB515:ci/run-remaining-lib-tests
Open

shuhuNB515 wants to merge 1 commit into
BaaRai:mainfrom
shuhuNB515:ci/run-remaining-lib-tests

Conversation

@shuhuNB515

Copy link
Copy Markdown
Contributor

Closes #678.

Problem

Four test files under web/src/lib/ had no package.json script, and the web CI job runs each script by name rather than a glob, so nothing ran them:

File Covers
src/lib/activity-merge.test.mjs activity-merge.ts
src/lib/chat-mentions.test.mjs chat-mentions.ts
src/lib/format.test.mjs format.ts
src/lib/http-href.test.mjs http-href.ts

15 assertions that could not fail a build. The one that matters most is http-href: httpHref is the guard that refuses javascript:, data: and vbscript: URLs before they reach an href, so a regression there is an XSS vector that CI would have merged green.

Behavior

The issue offered two shapes: four scripts and four CI steps, or one test:lib glob. This takes the first, because it matches the existing one-script-per-file convention and does not run test:bash, test:navigation, test:chat-filter and test:openai-compatible a second time through a glob.

  • web/package.json: test:activity-merge, test:chat-mentions, test:format, test:http-href, each node --test <file>.
  • .github/workflows/ci.yml: one web job step per new script, before build:static.
  • A CHANGELOG entry under ### Added.

No test, source or TypeScript file is touched.

Tests

Closure checked mechanically on the branch — every *.test.mjs on disk is named by a script, and every test:* script appears in ci.yml:

on disk: 16 named: 16 unrun: []
test scripts: 16 not in CI: []

All 16 web scripts pass locally (Node 24.21.0), including the four new ones:

test:activity-merge   pass 4  fail 0
test:chat-mentions    pass 3  fail 0
test:format           pass 6  fail 0
test:http-href        pass 2  fail 0

npx tsc --noEmit is clean, and ci.yml still parses as YAML with all seven jobs.

Note: npx biome check package.json reports one formatting difference in the pre-existing lint-staged array. It is identical before and after this change (that is #612), so it is left alone here.

activity-merge, chat-mentions, format and http-href had tests on disk that
pass, but no package.json script named them and the web job runs each script
by name, so their 15 assertions could not fail a build. http-href is the
guard that refuses javascript:, data: and vbscript: URLs before they reach an
href, so a regression there was an unenforced XSS vector.

Add one script per file, matching the existing shape, and one web job step
per script. Closes BaaRai#678.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

web: four src/lib test files are in no npm script, so CI never runs them (15 assertions, incl. the httpHref XSS guard)

1 participant