From 8a818ce0f30654eba854759e6409c0ac856fc448 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Weslley=20Ara=C3=BAjo?= <46850407+wellwelwel@users.noreply.github.com> Date: Mon, 8 Apr 2024 07:01:36 -0300 Subject: [PATCH] fix(docs): improve the contribution guidelines (#2552) * ci(coverage): improve c8 configs * docs: improve Contribute.md * ci: exclude dirs from c8 coverage * ci: adapt c8 limits * ci: adapt Codecov limits * docs: fix typo --- .nycrc | 12 ++++++++++++ Contributing.md | 51 ++++++++++++++++++++++++++++++++++++++++++++++++- codecov.yml | 2 +- package.json | 2 +- 4 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 .nycrc diff --git a/.nycrc b/.nycrc new file mode 100644 index 0000000000..04e485a286 --- /dev/null +++ b/.nycrc @@ -0,0 +1,12 @@ +{ + "all": true, + "include": ["index.js", "promise.js", "lib/**/*.js"], + "exclude": ["mysqldata/**", "node_modules/**", "test/**"], + "reporter": ["text", "lcov", "cobertura"], + "statements": 88, + "branches": 84, + "functions": 78, + "lines": 88, + "checkCoverage": true, + "clean": true +} diff --git a/Contributing.md b/Contributing.md index 09f1a23598..5e518c3248 100644 --- a/Contributing.md +++ b/Contributing.md @@ -16,6 +16,8 @@ Contributions are always welcomed. You can help **MySQL2** community in various - Performance improvements - Add Features +--- + ## Security Issues Please contact project maintainers privately before opening a security issue on Github. It will allow us to fix the issue before attackers know about it. @@ -24,10 +26,14 @@ Please contact project maintainers privately before opening a security issue on - Andrey Sidorov, sidorares@yandex.ru +--- + ## New Features It's better to discuss an API before actually start implementing it. You can open an issue on Github. We can discuss design of API and implementation ideas. +--- + ## Development We assume you already have these tools installed on your system: @@ -35,7 +41,7 @@ We assume you already have these tools installed on your system: - MySQL Server - Node.JS -As **MySQL2** is purely JS based you can develop it on Linux, Mac or Windows. Please follow these steps +As **MySQL2** is purely JS based, you can develop it on Linux, Mac or Windows. Please follow these steps ```bash # clone node-mysql2 @@ -47,6 +53,40 @@ cd /path/to/node-mysql2 npm install ``` +--- + +### Commits and Pull Request Titles + +To ensure a clean commit history pattern, please use the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/#summary) format. + +Prefixes that will trigger a new release version: + +- `fix:` for patches, e.g., bug fixes that result in a patch version release. +- `feat:` for new features, e.g., additions that result in a minor version release. + +Examples: + +- `fix: message` +- `feat: message` +- `docs: message` +- `fix(module): message` +- `feat(module): message` +- etc. + +--- + +### Including Tests + +#### Fixes + +Where possible, provide an error test case that your fix covers. + +#### Features + +Please ensure test cases to cover your features. + +--- + ### Running Tests Running tests requires MySQL server and an empty database. You can run `bash` command given below to create `test` database @@ -77,3 +117,12 @@ FILTER='test-timestamp' npm run test # or FILTER='timeout' npm run test ``` + +> [!Tip] +> You can also run a single test by performing `node ./test/path-to-test-file`. + +For testing **coverage**: + +```bash +npm run coverage-test +``` diff --git a/codecov.yml b/codecov.yml index 2b795e8182..8a62c2de07 100644 --- a/codecov.yml +++ b/codecov.yml @@ -2,5 +2,5 @@ coverage: status: project: default: - target: 90% + target: 89% threshold: 2% diff --git a/package.json b/package.json index 329e194bf6..9e9a21b593 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "test": "poku --debug --include=\"test/esm,test/unit,test/integration\"", "test:bun": "poku --debug --platform=\"bun\" --include=\"test/esm,test/unit,test/integration\"", "test:tsc-build": "cd \"test/tsc-build\" && npx tsc -p \"tsconfig.json\"", - "coverage-test": "c8 -r cobertura -r lcov -r text npm run test", + "coverage-test": "c8 npm run test", "benchmark": "node ./benchmarks/benchmark.js", "prettier": "prettier --single-quote --trailing-comma none --write \"{lib,test}/**/*.js\"", "prettier:docs": "prettier --single-quote --trailing-comma none --write README.md",