feat: Phase 1 — Add test coverage, linting, and code quality tooling (c8, ESLint, Prettier)
Node tests / test (push) Has been cancelled
Node tests / test (push) Has been cancelled
## Summary - Install c8 (coverage), ESLint, and Prettier as devDependencies - Add .eslintrc.json with Node.js/async-safe rules - Add .prettierrc.json for code formatting consistency - Add .nycrc.json with 80% coverage targets for statements/lines/functions, 75% for branches - Update npm test script to use c8 for coverage reporting (generates HTML + text reports) - Add lint, lint:fix, and format npm scripts ## Baseline Coverage Initial run shows 26.4% line coverage, well below 80% target. Modules with 0% coverage: - src/index.js (main entry point) - src/crawler/* (RSS, scraper, X/Twitter crawlers) - src/publisher/wordpress.js (WordPress integration) - src/listener/* (RSS listener) - src/writer/ai.js (AI news writing) These are high-risk modules that need test expansion per BIT-2861. Implements BIT-2837 Phase 1 per plan. Paperclip-Run-Id: fb08becb-e019-4cb3-ae50-fb72a4b11745
This commit is contained in:
1 parent
3727e11129
commit
67563bb6d0
5 files changed
+1742
-3
No files matched your search
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"env": {
|
||||
"node": true,
|
||||
"es2021": true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": "latest",
|
||||
"sourceType": "module"
|
||||
},
|
||||
"rules": {
|
||||
"no-console": "warn",
|
||||
"no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
|
||||
"prefer-const": "error",
|
||||
"no-var": "error",
|
||||
"eqeqeq": ["error", "always"],
|
||||
"semi": ["error", "always"],
|
||||
"quotes": ["error", "single", { "avoidEscape": true }],
|
||||
"indent": ["error", 2],
|
||||
"comma-dangle": ["error", "never"],
|
||||
"no-trailing-spaces": "error",
|
||||
"keyword-spacing": "error",
|
||||
"space-before-function-paren": ["error", { "anonymous": "always", "named": "never", "asyncArrow": "always" }]
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"all": true,
|
||||
"check-coverage": true,
|
||||
"lines": 80,
|
||||
"statements": 80,
|
||||
"functions": 80,
|
||||
"branches": 75,
|
||||
"reporter": ["text", "html", "lcov"],
|
||||
"report-dir": "./coverage",
|
||||
"temp-dir": "./.nyc_output",
|
||||
"exclude": [
|
||||
"node_modules/**",
|
||||
"coverage/**",
|
||||
"**/*.test.js",
|
||||
"dist/**",
|
||||
".nyc_output/**"
|
||||
],
|
||||
"extension": [".js"]
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"trailingComma": "none",
|
||||
"arrowParens": "avoid",
|
||||
"printWidth": 100,
|
||||
"endOfLine": "lf"
|
||||
}
|
||||
Generated
+1680
-1
File diff suppressed because it is too large.
Load diff
+8
-2
@@ -16,7 +16,10 @@
|
||||
"x:test": "node src/index.js x:test",
|
||||
"ops:check": "bash tools/ops-check.sh",
|
||||
"deploy:lxc": "bash tools/deploy-lxc.sh",
|
||||
"test": "node --test $(find src -type f -name '*.test.js' | sort | tr '\\n' ' ')"
|
||||
"test": "c8 --reporter=text --reporter=html node --test $(find src -type f -name '*.test.js' | sort | tr '\\n' ' ')",
|
||||
"lint": "eslint src/",
|
||||
"lint:fix": "eslint src/ --fix && prettier --write src/",
|
||||
"format": "prettier --write ."
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^1.7.9",
|
||||
@@ -30,7 +33,10 @@
|
||||
"winston": "^3.17.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"nodemon": "^3.1.9"
|
||||
"c8": "^9.1.0",
|
||||
"eslint": "^8.56.0",
|
||||
"nodemon": "^3.1.9",
|
||||
"prettier": "^3.2.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
|
||||
Reference in new issue
Block a user