Skip to content

Commit c91ac8d

Browse files
dhensbyCopilot
andcommitted
docs: add CONTRIBUTING.md
Document how to report issues, set up a development environment, run the test suites, follow the StandardJS and Conventional Commits conventions, and submit pull requests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 331231a commit c91ac8d

1 file changed

Lines changed: 94 additions & 0 deletions

File tree

CONTRIBUTING.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Contributing to node-mssql
2+
3+
Thanks for your interest in contributing to `node-mssql`! This project is community-maintained, and contributions of all kinds — bug reports, documentation, and code — are welcome.
4+
5+
This guide covers how to report issues, set up a development environment, and submit changes that fit the project's conventions.
6+
7+
## Reporting Issues
8+
9+
### Security vulnerabilities
10+
11+
**Do not** open public issues for security vulnerabilities. Please follow our [Security Policy](SECURITY.md) and report them privately instead.
12+
13+
### Bugs
14+
15+
Before opening a bug report, please search [existing issues](https://github.com/tediousjs/node-mssql/issues) to avoid duplicates. When you open a new issue, the issue template will ask for the information maintainers need to triage it effectively, including:
16+
17+
- Expected and actual behaviour, with relevant SQL and schema where possible.
18+
- A minimal, reproducible example.
19+
- Software versions: Node.js, `mssql`, and SQL Server.
20+
21+
### Feature requests
22+
23+
Feature requests are welcome — please open an issue describing the use case and the problem you are trying to solve, rather than only a proposed implementation.
24+
25+
## Development Setup
26+
27+
1. Fork and clone the repository.
28+
2. Ensure you are running a supported Node.js version. The project requires **Node.js >= 18.19.0** (see the `engines` field in `package.json`).
29+
3. Install dependencies:
30+
31+
```bash
32+
npm install
33+
```
34+
35+
### Running the tests
36+
37+
| Command | Description |
38+
| ------- | ----------- |
39+
| `npm test` | Runs the linter (StandardJS) followed by the unit tests. This is the baseline check that must pass. |
40+
| `npm run lint` | Runs StandardJS only. |
41+
| `npm run test-unit` | Runs the unit tests only. No database required. |
42+
| `npm run test-tedious` | Runs the integration tests against a live SQL Server using the `tedious` driver. |
43+
| `npm run test-msnodesqlv8` | Runs the integration tests using the `msnodesqlv8` driver. |
44+
| `npm run test-cli` | Runs the CLI tool tests. |
45+
46+
To run a single unit test by name:
47+
48+
```bash
49+
npx mocha --exit -t 15000 --grep "test name" test/common/unit.js
50+
```
51+
52+
### Integration tests
53+
54+
The integration tests require a running SQL Server instance configured in `test/.mssql.json` (see `.devcontainer/.mssql.json` for the expected shape). The included [dev container](https://containers.dev/) sets up both Node.js and SQL Server via Docker Compose, which is the easiest way to run the full suite locally.
55+
56+
Unit tests (`npm run test-unit`) do **not** require a database, so you can develop and validate most changes without a SQL Server instance.
57+
58+
## Coding Standards
59+
60+
- **Style:** The project uses [StandardJS](https://standardjs.com/) — no semicolons, 2-space indentation, single quotes. There is no config file or override; run `npm run lint` to check your work, and `npx standard --fix` to auto-fix many issues.
61+
- **Driver-agnostic design:** Shared, public API lives in `lib/base/`; driver-specific implementations live in `lib/tedious/` and `lib/msnodesqlv8/` and override private methods prefixed with an underscore (e.g. `_poolCreate`, `_executeQuery`).
62+
- **Dual API:** Async methods should support both Promises and callbacks.
63+
- **Tests:** Add or update tests for any behavioural change. Unit tests go in `test/common/unit.js`; integration tests are added to the shared factory in `test/common/tests.js` so they run against every driver.
64+
65+
## Commit Messages
66+
67+
Commit messages **must** follow the [Conventional Commits](https://www.conventionalcommits.org/) specification. This is enforced by commitlint, and [semantic-release](https://semantic-release.gitbook.io/) uses these messages to automate versioning and changelog generation — so using the correct type matters.
68+
69+
| Type | When to use it | Release impact |
70+
| ---- | -------------- | -------------- |
71+
| `fix` | Bug fixes or behavioural corrections that don't change the public interface | **patch** |
72+
| `feat` | New backwards-compatible functionality | **minor** |
73+
| `feat!` (or any type with `!`, or a `BREAKING CHANGE:` footer) | Changes that require consumers to update their code | **major** |
74+
| `chore` | Dependency updates, tooling, housekeeping | none |
75+
| `ci` | CI pipeline or workflow configuration changes | none |
76+
| `docs` | Documentation-only changes | none |
77+
| `style` | Formatting or stylistic changes that don't affect behaviour | none |
78+
| `refactor` | Code changes that neither fix a bug nor add a feature | none |
79+
| `test` | Changes that only touch tests | none |
80+
81+
Only `fix` and `feat` trigger a release. If a change needs to be released but doesn't neatly fit either, choose whichever is most appropriate to ensure a release is created.
82+
83+
## Pull Requests
84+
85+
- **Branch from an up-to-date `master`.** All changes go through a pull request — there are no direct commits to `master`.
86+
- **Keep commits atomic.** Each commit should be a self-contained, deployable change with linting, commitlint, and tests passing. Don't mix unrelated changes (e.g. a bug fix and a documentation tweak) in one commit.
87+
- **Keep your branch current by rebasing** onto `master` rather than merging `master` into your branch.
88+
- **PRs are merged with a merge commit** (no squash or rebase merge), so each commit in your PR is preserved in history. Please keep that history clean.
89+
- Fill out the pull request template, link any related issues, and update the changelog where applicable.
90+
- Make sure `npm test` passes before requesting review.
91+
92+
For additional background, see the [Contributing page on the project wiki](https://github.com/tediousjs/node-mssql/wiki/Contributing).
93+
94+
Thanks again for contributing!

0 commit comments

Comments
 (0)