Thank you for your interest in contributing to Debounced! This guide will help you get started.
- Fork and clone the repository
- Install dependencies:
npm install - Install Playwright browsers:
npx playwright install - Build the library:
npm run build - Run tests:
npm test
npm test # Run all tests headlessly
npm run test:ui # Open Playwright UI for debuggingnpm run format # Format code with Prettier
npm run lint # Check formatting without modifying filesnpm run build # Format and build the distribution file- Fork the repository and create a new branch from
main - Make your changes and ensure all tests pass
- Format your code with
npm run format - Update the README if you've added new features
- Create a pull request with a clear description of changes
When you open a pull request, GitHub Actions will automatically:
- ✅ Check code formatting
- ✅ Run tests across Node.js 18 and 20
- ✅ Test on Chromium, Firefox, and WebKit browsers
- ✅ Report bundle size changes
- ✅ Upload test results as artifacts
- Tests pass: All existing tests must continue to pass
- New features have tests: Add tests for any new functionality
- Code style matches: Use Prettier formatting
- Documentation updated: Update README for API changes
- Version sync: Keep
package.jsonandsrc/version.jsin sync
Our test suite includes 204 tests covering:
- All 113 unique native DOM events
- Custom event registration
- Leading/trailing debounce modes
- Event delegation and bubbling
- Cross-browser compatibility
- Edge cases and error handling
Tests use Playwright and Node's built-in assert module:
test('description', async ({page}) => {
await page.goto('/test/index.html')
// Your test logic here
assert.strictEqual(actual, expected, 'Error message')
})Releases are automated through GitHub Actions when a new release is created on GitHub:
- Tests run to ensure everything passes
- Version consistency is verified
- Library is built and published to npm
Feel free to open an issue if you have questions or need help getting started!