From f943f07df1df21740882bfe782ed3c18786118f3 Mon Sep 17 00:00:00 2001 From: wellwelwel <46850407+wellwelwel@users.noreply.github.com> Date: Tue, 2 Apr 2024 12:22:19 -0300 Subject: [PATCH 1/6] ci(coverage): improve c8 configs --- .nycrc | 11 +++++++++++ package.json | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 .nycrc diff --git a/.nycrc b/.nycrc new file mode 100644 index 0000000000..a564567a0b --- /dev/null +++ b/.nycrc @@ -0,0 +1,11 @@ +{ + "all": true, + "include": ["index.js", "promise.js", "lib/**"], + "reporter": ["text", "lcov", "cobertura"], + "statements": 88, + "branches": 84, + "functions": 79, + "lines": 88, + "checkCoverage": true, + "clean": true +} 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", From 9247a0debed75545ca5060ad3726a164d30de01c Mon Sep 17 00:00:00 2001 From: wellwelwel <46850407+wellwelwel@users.noreply.github.com> Date: Tue, 2 Apr 2024 13:00:02 -0300 Subject: [PATCH 2/6] docs: improve Contribute.md --- Contributing.md | 51 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/Contributing.md b/Contributing.md index 09f1a23598..26c7724830 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. + +#### Fixes + +Please ensure test cases to cover your feature. + +--- + ### 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 +``` From d47bedad3003f4308925938bb2b8daa2628046bb Mon Sep 17 00:00:00 2001 From: wellwelwel <46850407+wellwelwel@users.noreply.github.com> Date: Tue, 2 Apr 2024 13:49:27 -0300 Subject: [PATCH 3/6] ci: exclude dirs from c8 coverage --- .nycrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.nycrc b/.nycrc index a564567a0b..e4ce34e819 100644 --- a/.nycrc +++ b/.nycrc @@ -1,6 +1,7 @@ { "all": true, - "include": ["index.js", "promise.js", "lib/**"], + "include": ["index.js", "promise.js", "lib/**/*.js"], + "exclude": ["mysqldata/**", "node_modules/**", "test/**"], "reporter": ["text", "lcov", "cobertura"], "statements": 88, "branches": 84, From b1268415e58cc43d622d7c48d49e9b545180f906 Mon Sep 17 00:00:00 2001 From: wellwelwel <46850407+wellwelwel@users.noreply.github.com> Date: Tue, 2 Apr 2024 13:56:55 -0300 Subject: [PATCH 4/6] ci: adapt c8 limits --- .nycrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.nycrc b/.nycrc index e4ce34e819..04e485a286 100644 --- a/.nycrc +++ b/.nycrc @@ -5,7 +5,7 @@ "reporter": ["text", "lcov", "cobertura"], "statements": 88, "branches": 84, - "functions": 79, + "functions": 78, "lines": 88, "checkCoverage": true, "clean": true From 83f60beb90ed61cee2f89c452976eefc8cebf80f Mon Sep 17 00:00:00 2001 From: wellwelwel <46850407+wellwelwel@users.noreply.github.com> Date: Tue, 2 Apr 2024 14:12:52 -0300 Subject: [PATCH 5/6] ci: adapt Codecov limits --- codecov.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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% From 519169cb1bb7e6447931edea2c421fe78077a480 Mon Sep 17 00:00:00 2001 From: wellwelwel <46850407+wellwelwel@users.noreply.github.com> Date: Tue, 2 Apr 2024 14:35:52 -0300 Subject: [PATCH 6/6] docs: fix typo --- Contributing.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Contributing.md b/Contributing.md index 26c7724830..5e518c3248 100644 --- a/Contributing.md +++ b/Contributing.md @@ -81,9 +81,9 @@ Examples: Where possible, provide an error test case that your fix covers. -#### Fixes +#### Features -Please ensure test cases to cover your feature. +Please ensure test cases to cover your features. ---