Add coverage run with thresholds and align tests to utils

main
Peter Steinberger 2025-11-24 17:51:18 +01:00
parent 343ef9b63d
commit 5ee4f3219d
2 changed files with 27 additions and 6 deletions

View File

@ -20,7 +20,8 @@
"lint:fix": "biome check --write src", "lint:fix": "biome check --write src",
"format": "biome format src", "format": "biome format src",
"format:fix": "biome format src --write", "format:fix": "biome format src --write",
"test": "vitest" "test": "vitest",
"test:coverage": "vitest run --coverage"
}, },
"keywords": [], "keywords": [],
"author": "", "author": "",
@ -30,28 +31,48 @@
}, },
"packageManager": "pnpm@10.23.0", "packageManager": "pnpm@10.23.0",
"dependencies": { "dependencies": {
"baileys": "^7.0.0-rc.9",
"body-parser": "^2.2.0", "body-parser": "^2.2.0",
"chalk": "^5.6.2", "chalk": "^5.6.2",
"commander": "^14.0.2", "commander": "^14.0.2",
"dotenv": "^17.2.3", "dotenv": "^17.2.3",
"express": "^5.1.0", "express": "^5.1.0",
"json5": "^2.2.3", "json5": "^2.2.3",
"qrcode-terminal": "^0.12.0",
"twilio": "^5.10.6",
"pino": "^10.1.0", "pino": "^10.1.0",
"baileys": "^7.0.0-rc.9" "qrcode-terminal": "^0.12.0",
"twilio": "^5.10.6"
}, },
"devDependencies": { "devDependencies": {
"@biomejs/biome": "^2.3.7", "@biomejs/biome": "^2.3.7",
"@types/body-parser": "^1.19.6", "@types/body-parser": "^1.19.6",
"@types/qrcode-terminal": "^0.12.2",
"@types/express": "^5.0.5", "@types/express": "^5.0.5",
"@types/node": "^24.10.1", "@types/node": "^24.10.1",
"@types/qrcode-terminal": "^0.12.2",
"@vitest/coverage-v8": "^4.0.13",
"tsx": "^4.20.6", "tsx": "^4.20.6",
"typescript": "^5.9.3", "typescript": "^5.9.3",
"vitest": "^4.0.13" "vitest": "^4.0.13"
}, },
"vitest": { "vitest": {
"coverage": {
"provider": "v8",
"reporter": [
"text",
"lcov"
],
"thresholds": {
"lines": 70,
"functions": 70,
"branches": 70,
"statements": 70
},
"include": [
"src/utils.ts"
],
"exclude": [
"src/**/*.test.ts"
]
},
"exclude": [ "exclude": [
"dist/**" "dist/**"
] ]

View File

@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest"; import { describe, expect, it } from "vitest";
import { assertProvider, normalizeE164, toWhatsappJid } from "./index.js"; import { assertProvider, normalizeE164, toWhatsappJid } from "./utils.js";
describe("normalizeE164", () => { describe("normalizeE164", () => {
it("strips whatsapp: prefix and whitespace", () => { it("strips whatsapp: prefix and whitespace", () => {