| 🛟 Updated. 28d5985 k33g 17h ago | 1 | # How to run the tests |
| 2 | |
| 3 | This guide shows how to run turbo-core's test suite and what it covers. It assumes a checkout and Go 1.26 or later. |
| 4 | |
| 5 | ## The one command |
| 6 | |
| 7 | ```bash |
| 8 | make test |
| 9 | ``` |
| 10 | |
| 11 | That is `go test ./...` over every package. It needs no setup, no network and no language server: everything it drives is either a pure function or a simulated terminal. |
| 12 | |
| 13 | ## Steps |
| 14 | |
| 15 | ### Run the whole suite |
| 16 | |
| 17 | ```bash |
| 18 | make test |
| 19 | ``` |
| 20 | |
| 21 | You should see one `ok` line per package, fifteen of them. |
| 22 | |
| 23 | ### Run it under the race detector |
| 24 | |
| 25 | ```bash |
| 26 | make race |
| 27 | ``` |
| 28 | |
| 29 | The editor has goroutines in three places — the language-server read loop, the terminal's pty reader, and a running tool's output — and every one of them has had a race in it at some point. Run this before committing anything that touches them. |
| 30 | |
| 31 | ### See what is covered |
| 32 | |
| 33 | ```bash |
| 34 | make cover |
| 35 | ``` |
| 36 | |
| 37 | ### Run one package |
| 38 | |
| 39 | ```bash |
| 40 | go test ./syntax/ |
| 41 | go test -run TestRegister ./syntax/ |
| 42 | ``` |
| 43 | |
| 44 | ### See the commands themselves |
| 45 | |
| 46 | ```bash |
| 47 | make help |
| 48 | ``` |
| 49 | |
| 50 | ## Variants |
| 51 | |
| 52 | ### You changed a scanner |
| 53 | |
| 54 | `go test ./syntax/` is the fast loop. Then run the whole suite, because `editor` and `app` both draw through it. |
| 55 | |
| 56 | ### You changed something with a goroutine behind it |
| 57 | |
| 58 | Use `make race`, not `make test`. A data race in a constructor that starts a goroutine hid here for a whole feature, because a shell takes longer to produce output than an assignment takes to run. |
| 59 | |
| 60 | ### A test passed the moment you wrote it |
| 61 | |
| 62 | Break the code it covers and watch it fail. This project has more than one recorded case of a test that passed because it tested nothing — a callback nobody wired, a step the test itself performed. A new test that has never failed has not been tested. |
| 63 | |
| 64 | ## See also |
| 65 | |
| 66 | - Running an editor's own tests: each editor's `how-to/run-the-tests.md` |
| 67 | - What the packages are: [packages reference](../reference/packages.md) |