Skip to content

Commit

Permalink
docs(CONTRIBUTING): add testing guidelines and example structure
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
joshmu committed Dec 27, 2024
1 parent d73f77c commit 6636e1c
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,34 @@ To get started with contributing, please follow these steps:
5. Commit your changes and push them to your forked repository.
6. Open a pull request to the main repository.

### Running Tests

The project uses Mocha for testing. To run the test suite:

1. Run all tests: `npm test`
2. Run specific test file: `npm test -- path/to/test`

When writing tests:

- Place test files in `src/test/suite/`
- Use the naming convention `*.test.ts`
- Group related tests using `suite()` and `test()`
- Keep tests focused and simple
- Mock external dependencies
- Use descriptive test names that explain the expected behavior

Example test structure:

```typescript
suite('Feature Name', () => {
test('should handle specific case', async () => {
// Arrange
// Act
// Assert
});
});
```

### Running the extension

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

0 comments on commit 6636e1c

Please sign in to comment.