mirror of https://github.com/theNewDynamic/gohugo-theme-ananke.git

Patrick Kollitsch
2 days ago d545fdff144cebdd9358b1b14c0c168b03a7fd0b
refs
author Patrick Kollitsch <83281+davidsneighbour@users.noreply.github.com>
Saturday, June 6, 2026 02:06 +0200
committer Patrick Kollitsch <83281+davidsneighbour@users.noreply.github.com>
Saturday, June 6, 2026 03:11 +0200
commitd545fdff144cebdd9358b1b14c0c168b03a7fd0b
tree 563880951e5364f70864b5d8d06f9809a096fab3 tree | zip | gz
parent 237551fcb68055aa8344e83b1d31773fe7c2e653 view | diff
fix: test local working tree in quickstart test (#938) (#978)

Closes #938.

## Problem

`scripts/test-hugo-quickstart.ts` installed the theme via `git submodule
add` from the **published** remote. As a result, CI (which checks out
the PR) and the pre-push hook always tested the published theme and
never the local code under test — a broken change could pass.

## Fix (Solution 3 from the issue, generalized)

The test now installs the **local working tree** as the theme by
default, using `git ls-files --cached --others --exclude-standard` so it
includes committed *and* uncommitted/untracked changes while skipping
ignored paths (`node_modules`, `public`, generated resources). A non-git
`--theme-path` falls back to a filtered recursive copy. The documented
published-submodule flow stays available behind `--use-submodule`.

- **Script:** new `--theme-path=<dir>` and `--use-submodule` flags;
defaults to local mode. Theme install is split out of the linear step
list into a dedicated `installTheme`, and the step loop is factored into
a `runSteps` helper.
- **CI** (`.github/workflows/quickstart.yml`): local mode runs on every
push/PR; submodule mode runs post-merge on `main`/`master` so the
published install path is still verified without testing stale code on
PRs.
- **package.json:** added `test:quickstart:submodule`.

## Verification

- Local mode: **PASS**.
- Negative test: a deliberate template break in `layouts/baseof.html`
now makes the test **fail** (exit 1) — the old remote-cloning version
passed it. Reverted after.
- `--use-submodule` mode: **PASS**.
- `biome check` clean; `tsc` reports no new errors.
3 files modified
299 ■■■■ changed files
.github/workflows/quickstart.yml 12 ●●●●● diff | view | raw | blame | history
package.json 1 ●●●● diff | view | raw | blame | history
scripts/test-hugo-quickstart.ts 286 ●●●● diff | view | raw | blame | history