mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-21 16:04:41 +00:00
docs: add JS test placement rule to AGENTS.md
Adds a "Tests for JavaScript / npm / package.json invariants belong in the JS suite" subsection under Testing, documenting that the CI classifier routes package.json / lockfile / .ts/.tsx changes to the frontend lane — so Python tests asserting about those files won't run on a JS-only PR. Includes a table mapping artifact types to the correct vitest workspace and run commands.
This commit is contained in:
parent
64389a2ce2
commit
f8abc521f3
1 changed files with 14 additions and 2 deletions
16
AGENTS.md
16
AGENTS.md
|
|
@ -1278,6 +1278,7 @@ def profile_env(tmp_path, monkeypatch):
|
|||
|
||||
## Testing
|
||||
|
||||
### Python
|
||||
**ALWAYS use `scripts/run_tests.sh`** — do not call `pytest` directly. The script enforces
|
||||
hermetic environment parity with CI (unset credential vars, TZ=UTC, LANG=C.UTF-8,
|
||||
`-n auto` xdist workers, in-tree subprocess-isolation plugin). Direct `pytest`
|
||||
|
|
@ -1291,12 +1292,12 @@ scripts/run_tests.sh tests/agent/test_foo.py::test_x # one test
|
|||
scripts/run_tests.sh -v --tb=long # pass-through pytest flags
|
||||
```
|
||||
|
||||
### Subprocess-per-test-file isolation
|
||||
#### Subprocess-per-test-file isolation
|
||||
|
||||
Every test file runs in a freshly-spawned Python subprocess via `run_tests_parallel.py`. This means module-level dicts/sets and
|
||||
ContextVars from one test file cannot leak into the next.
|
||||
|
||||
### Why the wrapper
|
||||
#### Why the wrapper
|
||||
|
||||
| | Without wrapper | With wrapper |
|
||||
| ------------------- | ------------------------------------------- | ----------------------------------------- |
|
||||
|
|
@ -1305,6 +1306,17 @@ ContextVars from one test file cannot leak into the next.
|
|||
| Timezone | Local TZ (PDT etc.) | UTC |
|
||||
| Locale | Whatever is set | C.UTF-8 |
|
||||
|
||||
### Where to place what tests
|
||||
|
||||
The CI change classifier (`scripts/ci/classify_changes.py`) runs specific jobs based on what files changed. A Python test that asserts
|
||||
about the contents of `package.json`, `package-lock.json`, `.ts`/`.tsx`
|
||||
source, or any other JS-side artifact will not run on a PR that only touches
|
||||
those files. This means a regression can go green on a PR and red on `main` (where the
|
||||
classifier fails open and runs everything).
|
||||
|
||||
Any test that reads or asserts about `package.json`,
|
||||
`package-lock.json`, `tsconfig.json`, `.ts`/`.tsx`/`.js`/`.mjs`/`.cjs`
|
||||
source files configuration belongs in the JS (vitest) test suite, not in `tests/*.py`.
|
||||
|
||||
### Don't write change-detector tests
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue