Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

docs: expand the testing guide with frontend commands (#9294)

Nianze Wu5e5d7fba81d5
diff --git a/docs/src/content/docs/development/Guides/tests.mdx b/docs/src/content/docs/development/Guides/tests.mdx
index c2dfd52b98..d306922f18 100644
--- a/docs/src/content/docs/development/Guides/tests.mdx
+++ b/docs/src/content/docs/development/Guides/tests.mdx
@@ -1,13 +1,41 @@
---
title: Writing Tests
-lastUpdated: 2026-02-20
+lastUpdated: 2026-07-13
---
+import { Tabs, TabItem } from '@astrojs/starlight/components';
+
## Frontend Tests
We use `vitest` to run the frontend tests. (See [vite.config.ts](https://github.com/invoke-ai/InvokeAI/blob/main/invokeai/frontend/web/vite.config.mts) for the default `vitest` options.)
-{/* TODO: Finish frontend tests docs */}
+Below are some common frontend test commands:
+
+<Tabs>
+ <TabItem label="Make">
+ ```bash
+ # From the repository root, run the frontend test suite once.
+ make frontend-test
+ ```
+ </TabItem>
+ <TabItem label="pnpm">
+ ```bash
+ # From the repository root, run the full frontend test suite in watch mode.
+ pnpm --dir invokeai/frontend/web test
+
+ # Run the frontend test suite once without watch mode.
+ pnpm --dir invokeai/frontend/web test:no-watch
+
+ # Equivalent one-shot command using the underlying Vitest subcommand.
+ pnpm --dir invokeai/frontend/web test:run
+
+ # Open the Vitest UI and collect coverage data while running tests.
+ pnpm --dir invokeai/frontend/web test:ui
+ ```
+ </TabItem>
+</Tabs>
+
+If you are already working from `invokeai/frontend/web`, you can omit the `--dir` flag and run the same `pnpm` scripts directly from that directory.
## Backend Tests
@@ -27,6 +55,9 @@ As a rule of thumb, tests should be marked as 'slow' if there is a chance that t
Below are some common test commands:
```bash
+# Run the fast tests from the repository root using the Makefile shortcut.
+make test
+
# Run the fast tests. (This implicitly uses the configured default option: `-m "not slow"`.)
pytest tests/
@@ -45,9 +76,7 @@ pytest tests -m ""
### Test Organization
-All backend tests are in the [`tests/`](https://github.com/invoke-ai/InvokeAI/tree/main/tests) directory. This directory mirrors the organization of the `invokeai/` directory. For example, tests for `invokeai/model_management/model_manager.py` would be found in `tests/model_management/test_model_manager.py`.
-
-TODO: The above statement is aspirational. A re-organization of legacy tests is required to make it true.
+Most backend tests live in the [`tests/`](https://github.com/invoke-ai/InvokeAI/tree/main/tests) directory. When adding a new backend test, prefer keeping it near the corresponding module area so related code and tests stay easy to find together.
### Tests that depend on models