Skip to content

Commit bfd557d

Browse files
cameronrsudo-tee
authored andcommitted
test(replay): move replay to its own group
Makes it easier to run unit tests separately from replay tests, especially replay tests can take a bit of time
1 parent 0b75a66 commit bfd557d

File tree

3 files changed

+27
-7
lines changed

3 files changed

+27
-7
lines changed

AGENTS.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
## Build, Lint, and Test
44

55
- **Run all tests:** `./run_tests.sh`
6-
- **Minimal tests:**
6+
- **Minimal tests:** `./run_tests.sh -t minimal`
77
`nvim --headless -u tests/minimal/init.lua -c "lua require('plenary.test_harness').test_directory('./tests/minimal', {minimal_init = './tests/minimal/init.lua', sequential = true})"`
8-
- **Unit tests:**
8+
- **Unit tests:** `./run_tests.sh -t unit`
99
`nvim --headless -u tests/minimal/init.lua -c "lua require('plenary.test_harness').test_directory('./tests/unit', {minimal_init = './tests/minimal/init.lua'})"`
10+
- **Replay tests:** `./run_tests.sh -t replay`
11+
`nvim --headless -u tests/minimal/init.lua -c "lua require('plenary.test_harness').test_directory('./tests/replay', {minimal_init = './tests/minimal/init.lua'})"`
1012
- **Run a single test:** Replace the directory in the above command with the test file path, e.g.:
1113
`nvim --headless -u tests/manual/init.lua -c "lua require('plenary.test_harness').test_directory('./tests/unit/job_spec.lua', {minimal_init = './tests/minimal/init.lua'})"`
1214
- **Manual/Visual tests:** `./tests/manual/run_replay.sh` - Replay captured event data for visual testing
@@ -27,6 +29,6 @@
2729
- **Comments:** Only when necessary for clarity. Prefer self-explanatory code.
2830
- **Functions:** Prefer local functions. Use `M.func` for module exports.
2931
- **Config:** Centralize in `config.lua`. Use deep merge for user overrides.
30-
- **Tests:** Place in `tests/minimal/` or `tests/unit/`. Manual/visual tests in `tests/manual/`.
32+
- **Tests:** Place in `tests/minimal/`, `tests/unit/`, or `tests/replay/`. Manual/visual tests in `tests/manual/`.
3133

3234
_Agentic coding agents must follow these conventions strictly for consistency and reliability._

run_tests.sh

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@ print_usage() {
1818
echo "Usage: $0 [OPTIONS]"
1919
echo "Options:"
2020
echo " -f, --filter PATTERN Filter tests by pattern (matches test descriptions)"
21-
echo " -t, --type TYPE Test type: all, minimal, unit, or specific file path"
21+
echo " -t, --type TYPE Test type: all, minimal, unit, replay, or specific file path"
2222
echo " -h, --help Show this help message"
2323
echo ""
2424
echo "Examples:"
2525
echo " $0 # Run all tests"
2626
echo " $0 -f \"Timer\" # Run tests matching 'Timer'"
2727
echo " $0 -t unit # Run only unit tests"
28+
echo " $0 -t replay # Run only replay tests"
2829
echo " $0 -t tests/unit/timer_spec.lua # Run specific test file"
2930
echo " $0 -f \"creates a new timer\" -t unit # Filter unit tests"
3031
}
@@ -72,8 +73,10 @@ echo "------------------------------------------------"
7273
# Run tests based on type
7374
minimal_status=0
7475
unit_status=0
76+
replay_status=0
7577
minimal_output=""
7678
unit_output=""
79+
replay_output=""
7780

7881
if [ "$TEST_TYPE" = "all" ] || [ "$TEST_TYPE" = "minimal" ]; then
7982
# Run minimal tests
@@ -103,8 +106,22 @@ if [ "$TEST_TYPE" = "all" ] || [ "$TEST_TYPE" = "unit" ]; then
103106
echo "------------------------------------------------"
104107
fi
105108

109+
if [ "$TEST_TYPE" = "all" ] || [ "$TEST_TYPE" = "replay" ]; then
110+
# Run replay tests
111+
replay_output=$(nvim --headless -u tests/minimal/init.lua -c "lua require('plenary.test_harness').test_directory('./tests/replay', {minimal_init = './tests/minimal/init.lua'$FILTER_OPTION})" 2>&1)
112+
replay_status=$?
113+
clean_output "$replay_output"
114+
115+
if [ $replay_status -eq 0 ]; then
116+
echo -e "${GREEN}✓ Replay tests passed${NC}"
117+
else
118+
echo -e "${RED}✗ Replay tests failed${NC}"
119+
fi
120+
echo "------------------------------------------------"
121+
fi
122+
106123
# Handle specific test file
107-
if [ "$TEST_TYPE" != "all" ] && [ "$TEST_TYPE" != "minimal" ] && [ "$TEST_TYPE" != "unit" ]; then
124+
if [ "$TEST_TYPE" != "all" ] && [ "$TEST_TYPE" != "minimal" ] && [ "$TEST_TYPE" != "unit" ] && [ "$TEST_TYPE" != "replay" ]; then
108125
# Assume it's a specific test file path
109126
if [ -f "$TEST_TYPE" ]; then
110127
specific_output=$(nvim --headless -u tests/minimal/init.lua -c "lua require('plenary.test_harness').test_directory('./$TEST_TYPE', {minimal_init = './tests/minimal/init.lua'$FILTER_OPTION})" 2>&1)
@@ -129,9 +146,10 @@ fi
129146

130147
# Check for any failures
131148
all_output="$minimal_output
132-
$unit_output"
149+
$unit_output
150+
$replay_output"
133151

134-
if [ $minimal_status -ne 0 ] || [ $unit_status -ne 0 ] || echo "$all_output" | grep -q "\[31mFail.*||"; then
152+
if [ $minimal_status -ne 0 ] || [ $unit_status -ne 0 ] || [ $replay_status -ne 0 ] || echo "$all_output" | grep -q "\[31mFail.*||"; then
135153
echo -e "\n${RED}======== TEST FAILURES SUMMARY ========${NC}"
136154

137155
# Extract and format failures

0 commit comments

Comments
 (0)