Skip to content

Commit 6636e1c

Browse files
committed
docs(CONTRIBUTING): add testing guidelines and example structure
- Introduced a new section on running tests using Mocha, detailing commands for executing the test suite and specific test files. - Provided guidelines for writing tests, including file placement, naming conventions, and best practices for structuring tests. - Included an example test structure to illustrate the recommended approach for organizing test cases. These additions enhance the documentation for contributors, ensuring clarity on testing practices and improving overall project maintainability.
1 parent d73f77c commit 6636e1c

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

CONTRIBUTING.md

+28
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,34 @@ To get started with contributing, please follow these steps:
2121
5. Commit your changes and push them to your forked repository.
2222
6. Open a pull request to the main repository.
2323

24+
### Running Tests
25+
26+
The project uses Mocha for testing. To run the test suite:
27+
28+
1. Run all tests: `npm test`
29+
2. Run specific test file: `npm test -- path/to/test`
30+
31+
When writing tests:
32+
33+
- Place test files in `src/test/suite/`
34+
- Use the naming convention `*.test.ts`
35+
- Group related tests using `suite()` and `test()`
36+
- Keep tests focused and simple
37+
- Mock external dependencies
38+
- Use descriptive test names that explain the expected behavior
39+
40+
Example test structure:
41+
42+
```typescript
43+
suite('Feature Name', () => {
44+
test('should handle specific case', async () => {
45+
// Arrange
46+
// Act
47+
// Assert
48+
});
49+
});
50+
```
51+
2452
### Running the extension
2553

2654
Open the extension project in VS Code (e.g. by running `code .` in the project folder).

0 commit comments

Comments
 (0)