Thank you for your interest in contributing to coveralls-next! This document provides guidelines and instructions for contributing.
- Code of Conduct
- Getting Started
- Development Setup
- Project Structure
- Coding Standards
- Testing
- Submitting Changes
- Reporting Issues
By participating in this project, you agree to maintain a respectful and inclusive environment for all contributors.
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/coveralls-next.git cd coveralls-next - Add the upstream remote:
git remote add upstream https://github.com/nickmerwin/coveralls-next.git
- Node.js 18.x or higher
- npm 8.x or higher
- Git
# Install dependencies
npm install
# Run tests to verify setup
npm test
# Run tests with coverage
npm run test-covcoveralls-next/
├── bin/
│ └── coveralls.js # CLI entry point
├── lib/
│ ├── convertLcovToCoveralls.js # LCOV to Coveralls format conversion
│ ├── detectLocalGit.js # Local git repository detection
│ ├── fetchGitData.js # Git metadata extraction
│ ├── getOptions.js # Configuration and options parsing
│ ├── handleInput.js # Input processing orchestration
│ ├── logger.js # Logging utility
│ └── sendToCoveralls.js # API communication
├── test/ # Test files (mirror lib/ structure)
└── index.js # Main entry point
- JavaScript Standard: We follow Node.js best practices
- Indentation: 2 spaces (no tabs)
- Quotes: Single quotes for strings
- Semicolons: Required
- Line Length: Max 100 characters when reasonable
# Check code style
npm run lint
# Auto-fix style issues
npm run lint -- --fix- Add JSDoc comments for all exported functions
- Include descriptions, parameter types, return types, and error conditions
- Update README.md if adding new features or changing behavior
Example:
/**
* Converts LCOV coverage data to Coveralls format
* @param {string} input - LCOV format string or file path
* @param {Object} options - Configuration options
* @param {Function} callback - Callback function (err, coverallsData)
* @throws {Error} If input is invalid or file cannot be read
*/
function convertLcovToCoveralls(input, options, callback) {
// ...
}# Run all tests
npm test
# Run tests with coverage
npm run test-cov
# Run only mocha tests (skip linting)
npm run mocha
# Run tests in watch mode (requires npm install --save-dev mocha)
npx mocha --watch- Place test files in
test/directory - Name test files to match source files (e.g.,
lib/foo.js→test/foo.js) - Use the
shouldassertion library (already included) - Use
proxyquirefor mocking modules - Aim for 100% code coverage
Example test structure:
'use strict';
const should = require('should');
const proxyquire = require('proxyquire');
const myModule = require('../lib/myModule');
describe('myModule', () => {
beforeEach(() => {
// Setup
});
afterEach(() => {
// Cleanup
});
it('should do something specific', done => {
myModule.doSomething((err, result) => {
should.not.exist(err);
result.should.equal('expected');
done();
});
});
});- All new code must have tests
- Maintain 100% coverage (statements, branches, functions, lines)
- Run
npm run test-covbefore submitting PR
- Update tests: Add or modify tests for your changes
- Run tests: Ensure all tests pass (
npm test) - Check coverage: Verify 100% coverage (
npm run test-cov) - Lint code: Fix any linting issues (
npm run lint) - Update docs: Modify README.md or JSDoc as needed
- Commit message: Write clear, descriptive commit messages
Use conventional commit format:
type(scope): subject
body
footer
Types:
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, etc.)refactor: Code refactoringtest: Adding or updating testschore: Maintenance tasks
Example:
feat(retry): add exponential backoff for network failures
Implements retry logic with exponential backoff (max 3 attempts)
for 5xx errors when sending coverage data to Coveralls API.
Closes #123
-
Update your fork:
git fetch upstream git checkout master git merge upstream/master
-
Create a feature branch:
git checkout -b feature/my-feature
-
Make your changes and commit them
-
Push to your fork:
git push origin feature/my-feature
-
Open a Pull Request on GitHub with:
- Clear title and description
- Reference any related issues
- Screenshots/examples if applicable
- Checklist of changes made
-
Respond to feedback: Address review comments promptly
- Tests added/updated and passing
- Code coverage maintained at 100%
- Linting passes without errors
- Documentation updated (README, JSDoc)
- Commit messages follow conventional format
- Branch is up to date with master
- No merge conflicts
When reporting bugs, please include:
- Description: Clear description of the issue
- Steps to Reproduce: Minimal steps to reproduce the problem
- Expected Behavior: What you expected to happen
- Actual Behavior: What actually happened
- Environment:
- Node.js version (
node --version) - npm version (
npm --version) - Operating system
- CI environment (if applicable)
- Node.js version (
- Logs: Relevant error messages or logs
- Sample Code: Minimal reproducible example if possible
When requesting features, please include:
- Description: Clear description of the feature
- Use Case: Why this feature would be useful
- Proposed Solution: How you envision it working
- Alternatives: Other solutions you've considered
Enable debug logging:
export NODE_COVERALLS_DEBUG=1
# or
node --inspect bin/coveralls.js# Generate coverage for this project
npm run test-cov
# Send to Coveralls (requires COVERALLS_REPO_TOKEN)
cat coverage/lcov.info | node bin/coveralls.js# Test git-related functionality
node -e "require('./lib/fetchGitData')({head: {id: 'HEAD'}}, console.log)"- Open an issue for questions about contributing
- Check existing issues and PRs for similar questions
- Review the README.md for usage documentation
By contributing, you agree that your contributions will be licensed under the project's existing license (BSD-2-Clause).
Thank you for contributing to coveralls-next!