Skip to content

Commit 3a60185

Browse files
Add testing documentation guides for frontend tests (#3927)
1 parent 4c92a71 commit 3a60185

File tree

4 files changed

+946
-0
lines changed

4 files changed

+946
-0
lines changed

tests-ui/README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# ComfyUI Frontend Testing Guide
2+
3+
This guide provides an overview of testing approaches used in the ComfyUI Frontend codebase. These guides are meant to document any particularities or nuances of writing tests in this codebase, rather than being a comprehensive guide to testing in general. By reading these guides first, you may save yourself some time when encountering issues.
4+
5+
## Testing Documentation
6+
7+
Documentation for unit tests is organized into three guides:
8+
9+
- [Component Testing](./component-testing.md) - How to test Vue components
10+
- [Unit Testing](./unit-testing.md) - How to test utility functions, composables, and other non-component code
11+
- [Store Testing](./store-testing.md) - How to test Pinia stores specifically
12+
13+
## Testing Structure
14+
15+
The ComfyUI Frontend project uses a mixed approach to unit test organization:
16+
17+
- **Component Tests**: Located directly alongside their components with a `.spec.ts` extension
18+
- **Unit Tests**: Located in the `tests-ui/tests/` directory
19+
- **Store Tests**: Located in the `tests-ui/tests/store/` directory
20+
- **Browser Tests**: These are located in the `browser_tests/` directory. There is a dedicated README in the `browser_tests/` directory, so it will not be covered here.
21+
22+
## Test Frameworks and Libraries
23+
24+
Our tests use the following frameworks and libraries:
25+
26+
- [Vitest](https://vitest.dev/) - Test runner and assertion library
27+
- [@vue/test-utils](https://test-utils.vuejs.org/) - Vue component testing utilities
28+
- [Pinia](https://pinia.vuejs.org/cookbook/testing.html) - For store testing
29+
30+
## Getting Started
31+
32+
To run the tests locally:
33+
34+
```bash
35+
# Run unit tests
36+
npm run test:unit
37+
38+
# Run unit tests in watch mode
39+
npm run test:unit:dev
40+
41+
# Run component tests with browser-native environment
42+
npm run test:component
43+
```
44+
45+
Refer to the specific guides for more detailed information on each testing type.

0 commit comments

Comments
 (0)