Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ This is an npm workspace monorepo (workspaces defined in the root `package.json`
- **Framework:** Express
- **Database:** PostgreSQL, accessed via TinyPg (SQL file-based query library)
- **Authentication:** FusionAuth (external identity provider)
- **Testing:** Jest with ts-jest, Supertest, jest-when, nock, jest-mock-extended
- **Testing:** Vitest, Supertest, jest-when, nock, jest-mock-extended
- **Linting:** ESLint (eslint-config-love + prettier), SQLFluff (PostgreSQL dialect)
- **API Docs:** OpenAPI, linted with Redocly CLI
- **Error Tracking:** Sentry
Expand Down Expand Up @@ -91,7 +91,7 @@ The `@stela/api` lint script runs these checks sequentially:
Tests for `@stela/api` require a running PostgreSQL instance. The test setup:
1. Starts Docker containers (`docker compose up`)
2. Creates a fresh `test_permanent` database from the main database schema
3. Runs Jest inside the Docker container
3. Runs Vitest inside the Docker container

Other workspace tests can generally run independently.

Expand Down Expand Up @@ -263,9 +263,9 @@ Test files are co-located with source: `controller.test.ts` next to `controller.
### Integration Test Pattern (API)

```typescript
jest.mock("../database");
jest.mock("../middleware");
jest.mock("@stela/logger");
vi.mock("../database");
vi.mock("../middleware");
vi.mock("@stela/logger");

const setupDatabase = async (): Promise<void> => {
await db.sql("domain.fixtures.create_test_accounts");
Expand All @@ -286,8 +286,8 @@ describe("GET /endpoint", () => {

afterEach(async () => {
await clearDatabase();
jest.restoreAllMocks();
jest.clearAllMocks();
vi.restoreAllMocks();
vi.clearAllMocks();
});

const agent = request(app);
Expand Down
9 changes: 4 additions & 5 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import typescriptEslint from "typescript-eslint";
import prettier from "eslint-config-prettier";
import love from "eslint-config-love";
import globals from "globals";
import jest from "eslint-plugin-jest";
import vitest from "eslint-plugin-vitest";
import js from "@eslint/js";

export default defineConfig([
Expand All @@ -17,7 +17,7 @@ export default defineConfig([
languageOptions: {
globals: {
...globals.node,
...globals.jest,
...vitest.environments.env.globals,
},
},

Expand Down Expand Up @@ -48,13 +48,12 @@ export default defineConfig([
files: ["**/*.test.ts"],

plugins: {
jest,
vitest,
},

rules: {
"@typescript-eslint/unbound-method": "off",
"jest/unbound-method": "error",
"jest/no-focused-tests": "error",
"vitest/no-focused-tests": "error",
// Test files are allowed to be long because they need to be able to comprehensively test
// the relevant code, however many tests that takes. Their natural structure also makes
// them more navigable than other lengthy files might be.
Expand Down
5 changes: 0 additions & 5 deletions jest.config.js

This file was deleted.

Loading
Loading