Skip to content

Commit 1fac769

Browse files
ericallamTrigger.dev RepoOps
authored andcommitted
chore: relax the AGENTS.md test placement rule
Agent instructions (AGENTS.md and the test-writing guide) now say webapp tests go in `apps/webapp/test/`, and packages follow their existing layout (next to the source or in a `test/` folder). Mono-RevId: 3ac9cac75ceaff967dc461f695192cdef33fef87
1 parent 4ed2c68 commit 1fac769

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

‎AGENTS.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ pnpm run test ./src/engine/tests/ttl.test.ts --run # Single test file
5151
pnpm run build --filter @internal/run-engine # May need to build deps first
5252
```
5353

54-
Test files go next to source files (e.g., `MyService.ts` -> `MyService.test.ts`).
54+
Where test files go:
55+
56+
- **Webapp:** put tests in `apps/webapp/test/`, not next to the source. Vitest there only runs files matched by the `include` list in `apps/webapp/vitest.config.ts`.
57+
- **Packages:** follow the package's existing layout. Next to the source (`MyService.ts` -> `MyService.test.ts`) and a `test/` folder are both fine.
5558

5659
### Testcontainers for Redis/PostgreSQL
5760

‎ai/references/tests.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,25 @@ Prefer running tests on a single file (and first cding into the directory):
1010

1111
```bash
1212
cd apps/webapp
13-
pnpm run test ./src/components/Button.test.ts
13+
pnpm run test ./test/myService.test.ts
1414
```
1515

1616
If you are cd'ing into a directory, you may have to build dependencies first:
1717

1818
```bash
1919
pnpm run build --filter webapp
2020
cd apps/webapp
21-
pnpm run test ./src/components/Button.test.ts
21+
pnpm run test ./test/myService.test.ts
2222
```
2323

2424
## Writing Tests
2525

2626
We use vitest for testing. We almost NEVER mock anything. Start with a top-level "describe", and have multiple "it" statements inside of it.
2727

28-
New test files should be placed right next to the file being tested. For example:
28+
Where new test files go:
2929

30-
- Source file: `./src/services/MyService.ts`
31-
- Test file: `./src/services/MyService.test.ts`
30+
- Webapp: in `apps/webapp/test/`, not next to the source. Vitest there only runs files matched by the `include` list in `apps/webapp/vitest.config.ts`.
31+
- Packages: follow the package's existing layout. Next to the source (`./src/services/MyService.ts` -> `./src/services/MyService.test.ts`) and a `test/` folder are both fine.
3232

3333
When writing anything that needs redis or postgresql, we have some internal "testcontainers" that are used to spin up a local instance, redis, or both.
3434

0 commit comments

Comments
 (0)