Skip to content

Commit 9c3f0e4

Browse files
committed
README: describe the minimal setup required to pass the test suite
When trying to enhance the test suite, it can be a bit tricky to figure out what sparse-checkout definition to use. The alternative would be to build the entire site, which would be prohibitively slow for an efficient development cycle. Therefore, let's document that (quite involved, I am afraid!) sparse checkout definition for the minimum set of files required to build the site and run the test suite. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 902cd8f commit 9c3f0e4

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,52 @@ Note that running Pagefind will make the process about 7 times slower, and the s
105105

106106
Believe it or not, https://git-scm.com/ has its own test suite. It uses [Playwright](https://playwright.dev/) to perform a couple of tests that verify that the site "looks right". These tests live in `tests/` and are configured via `playwright.config.js`.
107107

108+
> [!NOTE]
109+
> Building the site, letting Pagefind generate the search index, and then running the test suite can be quite time consuming. To accelerate the development cycle, it is _highly_ recommended to use a sparse checkout instead of a full clone. The minimal sparse checkout required to run the test suite can be configured like this:
110+
>
111+
> ```console
112+
> $ git config set --worktree core.sparseCheckoutCone false
113+
> $ git config set --worktree core.sparseCheckout true
114+
> $ git sparse-checkout set \
115+
> /README.md \
116+
> /assets/ \
117+
> /content/404.html \
118+
> /content/_index.html \
119+
> /content/about/small-and-fast.html \
120+
> /content/downloads/guis/ \
121+
> /content/search/ \
122+
> /data/ \
123+
> /external/book/content/book/_index.html \
124+
> /external/book/content/book/az/v2/Başlanğıc-Git-Nədir.html \
125+
> /external/book/content/book/en/v2/Getting-Started-About-Version-Control.html \
126+
> /external/book/content/book/en/v2/_index.html \
127+
> /external/book/content/book/fr/v2/Démarrage-rapide-À-propos-de-la-gestion-de-version.html \
128+
> /external/book/data/ \
129+
> /external/docs/content/docs/git-add/fr.html \
130+
> /external/docs/content/docs/git-clone.html \
131+
> /external/docs/content/docs/git-commit.html \
132+
> /external/docs/content/docs/git-commit/fr.html \
133+
> /external/docs/content/docs/git-config.html \
134+
> /external/docs/content/docs/git-config/fr.html \
135+
> /external/docs/content/docs/git-remote/fr.html \
136+
> /external/docs/content/docs/gitrevisions.html \
137+
> /external/docs/content/docs/gitrevisions/fr.html \
138+
> /external/docs/data/ \
139+
> /hugo.yml \
140+
> /layouts/ \
141+
> /playwright.config.js \
142+
> /script/ \
143+
> /static/ \
144+
> /tests/git-scm.spec.js
145+
> ```
146+
>
147+
> The site can then be built quickly via these commands:
148+
>
149+
> ```console
150+
> $ HUGO_MEMORYLIMIT=1 time hugo &&
151+
> npx -y pagefind@$(sed -n 's/^ *pagefind_version: //p' <./hugo.yml) --site public
152+
> ```
153+
108154
To run these tests in your local setup, you need a working node.js installation. After that, you need to install Playwright:
109155
110156
```console

0 commit comments

Comments
 (0)