fix listing for errors that occurs within beforeEach
All checks were successful
tests / test (push) Successful in 8s

This commit is contained in:
2026-01-08 08:56:13 +01:00
parent 2d5889dce3
commit 2a1bac55b2
4 changed files with 270 additions and 6 deletions

View File

@@ -8,6 +8,7 @@ Mocha.js runner for the test-samurai Neovim plugin.
- Supports nearest, file, all, and failed-only commands.
- Streams results via a custom NDJSON reporter.
- Provides quickfix locations and per-test output.
- Captures hook failures (before/after/beforeEach/afterEach) as failed entries with output.
- Uses `--grep` with escaped patterns to match titles safely, even when running through `npm test`.
- Executes tests via `npx mocha` with the bundled UI + reporter so projects need no extra setup.
- `TSamAll` runs `test/**/*.test.js` by default.
@@ -35,11 +36,12 @@ which emits one JSON object per line:
```
{
"event": "run-begin" | "run-end" | "suite" | "test",
"event": "run-begin" | "run-end" | "suite" | "test" | "hook",
"status": "passed" | "failed" | "pending" | "skipped",
"title": "Test or suite title",
"fullTitle": "Mocha full title",
"titlePath": ["Parent", "Child", "Test"],
"hookType": "beforeEach" | "afterEach" | "beforeAll" | "afterAll",
"file": "/path/to/test.js",
"location": { "file": "/path/to/test.js", "line": 10, "column": 5 },
"output": ["stdout line 1", "stdout line 2"],
@@ -70,6 +72,14 @@ require("test-samurai-mocha-runner").setup({
})
```
Enable debug logging (writes raw parser input lines):
```lua
require("test-samurai-mocha-runner").setup({
debug_log_path = "/tmp/tsam-mocha.log",
})
```
## Development
Run tests: