ci(sonar): import test coverage instead of excluding it

The scan job now runs both suites with coverage before scanning:
pytest --cov (pyproject.toml: scripts/ without its tests, relative
paths, coverage.xml) and `npm run test:coverage` (vite.config.ts: v8,
lcov with projectRoot "..", so paths start web/). sonar-project.properties
names both reports and drops sonar.coverage.exclusions.

requirements-test.txt gains pytest-cov 7.1.0 and coverage 7.16.2 with
every file's hash (uv pip compile --universal --generate-hashes
--python-version 3.15; the existing pins are unchanged). web gains
@vitest/coverage-v8 5.0.5, matching vitest; none of its packages has an
install script. Coverage stays off for a plain `npm test`.

The token check is its own job, so the scan steps no longer each repeat
the condition; the workflow grants nothing at the top and the scan job
contents: read. `npm run build:admin` replaces the bare `svelte-kit
sync`: it syncs too, and writes the admin bundle the Worker's tests load.

Locally: 576 vitest tests at 58.35% of lines, 299 pytest tests at 57.7%.
Against main's new-code lines (SonarCloud's isNew), the reports cover
92 of 114 coverable lines, 80.7%: the 80% gate is borderline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
poli0981andClaude Opus 5.5 committed 2026-10-22 19:34:51 +07:00
1 parent 8efc28e3bb
commit df91b42c4f
11 files changed
+381 -56

No files matched your search

+49 -24
View File
@@ -5,7 +5,8 @@ name: SonarCloud
# the project's Administration > Analysis Method. What is code, what is test # the project's Administration > Analysis Method. What is code, what is test
# and what is not analysed at all is sonar-project.properties at the root. # and what is not analysed at all is sonar-project.properties at the root.
# SonarCloud's GitHub App still posts the "SonarCloud Code Analysis" check on # SonarCloud's GitHub App still posts the "SonarCloud Code Analysis" check on
# the pull request; this job only uploads the analysis. # the pull request; this job runs both test suites for their coverage and
# uploads the analysis.
on: on:
push: push:
@@ -18,8 +19,7 @@ on:
paths-ignore: ['data/**', 'games/**', 'scripts/*.jsonl', 'scripts/*.log'] paths-ignore: ['data/**', 'games/**', 'scripts/*.jsonl', 'scripts/*.log']
workflow_dispatch: workflow_dispatch:
permissions: permissions: {}
contents: read
concurrency: concurrency:
# SonarCloud refuses an analysis older than the last one it has for a # SonarCloud refuses an analysis older than the last one it has for a
@@ -28,15 +28,16 @@ concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }} cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs: jobs:
scan: # Pull requests from forks and from Dependabot get no repository secrets.
# Without the token the scan cannot upload anything, so the scan job is
# skipped rather than failing every such pull request.
token:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 20 outputs:
present: ${{ steps.check.outputs.present }}
steps: steps:
# Pull requests from forks and from Dependabot get no repository
# secrets. Without the token the scan cannot upload anything, so the job
# says so and passes rather than failing every such pull request.
- name: Check for the token - name: Check for the token
id: token id: check
env: env:
HAS_TOKEN: ${{ secrets.SONAR_TOKEN != '' }} HAS_TOKEN: ${{ secrets.SONAR_TOKEN != '' }}
run: | run: |
@@ -45,37 +46,61 @@ jobs:
echo "::notice::SONAR_TOKEN is not available to this run; skipping the SonarCloud scan." echo "::notice::SONAR_TOKEN is not available to this run; skipping the SonarCloud scan."
fi fi
scan:
needs: token
if: needs.token.outputs.present == 'true'
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: read
steps:
# Full history: SonarCloud blames every line to tell new code from old. # Full history: SonarCloud blames every line to tell new code from old.
- uses: actions/checkout@v6 - uses: actions/checkout@v6
if: steps.token.outputs.present == 'true'
with: with:
fetch-depth: 0 fetch-depth: 0
persist-credentials: false persist-credentials: false
# The TypeScript analyser builds a program from each tsconfig named in # Python coverage: coverage.xml at the root (pyproject.toml's
# sonar-project.properties. web/tsconfig.json extends the one # [tool.coverage.run] says what is measured). The pipeline's install line
# `svelte-kit sync` generates, and the types come from node_modules; # and then the test tools, each in its own pip call, as python-tests.yml.
# without them it logs "Failed to parse tsconfig" and analyses web/src - uses: actions/setup-python@v6
# with no types. Both are gitignored, so neither is analysed itself. with:
python-version: '3.15'
- name: Install the pipeline and the test tools
run: |
pip install --quiet --require-hashes --only-binary :all: -r requirements.txt
pip install --quiet --require-hashes --only-binary :all: -r requirements-test.txt
- name: pytest with coverage
run: python -m pytest scripts/tests -q --cov --cov-report=xml
# TypeScript coverage: web/coverage/lcov.info (vite.config.ts's
# test.coverage). build:admin runs `svelte-kit sync` - web/tsconfig.json
# extends the tsconfig it generates, and without it the analyser logs
# "Failed to parse tsconfig" and reads web/src with no types - and writes
# the admin bundle worker/index.ts imports, which the Worker's tests load.
# node_modules, .svelte-kit and the bundle are gitignored, so none of
# them is analysed itself.
- uses: actions/setup-node@v7 - uses: actions/setup-node@v7
if: steps.token.outputs.present == 'true'
with: with:
node-version: '26' node-version: '26'
cache: 'npm' cache: 'npm'
cache-dependency-path: web/package-lock.json cache-dependency-path: web/package-lock.json
# --ignore-scripts, as everywhere this repo runs `npm ci` (web-ci.yml says # --ignore-scripts, as everywhere this repo runs `npm ci` (web-ci.yml
# why). The bin by path, not `npx`, which may fetch a package the # says why).
# lockfile never named. - name: Install web/
- name: Prepare the TypeScript projects working-directory: web
if: steps.token.outputs.present == 'true' run: npm ci --ignore-scripts
- name: vitest with coverage
working-directory: web working-directory: web
run: | run: |
npm ci --ignore-scripts npm run build:admin
node_modules/.bin/svelte-kit sync npm run test:coverage
- name: SonarCloud scan - name: SonarCloud scan
if: steps.token.outputs.present == 'true'
uses: SonarSource/sonarqube-scan-action@d209202bc7d53ff1cc128f7f907dac145c9d6ae9 # v8.3.0 uses: SonarSource/sonarqube-scan-action@d209202bc7d53ff1cc128f7f907dac145c9d6ae9 # v8.3.0
env: env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+1
View File
@@ -120,6 +120,7 @@ pip-delete-this-directory.txt
.coverage.* .coverage.*
htmlcov/ htmlcov/
*.cover *.cover
coverage.xml
# Jupyter Notebook # Jupyter Notebook
.ipynb_checkpoints .ipynb_checkpoints
+3 -2
View File
@@ -17,8 +17,9 @@ All notable changes to this awesome noob repo will be documented here.
- **SonarCloud analyses in CI.** A workflow runs the scan on pull requests and - **SonarCloud analyses in CI.** A workflow runs the scan on pull requests and
on `main` in place of SonarCloud's automatic analysis, with its settings in on `main` in place of SonarCloud's automatic analysis, with its settings in
`sonar-project.properties` (formerly `.sonarcloud.properties`). Commits that `sonar-project.properties` (formerly `.sonarcloud.properties`). Commits that
only carry data are not scanned. Coverage is not measured, and the only carry data are not scanned. It runs both test suites with coverage
settings say so, so the quality gate no longer reads that as 0%. first (pytest-cov for the pipeline, `npm run test:coverage` for the web
app), so SonarCloud shows what the tests reach instead of reading 0%.
- **TypeScript 7, Node 26 and Python 3.15.** The type-check runs on - **TypeScript 7, Node 26 and Python 3.15.** The type-check runs on
TypeScript 7, the native compiler: `tsc` for the Worker, the tests and the TypeScript 7, the native compiler: `tsc` for the Worker, the tests and the
admin's Node code, and `svelte-check --tsgo` for the app. TypeScript 6 stays admin's Node code, and `svelte-check --tsgo` for the app. TypeScript 6 stays
+21 -13
View File
@@ -427,9 +427,10 @@ scraping pipeline (`scripts/`) driven by GitHub Actions.
- `requirements.txt` pins every package the pipeline installs, transitive - `requirements.txt` pins every package the pipeline installs, transitive
ones included, with the sha256 of every file on PyPI, and every install ones included, with the sha256 of every file on PyPI, and every install
is `pip install --require-hashes --only-binary :all: -r requirements.txt` is `pip install --require-hashes --only-binary :all: -r requirements.txt`
(bash/*.sh and four workflows). Hash mode is all-or-nothing per pip call: (bash/*.sh and the workflows that run Python). Hash mode is all-or-nothing
`requirements-test.txt` (pytest, hashed the same way) goes in its own call per pip call: `requirements-test.txt` (pytest and pytest-cov, hashed the
in `python-tests.yml`, which runs the pipeline's line first so a same way) goes in its own call in `python-tests.yml` and
`sonarcloud.yml`, which run the pipeline's line first so a
Dependabot bump is proven before a data job meets it, and Dependabot bump is proven before a data job meets it, and
`requirements-dev.txt` (unhashed local tools) is installed on its own. `requirements-dev.txt` (unhashed local tools) is installed on its own.
Adding a package means adding it and its dependencies with hashes: Adding a package means adding it and its dependencies with hashes:
@@ -463,16 +464,23 @@ scraping pipeline (`scripts/`) driven by GitHub Actions.
analyser reads them as Oracle). `sonar.typescript.tsconfigPaths` names all analyser reads them as Oracle). `sonar.typescript.tsconfigPaths` names all
six tsconfigs in `web/` (auto-detection finds only files named exactly six tsconfigs in `web/` (auto-detection finds only files named exactly
`tsconfig.json`), and the job runs `npm ci --ignore-scripts` and `tsconfig.json`), and the job runs `npm ci --ignore-scripts` and
`svelte-kit sync` first: `web/tsconfig.json` extends the generated one, and `npm run build:admin` (which syncs SvelteKit) first: `web/tsconfig.json`
without it the analyser logged "Failed to parse tsconfig" and read `web/src` extends the generated one, and without it the analyser logged "Failed to
untyped. A new tsconfig joins that list. The job skips commits that touch only what parse tsconfig" and read `web/src` untyped. A new tsconfig joins that list.
the data jobs write, and passes without scanning when `SONAR_TOKEN` is not The job skips commits that touch only what the data jobs write, and its
available (forks, Dependabot). No coverage report is uploaded, so `scan` job is skipped when `SONAR_TOKEN` is not available (forks,
`sonar.coverage.exclusions=**/*` says so: without it every line counted as Dependabot).
uncovered and the default "Sonar way" gate (80% coverage on new code) failed **Coverage is measured there, not in the test workflows.** The job runs
`main` (measured 2026-10-22, 0.0% on 109 new lines). Importing coverage pytest with `--cov` (`[tool.coverage.run]` in `pyproject.toml`: `scripts/`
means removing that line in the same change. Suppressing a rule for a file is done in the without its tests, relative paths, `coverage.xml` at the root) and
SonarCloud UI, not in this file or with NOSONAR. `npm run test:coverage` (`test.coverage` in `web/vite.config.ts`: lcov with
`projectRoot: ".."`, so the paths start `web/`). Both reports are named in
`sonar-project.properties`; a path that does not resolve from the
repository root is silently uncovered. Coverage is off for a plain
`npm test`. The default "Sonar way" gate wants 80% on new code, and SonarCloud
counts every executable line a report does not name as uncovered: without
the reports `main` read 0.0% and failed it (2026-10-22). Suppressing a rule
for a file is done in the SonarCloud UI, not in this file or with NOSONAR.
## Frontend gotchas ## Frontend gotchas
+12 -2
View File
@@ -210,10 +210,20 @@ token that may analyse the project). Its automatic analysis must stay off
(project Administration > Analysis Method): with both on, every CI scan fails. (project Administration > Analysis Method): with both on, every CI scan fails.
Commits that touch only what the data jobs write (`data/`, `games/`, the Commits that touch only what the data jobs write (`data/`, `games/`, the
`.jsonl` queues and logs under `scripts/`) are not scanned. A pull request from `.jsonl` queues and logs under `scripts/`) are not scanned. A pull request from
a fork or from Dependabot gets no repository secrets, so its scan job passes a fork or from Dependabot gets no repository secrets, so its scan job is
without scanning; giving Dependabot its own `SONAR_TOKEN` (Settings > Secrets > skipped; giving Dependabot its own `SONAR_TOKEN` (Settings > Secrets >
Dependabot) would have its pull requests analysed too. Dependabot) would have its pull requests analysed too.
Before the scan the job runs both test suites with coverage: pytest with
`--cov` (configured in `pyproject.toml`, written to `coverage.xml`) and
`npm run test:coverage` in `web/` (configured in `vite.config.ts`, written to
`web/coverage/lcov.info`). SonarCloud's default "Sonar way" quality gate asks
for 80% coverage on new code (it ignores that condition below 20 new lines),
so a pull request that adds code its tests do not reach fails that check. To
see the figure locally, run
`npm run test:coverage` in `web/`, or
`python -m pytest scripts/tests --cov` after installing `requirements-test.txt`.
### A red "Workers Builds" check on a PR branch is usually not yours ### A red "Workers Builds" check on a PR branch is usually not yours
Cloudflare posts its own check alongside those. On a pull-request branch it has Cloudflare posts its own check alongside those. On a pull-request branch it has
+7
View File
@@ -5,3 +5,10 @@ paths = ["scripts"]
# pytest collects test_* functions and fixtures by name; vulture cannot see that. # pytest collects test_* functions and fixtures by name; vulture cannot see that.
exclude = ["scripts/tests/"] exclude = ["scripts/tests/"]
min_confidence = 80 min_confidence = 80
# pytest --cov (sonarcloud.yml): the pipeline's code, not the tests that drive
# it, with paths relative to the repository root, where the scan reads them.
[tool.coverage.run]
source = ["scripts"]
omit = ["scripts/tests/*"]
relative_files = true
+137 -6
View File
@@ -1,12 +1,135 @@
# What python-tests.yml installs on top of requirements.txt to run the suite: # What the test jobs install on top of requirements.txt: pytest, pytest-cov
# pytest and its dependencies, pinned with hashes the same way (see the header # (sonarcloud.yml's coverage report) and their dependencies, pinned with hashes
# of requirements.txt). requirements-dev.txt is the local tool set (vulture, # the same way (see the header of requirements.txt). requirements-dev.txt is
# pip-audit, pytest) and is not installed in CI; keep its pytest pin equal to # the local tool set (vulture, pip-audit, pytest) and is not installed in CI;
# this one. # keep its pytest pin equal to this one.
colorama==0.4.6 ; sys_platform == 'win32' \ colorama==0.4.6 ; sys_platform == 'win32' \
--hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \ --hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \
--hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6 --hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6
# via pytest # via pytest
coverage==7.16.2 \
--hash=sha256:00d3eb96e9988c45f50cccd1f1496571ac5c1f91386ac02c4d55516eeda19a24 \
--hash=sha256:01c6908bc613b420c26c818fe948e1b97dfd041a53c98b01c63bd8321f5c9aae \
--hash=sha256:066429634299e14dd2d511e1e85f8f9cecc500781f6b41907c0dd6f1baea7e63 \
--hash=sha256:0993d0e90858c03943d3cb152e068a20dd4707924deec84dd2230261baae3b1b \
--hash=sha256:0dcbcfcc059117284c603ff8cb61a65872512882f84a8cf0339241f7f7c2f148 \
--hash=sha256:0fd7a86fdda7cb6d616d178654bd0ad6bc0f3f33c2e478aa598500a1a9e34eda \
--hash=sha256:11d28e9123a9156cb405d8d27b44256c9a58fb5decc2073a8f17862057e3aa0f \
--hash=sha256:11e597173af1dc33d5f8a7332ada544199269a223af1ee1770ddd5e245ad0fe8 \
--hash=sha256:126d1af8804d7224421fe991ff65d3ce649081560df7a98b1a5ffff07f9923bd \
--hash=sha256:14253fc7bb15749b849795a06f5d3b6d8bc3fb8a4b5ddc341faf7a89dce205fc \
--hash=sha256:152877cdc8a07264882cfcd503ba56a3ef6cba56a70e8c70f6eb8ffd7384789a \
--hash=sha256:17228fbca0f22976f797be94e975dcd237799c657d49551c7de1e0654d1202e9 \
--hash=sha256:191803c4996b499fcd78c2ad5e5f767dcc53cb4dc6de6d6a741b443a1821ef02 \
--hash=sha256:1a37c6e478cf687e1aa30a593d19c92c02fad9d122b51ab73f51b8dc7a0c0fc9 \
--hash=sha256:1c569a9fd25505f1cd6bea90588818f90373ce90e2632e2cacf19ddbd6e14fdb \
--hash=sha256:1d56e4d21c56d2046447733f8b118409597db48c01efe898ee9ac24e858ec2d6 \
--hash=sha256:1d5d0e3b660506fb84f995814e3118a21efdc0c8eb80127da1be627d90093c17 \
--hash=sha256:1f15254427c9b33eedac4f198eaf9e356eb4f6214551afb43da6194a2c088ad7 \
--hash=sha256:218d742afca2b5ad5ca759e93eddedfbcc6eadf8322f080dcefc40b7bd4e2d48 \
--hash=sha256:22957cef43ce038641de78ba995de7568d2d6a37c6ddbf7fa0fd7d1ae2344d91 \
--hash=sha256:23219888477edd736b6fcaec1272d47d93b926e999641ffea7e53a1738e70b2b \
--hash=sha256:251aed777c47c77aba047096d4542889db089227655711dfc2b9c54ef0e15e35 \
--hash=sha256:28ff850182a67d117990fa2ce5ea1032836d8c9630dae867e8bdd3bff4533b79 \
--hash=sha256:29309ccc86b7f33df7db12813c299f215bbbc470ed6292d0bedd63ffae1ebf64 \
--hash=sha256:2aca0bdfa9e91621d5b09d815357bf63def4fc0e9cb66da67bf2cf93f3b1a6f5 \
--hash=sha256:30c1b65d529e46569899fadca59e4a87c1faf2886923f1307ba61e654d4f3c20 \
--hash=sha256:35f37886699cb9abd29958247d718628d5bc6f39e623dff66a09e546c42a7e03 \
--hash=sha256:382d3346d56b0eec1b793d53a4c88799c8053f516aa3a8d7c44315696954bacf \
--hash=sha256:396bb16e04ce04efbb3df91456ae4e3da918e69ecdf67fb711b0a0fdf35ccce0 \
--hash=sha256:3e7f99698ba3a7d13988bdd984b7ebf13af4dbe2166dc8502eef90d77603b0a4 \
--hash=sha256:3e861f1071dcc2fec1e88bef0920f6b1eaa66a143555b4f8ab79ba2b0f30ef55 \
--hash=sha256:3f43bac1856ba269b905302778d4df433d6006489a192174ad77ac528e395032 \
--hash=sha256:40c0f00899fe6181ae7f434ceb200e51f5ee4b8ed10e3b5f0b605f0cae15da87 \
--hash=sha256:414c26dfdb96aac2d570a54e03008f001e32eb2d413705365503648c6bd361d8 \
--hash=sha256:4358b9c8c0125b460407f3017c6cce8156e904b32772c5630d27112f52bdbfe5 \
--hash=sha256:444889f7f66b74e4455c0a97e0e166dd41177f1dca8c0239a47cff25e05ba7e1 \
--hash=sha256:44f21e407b278efdfc1ee5e481e00518bd1d500310a30a5fbf2bcbedfef4aaf0 \
--hash=sha256:4cc4f73aa3fabc36e32046d6cd2971405948d8a903636508a3d3b2f9128b3a95 \
--hash=sha256:4dbbd1155ca46e6e0b6b89d204428c56ef6a459af21333f365d135a2820e5a09 \
--hash=sha256:4ee546b9e4872ffa194bf07ac87bfa1202ebb824d0795dc1ef22f175545ca90a \
--hash=sha256:5139009b5efd2194fc168ee9362f0e191ba612ef5d29242f9269c22f9b8f80c7 \
--hash=sha256:5375ebd99038021b35e99dc88255022912c06565d316212f4a576e4b08d30f5d \
--hash=sha256:5397e21a90dde0e9c6896b77ded8f0be26b66f8b22b33aed41f6043ed95d55e6 \
--hash=sha256:57ff3783f99d75a1e81dd56a9737eb5665e6736a5d93258ba596b6dcad8fd05b \
--hash=sha256:58d4a54c6ea672afef66d49be922a2c69826c5ae1a42a9cd94f0c9c2bacdf800 \
--hash=sha256:59c3926585e1cd1f2190f4b2ac9014de1bbeaf0d5d0587b0dc6b0aa90d17896a \
--hash=sha256:5a27b731c171e43dc8b5f32b76a5051dde2ec9b9366c87028f08a7088ebc2c7b \
--hash=sha256:5b3146d2317c75f70df2509066d979dadd941f7021cdf9b5db4bcd8568258e25 \
--hash=sha256:5dca0bb66b4c3d624ba047887bf70270030c150692d543cb501293dc38a9f4b5 \
--hash=sha256:611a44e5229a59d7483ce830160e1a0e85f700562c7a5651c7c63fb8f4eb528c \
--hash=sha256:648352b94507179d82637292e7ae8802508d95f78e2f00a705a50b6c48011681 \
--hash=sha256:6a75180829efb8ae62b4aded25be6ddca1c888d138d2d82e21d93bfbd88f41cb \
--hash=sha256:705e5af11d34647efdc170c7840b6857c81cf74be96419a553f237e68e62cb72 \
--hash=sha256:723dcdab91357159b722935b500ee8abc0a66c8c432e1e9fabf4cc7598952de8 \
--hash=sha256:724bd0f1e81856b35e59fc98cf7b4e544a3cb662e4e0864dca73d4326ee9d808 \
--hash=sha256:732d950e51f3ba4fb6209c73250f3e8924fefca42953ee04a9e65d8c02414d7d \
--hash=sha256:736fde09ea39646d11f8e3b76bd3425c075aa4dd45f24891970bb77c14ff20f5 \
--hash=sha256:7a076277ca9f5750cc230f0f578ebd2620cec60255b25707361699fef6fb465c \
--hash=sha256:7b3bce4a0d05401d70b7d0d5ca783e686bc9d30e81dbd7d980d532609bf809e4 \
--hash=sha256:7b451c68218c150f616bc9649783ec8de76a59792c759b43aa0c9c0466a465e4 \
--hash=sha256:7d0732c83746bc24123c581a85d9dd96b70ddb538c9076020aa1a041790361e9 \
--hash=sha256:7ed238d227e23cc300c3d464babdaf9f6ddc740aa1b15a77ae96136e6a7c4516 \
--hash=sha256:80d3f7b48d43ee8fc5e8707a8adb43d743a5a1a85256c25a24f9d6d0e2238fa6 \
--hash=sha256:80e9fdb4c3d926b6ba721d4bf7435bdb869c3527ae7803290361d0ab73db13b6 \
--hash=sha256:848893e1d361448c113dc2f0913503522a6f7be231d0e38333d2a22d9698a011 \
--hash=sha256:893ea9cf86cb8d2546812ac93d973aaf2ee1fb45110a873b014214fd23e3725e \
--hash=sha256:8afd9bf35cc6a1f22eb3634808fa8e0b91902459c5721ef2e4461dfe771d7f08 \
--hash=sha256:8be099e979fc42559328a21828281b4578304191ae46ed4e80a407048a82eee6 \
--hash=sha256:8e209591f7c41ae4a9171335cf6156afda0b21de73b02f73f5aa95b2d5fbb08d \
--hash=sha256:8fc15cc8d0d06e873c00ef18e1372d605f9aaf3de27d8c24e50782e75bc8b843 \
--hash=sha256:9174f0af24e5eff248b9dbfe76ec5275a3d19d37edbc2810543f12cf97347a34 \
--hash=sha256:921415102a90637fcc2e3f169f61dad7699ecf690e8639fc21b813acbedc0967 \
--hash=sha256:967d72c835d7a8cf0af99ec813a2d06e3db6df706402f1fe85b31b437645f495 \
--hash=sha256:98d9c97f51b334b0adce7b964442a9af33c1a00c6ac856984cc5dc8d18f81c75 \
--hash=sha256:99704f73721e23859112072d522076e11c31744fc96b5652e5dd2018aa4359f7 \
--hash=sha256:9a75a4704ff640e46170042eec1f984385a121227c505d5a16ad8e495f452541 \
--hash=sha256:9acc7f7ec4a1b5f89bd929fde5b8a714f6fafdc6cc18725413d510aa082b47ad \
--hash=sha256:9c6afdd69218202bc1758c9a14b86b8cf1084f37ed2ca143e567a103772b16d1 \
--hash=sha256:9cdf19874e0d247f32f03609200370343c3c7aa260b191d8c2bb251d36198283 \
--hash=sha256:9e1d0ced76318bab499693ff25f64faa343415187cb2e4d7befdfdd391a1cf6a \
--hash=sha256:9fd670ac43b709c575aefc25bf52d8a598a3bc5017bddfd0a179152ab06a2deb \
--hash=sha256:a0f2285329dac10ab08f79cb11f5692c497018e6c7c511f95e6fd63a70b8f831 \
--hash=sha256:a2fac6895eb299a2e52d7bbb8fb3903502b9da8d3f5309ceb16ec40c646b58ee \
--hash=sha256:a336eec40e3520d369b8a6cdabb4f596e69a8b42927ca074aa1452fed943238a \
--hash=sha256:a4624f80732f6b427ac58f1f59c577a0994a12e8174b5af6a027b4b58795d4c3 \
--hash=sha256:a56ac4fa5a75c7e182e8f62600cfb4aff43c5ed7356a034f3557659c3bec1d90 \
--hash=sha256:a678c0b6b22086ec2427359d22e37445d4a792f5fdbbc744112c7dade65cad02 \
--hash=sha256:a740ea6f083c6db7b926534d159508f80ba275ab35e722522de0d18d0f56e55f \
--hash=sha256:a90700f743e29aa3d75a6ff5f01953176a889c00e526194bc4d281731b88d99d \
--hash=sha256:a9a638be322a8d76a41cdb17781c7f82aaee6a66493d8ffb7e2c09ee22423d99 \
--hash=sha256:a9cd3de0a5bfe7b0e21ee10e1a14e3d61bf52efc88217ab1d95d6ace6970bd46 \
--hash=sha256:aa62c85046473959c13ba9edca9dc90a77d5c1095b1ba313556314d77fe5b036 \
--hash=sha256:aba5c63b7afdc749cc9eae943d5b868cba2b261a176378fa1c5a30bc8bc89982 \
--hash=sha256:ac0f3b379c94acc2f7dce5f5f0b24d44fa1cc6a509717ef83dfee07450c2117c \
--hash=sha256:af2a2a8c7c74de0559e0c368d94c8def9e16c58faaee33a0bf081057c4227e3b \
--hash=sha256:af98ad5ed9d6daaca956201e00bb429a7eb2b080426686f70a20353e0f9839f5 \
--hash=sha256:afdf43b72ef3876c1fe66423b91466e37877c9e81e8cec70542b7e8525b9d1b7 \
--hash=sha256:b88841e654f09732804809e435b3e005a929ffd9998b872b7b213957b8759cb8 \
--hash=sha256:bb2fc905bbf4e6b7f40806ea79e31515abf6349594cdf0adf27c4215f0463204 \
--hash=sha256:bb4ffe96aa663cee727659db5a2afeb38c95f8677b747d447b90d6d4874ea2c5 \
--hash=sha256:bc0b0ac781d489304b741269857f1f8338b7a26b1b89c06c0344658001ec0035 \
--hash=sha256:bf1bd822ec4e387ed245bed0d71151582cf7be9e5309bc4145eefe36083d5878 \
--hash=sha256:c19cd6d025c1673f22afcd22c7df8a662d779e05d8e3fa6820c22afb895b0206 \
--hash=sha256:c3305c38a2fa21a4254f2ace7dd9ef5fc569c9a558b66e7017650b3d637fb95e \
--hash=sha256:c85d54e7e8a2ca932fe8399301af9b8d5907ea2a455ffaff6e7d1208db83b943 \
--hash=sha256:ca64d9f1f384f151b9511bec01126072acd2f313439f8ed015a22d8790aab6fa \
--hash=sha256:cce2bc991293f15cc4084ca116827b5900c5f34e1a54dfe83f10ab5c43162eb7 \
--hash=sha256:d6276d78f6fca7d0ac066d5da4165c5acd07829e8305c2cb900b738fb3a75a72 \
--hash=sha256:d93db87adb6b1c1b408dce4763314b55d76a9f589e96783a84ac9e7689e48bdf \
--hash=sha256:db5f8394e17f877a625b257f2ba0ce8e728a499c2c1579ad66220272cd3df510 \
--hash=sha256:db76506aa5416081f3e8974ae0f7965c58ada0bb0ef7339ac86099588dbb20d3 \
--hash=sha256:dba2edfb054f6d4a08df9d1637c39a5aa3865bca6617c13c86be21e45658a59c \
--hash=sha256:dcf4bc2aab4e16b1c4c0c2005918f23a7dd5d7821ddae82caed9e3342dc2fcce \
--hash=sha256:e1fa594c887365b69745f25a416806e61085dd07b94c9eae68a6e20730629b23 \
--hash=sha256:e6c52d3307824ff93b39efd99e4185d557db40bd841452abfb32e5d9151ca162 \
--hash=sha256:eb57acff4a74246ae513c142d4b36e18c389c3aed8661914a53f7cd0071031b2 \
--hash=sha256:f80bd9f9633eafc73d0a913ba2645c96ba58bba1befc30590f7c0fbfde59d865 \
--hash=sha256:f8475460aa33ee28ac896ab1156d0bb3b6c639f7f8383c2677d3359eb35f8205 \
--hash=sha256:fb2bde05838fffae1a1bf75e5d411a6cac3e4e9bb97e6640fed8cd47888b33f0 \
--hash=sha256:fb9d92ecfe2d5b494367c67f7446f8b75b68d8d0c8cf3bc3e6997478be25d9e2 \
--hash=sha256:fd3d72233eb8b48acc94fa57d44e2d32ce8e7abed02882ccb6d855ccc4ed33ec
# via pytest-cov
iniconfig==2.3.1 \ iniconfig==2.3.1 \
--hash=sha256:67f4b9c50da0dedf52af349e7749a80a9057a5031199791b906c3bb3ae878960 \ --hash=sha256:67f4b9c50da0dedf52af349e7749a80a9057a5031199791b906c3bb3ae878960 \
--hash=sha256:9121e2c1fdb355232495be3194c8dfe87ccc2d5dee45947b78e68f499790d7a7 --hash=sha256:9121e2c1fdb355232495be3194c8dfe87ccc2d5dee45947b78e68f499790d7a7
@@ -18,7 +141,9 @@ packaging==26.3 \
pluggy==1.7.0 \ pluggy==1.7.0 \
--hash=sha256:7dd7b0d8832ba3cb632c306926ded123429211b83641b35dc5c41ad2d34f9bec \ --hash=sha256:7dd7b0d8832ba3cb632c306926ded123429211b83641b35dc5c41ad2d34f9bec \
--hash=sha256:d1eaa46ebb595891b860ab086b4d09c8588af65ebd4361b8e8f4bb8920b90ba8 --hash=sha256:d1eaa46ebb595891b860ab086b4d09c8588af65ebd4361b8e8f4bb8920b90ba8
# via pytest # via
# pytest
# pytest-cov
pygments==2.21.0 \ pygments==2.21.0 \
--hash=sha256:2363c69b61c4a97c838da3b130dcd6468f4848992b21a82f2a63ec34377137d9 \ --hash=sha256:2363c69b61c4a97c838da3b130dcd6468f4848992b21a82f2a63ec34377137d9 \
--hash=sha256:610ca751c9bc2492b38eb9a38a7fbc93edbbb2d7182edaf34e66ae493dee5c8c --hash=sha256:610ca751c9bc2492b38eb9a38a7fbc93edbbb2d7182edaf34e66ae493dee5c8c
@@ -26,4 +151,10 @@ pygments==2.21.0 \
pytest==9.1.1 \ pytest==9.1.1 \
--hash=sha256:1088fbde8f2b49d95a549a195707afa7a76a3ce9bcadc26b6d71f0ffda5fe313 \ --hash=sha256:1088fbde8f2b49d95a549a195707afa7a76a3ce9bcadc26b6d71f0ffda5fe313 \
--hash=sha256:37a86b45efb9a47a61a36449063e8e18d0cab3161329fc099eb21783169c4f0c --hash=sha256:37a86b45efb9a47a61a36449063e8e18d0cab3161329fc099eb21783169c4f0c
# via
# -r C:/Users/kuujo/AppData/Local/Temp/claude/C--Users-kuujo--claude-spares-spare-wjtvTh/0b20fff4-514b-4913-adfe-2dc12f9b3836/scratchpad/test.in
# pytest-cov
pytest-cov==7.1.0 \
--hash=sha256:30674f2b5f6351aa09702a9c8c364f6a01c27aae0c1366ae8016160d1efc56b2 \
--hash=sha256:a0461110b7865f9a271aa1b51e516c9a95de9d696734a2f71e3e78f46e1d4678
# via (top level) # via (top level)
+8 -9
View File
@@ -38,18 +38,17 @@ sonar.exclusions=scripts/tests/**,**/*.test.ts,web/src/lib/testing/**,web/worker
sonar.sourceEncoding=UTF-8 sonar.sourceEncoding=UTF-8
# Coverage is not measured: the scan uploads no test report. Without this the # Coverage, from the two test runs sonarcloud.yml makes before the scan:
# CI scan counts every executable line as uncovered (0%), and the "Sonar way" # pytest --cov (pyproject.toml's [tool.coverage.run]) and vitest --coverage
# gate's 80% coverage-on-new-code condition fails main and any pull request # (vite.config.ts's test.coverage), both with paths from the repository root.
# with 20 or more new coverable lines - a condition automatic analysis never # A file neither report names counts as 0% covered, which is what it is.
# evaluated. To measure coverage, generate reports in sonarcloud.yml, name them sonar.python.coverage.reportPaths=coverage.xml
# in sonar.python.coverage.reportPaths / sonar.javascript.lcov.reportPaths, and sonar.javascript.lcov.reportPaths=web/coverage/lcov.info
# delete this line.
sonar.coverage.exclusions=**/*
# Every TypeScript project in web/. Left to itself the analyser finds only # Every TypeScript project in web/. Left to itself the analyser finds only
# files named exactly tsconfig.json, and analyses the Worker, shared/ and the # files named exactly tsconfig.json, and analyses the Worker, shared/ and the
# tests without their own compiler options. web/tsconfig.json extends the one # tests without their own compiler options. web/tsconfig.json extends the one
# `svelte-kit sync` generates, which the workflow runs first. # `svelte-kit sync` generates, which the workflow runs first (build:admin).
sonar.typescript.tsconfigPaths=web/tsconfig.json,web/tsconfig.worker.json,web/tsconfig.test.json,web/admin/tsconfig.json,web/admin/tsconfig.node.json,web/admin/tsconfig.test.json sonar.typescript.tsconfigPaths=web/tsconfig.json,web/tsconfig.worker.json,web/tsconfig.test.json,web/admin/tsconfig.json,web/admin/tsconfig.node.json,web/admin/tsconfig.test.json
# The version every workflow sets up (actions/setup-python), except CodeQL's, # The version every workflow sets up (actions/setup-python), except CodeQL's,
# which stays on the newest Python CodeQL supports. web/shared/toolchain.test.ts # which stays on the newest Python CodeQL supports. web/shared/toolchain.test.ts
+128
View File
@@ -36,6 +36,7 @@
"@types/node": "^26.6.5", "@types/node": "^26.6.5",
"@typescript/native": "npm:typescript@~7.0.2", "@typescript/native": "npm:typescript@~7.0.2",
"@vite-pwa/sveltekit": "^1.1.0", "@vite-pwa/sveltekit": "^1.1.0",
"@vitest/coverage-v8": "^5.0.5",
"knip": "^6.41.0", "knip": "^6.41.0",
"rehype-sanitize": "^6.0.0", "rehype-sanitize": "^6.0.0",
"rehype-slug": "^6.0.0", "rehype-slug": "^6.0.0",
@@ -1617,6 +1618,16 @@
"node": ">=6.9.0" "node": ">=6.9.0"
} }
}, },
"node_modules/@bcoe/v8-coverage": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-1.0.2.tgz",
"integrity": "sha512-6zABk/ECA/QYSCQ1NGiVwwbQerUCZ+TQbp64Q3AgmfNvurHH0j8TtXa1qbShXA6qqkpAj4V5W8pP6mLe1mcMqA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=18"
}
},
"node_modules/@cloudflare/kv-asset-handler": { "node_modules/@cloudflare/kv-asset-handler": {
"version": "0.5.0", "version": "0.5.0",
"resolved": "https://registry.npmjs.org/@cloudflare/kv-asset-handler/-/kv-asset-handler-0.5.0.tgz", "resolved": "https://registry.npmjs.org/@cloudflare/kv-asset-handler/-/kv-asset-handler-0.5.0.tgz",
@@ -5380,6 +5391,72 @@
} }
} }
}, },
"node_modules/@vitest/coverage-v8": {
"version": "5.0.5",
"resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-5.0.5.tgz",
"integrity": "sha512-4KpkGdIrSqBihx/JyP/e+S+IKB98etg1XDQiLAxksLfcShnwi1VReGeOT9NI43hLHbknosKp/1CCLn9Zgcs8mg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@bcoe/v8-coverage": "^1.0.2",
"@vitest/istanbul-lib-coverage": "^1.0.2",
"@vitest/istanbul-lib-report": "^1.0.2",
"ast-v8-to-istanbul": "^1.0.7",
"magicast": "^0.5.5",
"obug": "^3.0.0",
"std-env": "^4.3.0",
"tinyrainbow": "^3.2.0"
},
"funding": {
"url": "https://opencollective.com/vitest"
},
"peerDependencies": {
"@vitest/browser": "5.0.5",
"vitest": "5.0.5"
},
"peerDependenciesMeta": {
"@vitest/browser": {
"optional": true
}
}
},
"node_modules/@vitest/coverage-v8/node_modules/obug": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/obug/-/obug-3.0.0.tgz",
"integrity": "sha512-5vvB5+W7ePv+p3uqxi+RcW1XAzLW0/hxt3/4X4Lc4qHudzOhmBiBwOY6DRob4WnanAEGvNcLjF+KNOufrUoEQw==",
"dev": true,
"funding": [
"https://github.com/sponsors/sxzz",
"https://opencollective.com/debug"
],
"license": "MIT",
"engines": {
"node": ">=12.20.0"
}
},
"node_modules/@vitest/istanbul-lib-coverage": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@vitest/istanbul-lib-coverage/-/istanbul-lib-coverage-1.0.2.tgz",
"integrity": "sha512-9J/JMwOf9AoJhAywhrn7ScKTL38hsWQP/qPG60OtaAFcQ5OXPwKsxZFlbnuCKmZ61m8/lGgHYnFpdyQZUvG/iA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=22"
}
},
"node_modules/@vitest/istanbul-lib-report": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@vitest/istanbul-lib-report/-/istanbul-lib-report-1.0.2.tgz",
"integrity": "sha512-gUsfXZJbzPamoIY5TvHFiMMoXESBrUMo+xqaj+rYrWI69+EnvRlYBlP96ZnHPY4vX8kyUpgAnFUCg5wZG/HkDQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@vitest/istanbul-lib-coverage": "1.0.2"
},
"engines": {
"node": ">=22"
}
},
"node_modules/@vitest/mocker": { "node_modules/@vitest/mocker": {
"version": "5.0.5", "version": "5.0.5",
"resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.0.5.tgz", "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.0.5.tgz",
@@ -5551,6 +5628,35 @@
"node": ">=12" "node": ">=12"
} }
}, },
"node_modules/ast-v8-to-istanbul": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/ast-v8-to-istanbul/-/ast-v8-to-istanbul-1.0.7.tgz",
"integrity": "sha512-kFL68AG6ajd8fg248zwM9GQrUWEp79gsmjum34OEXjs4yHuUMZfYKwOLW9GMmB4oNvVrj+EAGxsP7ye2UR9UlA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@jridgewell/trace-mapping": "^0.3.31",
"estree-walker": "^3.0.3",
"js-tokens": "^10.0.0"
}
},
"node_modules/ast-v8-to-istanbul/node_modules/estree-walker": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz",
"integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/estree": "^1.0.0"
}
},
"node_modules/ast-v8-to-istanbul/node_modules/js-tokens": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-10.0.0.tgz",
"integrity": "sha512-lM/UBzQmfJRo9ABXbPWemivdCW8V2G8FHaHdypQaIy523snUjog0W71ayWXTjiR+ixeMyVHN2XcpnTd/liPg/Q==",
"dev": true,
"license": "MIT"
},
"node_modules/async": { "node_modules/async": {
"version": "3.2.6", "version": "3.2.6",
"resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz",
@@ -8268,6 +8374,18 @@
"@jridgewell/sourcemap-codec": "^1.5.5" "@jridgewell/sourcemap-codec": "^1.5.5"
} }
}, },
"node_modules/magicast": {
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/magicast/-/magicast-0.5.5.tgz",
"integrity": "sha512-UicdXN8zQ3JHlxVq+28afMXPr1z7WNY6+7EJnzTdQWkTAlMLF5fNCCKxJHBQwGaNGR11581EiQmQzx73+MvszA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/parser": "^7.29.7",
"@babel/types": "^7.29.7",
"source-map-js": "^1.2.1"
}
},
"node_modules/markdown-table": { "node_modules/markdown-table": {
"version": "3.0.4", "version": "3.0.4",
"resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-3.0.4.tgz", "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-3.0.4.tgz",
@@ -10814,6 +10932,16 @@
"url": "https://github.com/sponsors/SuperchupuDev" "url": "https://github.com/sponsors/SuperchupuDev"
} }
}, },
"node_modules/tinyrainbow": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-3.2.0.tgz",
"integrity": "sha512-LgO3D9yZJjApUiuUfl9iFAwrtaX4+lok3wJIqttGoKCHlWUqHqbQpnxCf82L8FjgKsh4iGo78hqJwgL8F6To2A==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=14.0.0"
}
},
"node_modules/totalist": { "node_modules/totalist": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/totalist/-/totalist-3.0.1.tgz", "resolved": "https://registry.npmjs.org/totalist/-/totalist-3.0.1.tgz",
+2
View File
@@ -17,6 +17,7 @@
"knip": "knip", "knip": "knip",
"test": "vitest run", "test": "vitest run",
"test:watch": "vitest", "test:watch": "vitest",
"test:coverage": "vitest run --coverage",
"tauri": "tauri", "tauri": "tauri",
"tauri:dev": "tauri dev", "tauri:dev": "tauri dev",
"tauri:build": "tauri build", "tauri:build": "tauri build",
@@ -59,6 +60,7 @@
"@types/node": "^26.6.5", "@types/node": "^26.6.5",
"@typescript/native": "npm:typescript@~7.0.2", "@typescript/native": "npm:typescript@~7.0.2",
"@vite-pwa/sveltekit": "^1.1.0", "@vite-pwa/sveltekit": "^1.1.0",
"@vitest/coverage-v8": "^5.0.5",
"knip": "^6.41.0", "knip": "^6.41.0",
"rehype-sanitize": "^6.0.0", "rehype-sanitize": "^6.0.0",
"rehype-slug": "^6.0.0", "rehype-slug": "^6.0.0",
+13
View File
@@ -1,3 +1,4 @@
/// <reference types="vitest/config" />
import { defineConfig, type Plugin } from "vite"; import { defineConfig, type Plugin } from "vite";
import { sveltekit } from "@sveltejs/kit/vite"; import { sveltekit } from "@sveltejs/kit/vite";
import { SvelteKitPWA } from "@vite-pwa/sveltekit"; import { SvelteKitPWA } from "@vite-pwa/sveltekit";
@@ -216,6 +217,18 @@ export default defineConfig(({ mode }) => ({
"/img": { target: "https://free-steam-games.win", changeOrigin: true }, "/img": { target: "https://free-steam-games.win", changeOrigin: true },
}, },
}, },
test: {
// Off unless asked for (`npm run test:coverage`): sonarcloud.yml sends the
// report to SonarCloud. Files no test loads are listed at 0%, as SonarCloud
// counts them anyway. projectRoot "..": the paths in lcov.info are read
// from the repository root, where the scan runs - web/src/..., not src/....
coverage: {
provider: "v8",
include: ["{src,worker,shared,build,scripts,admin/src,admin/build}/**/*.{ts,js,mjs}"],
exclude: ["**/*.test.ts", "**/*.d.ts", "src/lib/testing/**", "worker/testing/**", "worker/generated/**"],
reporter: [["lcovonly", { projectRoot: ".." }], "text-summary"],
},
},
build: { build: {
// Raised from es2020: Svelte 5's compiled output and SvelteKit 2 both // Raised from es2020: Svelte 5's compiled output and SvelteKit 2 both
// assume a modern baseline, and the Android floor is already API 30, whose // assume a modern baseline, and the Android floor is already API 30, whose