Skip to content

Commit c745ceb

Browse files
committed
docs: add test instructions to README
1 parent cab08e4 commit c745ceb

1 file changed

Lines changed: 71 additions & 0 deletions

File tree

README.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,77 @@ Head over to the [Releases](https://github.com/PathOfBuildingCommunity/PathOfBui
5050
* Share builds with other users by generating a share code
5151
* Automatic updating; most updates will only take a couple of seconds to apply
5252

53+
## Running Tests
54+
55+
The test suite uses [Busted](https://lunarmodules.github.io/busted/) with LuaJIT and runs inside a pre-built Docker/Podman image.
56+
57+
### Prerequisites
58+
59+
You need either **Docker** or **Podman** installed and available in your PATH. No other local dependencies are required — the test image bundles LuaJIT, Busted, and LuaCov.
60+
61+
### Run all tests
62+
63+
**With Docker:**
64+
```bash
65+
docker run --rm \
66+
-e HOME=/tmp \
67+
-v "$(pwd)":/workdir:ro \
68+
-w /workdir \
69+
ghcr.io/pathofbuildingcommunity/pathofbuilding-tests:latest \
70+
busted --lua=luajit
71+
```
72+
73+
**With Podman:**
74+
```bash
75+
podman run --rm \
76+
-e HOME=/tmp \
77+
-v "$(pwd)":/workdir:ro \
78+
-w /workdir \
79+
ghcr.io/pathofbuildingcommunity/pathofbuilding-tests:latest \
80+
busted --lua=luajit
81+
```
82+
83+
**With Docker Compose** (if `docker compose` v2 is available):
84+
```bash
85+
docker compose run --rm busted-tests
86+
```
87+
88+
### Run a subset of tests
89+
90+
Pass a `--tags` filter to scope which tests run:
91+
92+
```bash
93+
# Build snapshot tests (slow)
94+
... busted --lua=luajit --tags builds
95+
96+
# Data file validation only
97+
... busted --lua=luajit --tags data
98+
```
99+
100+
### Run with coverage
101+
102+
```bash
103+
... busted --lua=luajit --coverage
104+
```
105+
106+
Coverage output is written to `luacov.report.out`. Compare against `main` to ensure coverage does not drop.
107+
108+
### Test layout
109+
110+
| Path | Purpose |
111+
|------|---------|
112+
| `spec/System/` | Busted test suite (all `*_spec.lua` files) |
113+
| `src/HeadlessWrapper.lua` | Test bootstrap / headless PoB initialiser |
114+
| `.busted` | Busted configuration (working dir, helper, Lua path) |
115+
| `docker-compose.yml` | Convenience wrapper for the test container |
116+
| `Dockerfile` | Definition of the test image |
117+
118+
### Notes
119+
120+
- Tests must pass before opening a PR: `370 successes` is the baseline on `dev`.
121+
- The two known failures in `TestWard_spec.lua` are in-progress work (Ward regen/bypass not yet implemented).
122+
- Numeric calculation tests assert specific stat values within ±0.01 tolerance.
123+
53124
## Changelog
54125
You can find the full version history [here](CHANGELOG.md).
55126

0 commit comments

Comments
 (0)