feat: add frontend unit test framework (#6426)
This commit is contained in:
@@ -74,6 +74,25 @@ npm run start --port=3001 --host=0.0.0.0
|
||||
|
||||
If your IDE is VSCode, rename `web/.vscode/settings.example.json` to `web/.vscode/settings.json` for lint code setting.
|
||||
|
||||
## Test
|
||||
|
||||
We start to use [Jest](https://jestjs.io/) and [React Testing Library](https://testing-library.com/docs/react-testing-library/intro/) for Unit Testing.
|
||||
|
||||
You can create a test file with a suffix of `.spec` beside the file that to be tested. For example, if you want to test a file named `util.ts`. The test file name should be `util.spec.ts`.
|
||||
|
||||
Run test:
|
||||
|
||||
```bash
|
||||
npm run test
|
||||
```
|
||||
|
||||
If you are not familiar with writing tests, here is some code to refer to:
|
||||
* [classnames.spec.ts](./utils/classnames.spec.ts)
|
||||
* [index.spec.tsx](./app/components/base/button/index.spec.tsx)
|
||||
|
||||
|
||||
|
||||
|
||||
## Documentation
|
||||
|
||||
Visit <https://docs.dify.ai/getting-started/readme> to view the full documentation.
|
||||
|
Reference in New Issue
Block a user