Skip to content

Commit 8589819

Browse files
committed
docs: enhance contributing guidelines with detailed installation and testing instructions
1 parent 090fef3 commit 8589819

1 file changed

Lines changed: 104 additions & 17 deletions

File tree

CONTRIBUTING.md

Lines changed: 104 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,36 +10,123 @@ Contributions to twd-js should be made in the form of GitHub pull requests. Each
1010

1111
## Getting Started
1212

13-
twd-js's [open issues are here](https://github.com/BRIKEV/twd/issues).
13+
### Installation
1414

15-
You can clone this repository and run this command to start using developing this package.
15+
1. **Fork and clone the repository:**
16+
```bash
17+
git clone https://github.com/YOUR_USERNAME/twd.git
18+
cd twd
19+
```
1620

17-
```
18-
npm install
19-
```
21+
2. **Install dependencies:**
22+
```bash
23+
npm install
24+
```
2025

21-
If you want to test it you can add a new test in [this folder](https://github.com/BRIKEV/twd/tree/main/test) or you can create a new example [here](https://github.com/BRIKEV/twd/tree/main/examples).
26+
### Running Tests
2227

23-
To execute package's tests you have run this command:
28+
To run the test suite for the TWD library itself:
2429

25-
```
30+
```bash
2631
npm test
2732
```
2833

29-
## Pull Request Checklist
34+
This will run all unit tests using Vitest. You can also run tests in watch mode:
35+
36+
```bash
37+
npm test -- --watch
38+
```
39+
40+
### Testing New Features
41+
42+
When developing new features or fixing bugs, it's important to test them in a real application environment. We use the **`twd-test-app`** example project for this purpose.
43+
44+
The `twd-test-app` is a basic Vite + React application located in `examples/twd-test-app/`. It's set up to use the local development version of TWD, making it perfect for testing new features.
45+
46+
**To test your changes with twd-test-app:**
47+
48+
1. **Navigate to the test app:**
49+
```bash
50+
cd examples/twd-test-app
51+
```
52+
53+
2. **Install dependencies (if not already done):**
54+
```bash
55+
npm install
56+
```
57+
58+
3. **Run the test app:**
59+
```bash
60+
npm run dev
61+
```
62+
63+
The test app is already configured to import TWD directly from the source code using relative paths (`../../../src/index.ts`), so you don't need to build or link anything. Any changes you make to the TWD source will be immediately available when you refresh the browser.
64+
65+
4. **Write test cases:**
66+
Create or modify test files in `examples/twd-test-app/src/twd-tests/` with the `.twd.test.ts` extension to test your new features. The test files already import from the source:
67+
```typescript
68+
import { twd, userEvent } from "../../../../src";
69+
import { describe, it } from "../../../../src/runner";
70+
```
71+
72+
5. **Verify in the browser:**
73+
Open the app in your browser (usually `http://localhost:5173`) and use the TWD sidebar to run your tests and verify everything works as expected.
74+
75+
This workflow allows you to:
76+
- Test new features in a real application context
77+
- Verify the UI and user experience
78+
- Ensure API mocking works correctly
79+
- Test edge cases and user interactions
80+
81+
### Finding Issues to Work On
82+
83+
twd-js's [open issues are here](https://github.com/BRIKEV/twd/issues). Look for issues labeled `good first issue` if you're new to the project.
84+
85+
## Submitting Changes
86+
87+
### Before Submitting
88+
89+
- Make sure all tests pass: `npm test`
90+
- Build the project successfully: `npm run build`
91+
- Test your changes in `twd-test-app` to ensure they work in a real application
92+
- Update documentation if your changes affect the public API
93+
- Follow the existing code style and conventions
94+
95+
### Pull Request Checklist
96+
97+
- [Check validations](https://github.com/BRIKEV/twd/actions) should pass. This includes linting and testing.
98+
99+
- **Tests are required**: All pull requests must include tests. Pull requests without tests will not be reviewed. See the [Pull Request Template](.github/pull_request_template.md) for details.
100+
101+
- **Documentation updates**: If your change affects the public API or adds new features, documentation updates are required.
102+
103+
- Commits should be as small as possible, while ensuring that each commit is correct independently (i.e., each commit should compile and pass tests).
104+
105+
- If your patch is not getting reviewed or you need a specific person to review it, you can @-reply a reviewer asking for a review in the pull request or a comment.
106+
107+
### Reporting Issues
108+
109+
Before reporting an issue, please check the [existing issues](https://github.com/BRIKEV/twd/issues) to see if it's already been reported.
110+
111+
When creating a bug report, please use the [Bug Report Template](.github/ISSUE_TEMPLATE/bug_report.md) and include:
112+
- Complete environment information (framework, Node version, browser, etc.)
113+
- Full test code that reproduces the issue
114+
- Screenshots if applicable
115+
- Steps to reproduce
30116

31-
- [Check validations](https://github.com/BRIKEV/twd/actions?query=workflow%3ABuild) should pass. This one includes linting and testing.
117+
For feature requests, use the [Feature Request Template](.github/ISSUE_TEMPLATE/feature_request.md).
32118

33-
- Commits should be as small as possible, while ensuring that each commit is
34-
correct independently (i.e., each commit should compile and pass tests).
35119

36-
- If your patch is not getting reviewed or you need a specific person to review
37-
it, you can @-reply a reviewer asking for a review in the pull request or a
38-
comment.
120+
## Code Style
39121

122+
- Follow the existing TypeScript/React patterns in the codebase
123+
- Use meaningful variable and function names
124+
- Add comments for complex logic
125+
- Keep functions focused and small
126+
- Write self-documenting code when possible
40127

41128
## Conduct
42129

43-
We follow the [twd-js Code of Conduct](https://github.com/BRIKEV/twd/blob/main/CODE_OF_CONDUCT.md).
130+
We follow the [twd-js Code of Conduct](CODE_OF_CONDUCT.md).
44131

45-
All code in this repository is under [MIT License](https://github.com/BRIKEV/twd/blob/main/LICENSE.md).
132+
All code in this repository is under [MIT License](LICENSE).

0 commit comments

Comments
 (0)