Skip to content

Commit

Permalink
feat(upgrade): #309 Setup coverage testing report for backend
Browse files Browse the repository at this point in the history
  • Loading branch information
tholulomo committed Mar 1, 2023
1 parent 82917f1 commit 706b7b6
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 6 deletions.
10 changes: 10 additions & 0 deletions resfulservice/.nycrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"all": true,
"include": ["src/"],
"exclude": ["**/*.spec.js"],
"check-coverage": true,
"statements": 31,
"branches": 22,
"functions": 21,
"lines": 31
}
5 changes: 3 additions & 2 deletions resfulservice/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
},
"scripts": {
"start": "nodemon src/server.js --inspect",
"test": "mocha --recursive './spec/**/*.js'",
"test": "nyc --reporter=html --reporter=text --reporter=text-summary mocha --recursive './spec/**/*spec.js'",
"lint": "eslint --fix src",
"lint:test": "npm-run-all -s lint test",
"start:prod": "node src/server.js",
Expand All @@ -64,6 +64,7 @@
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.0.0",
"mocha": "^9.2.0",
"nodemon": "^2.0.15"
"nodemon": "^2.0.15",
"nyc": "^15.1.0"
}
}
10 changes: 10 additions & 0 deletions resfulservice/spec/common/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
exports.logger = {
emerg: (log) => (console.log(log)),
alert: (log) => (console.log(log)),
crit: (log) => (console.log(log)),
error: (log) => (console.log(log)),
warning: (log) => (console.log(log)),
notice: (log) => (console.log(log)),
info: (log) => (console.log(log)),
debug: (log) => (console.log(log))
};
1 change: 0 additions & 1 deletion resfulservice/spec/logger.js

This file was deleted.

3 changes: 1 addition & 2 deletions resfulservice/spec/middlewares/isAuth.spec.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
const {expect} = require('chai');
const isAuth = require('../../src/middlewares/isAuth');
const {signToken} = require('../../src/utils/jwtService');

const logger = require('../logger');
const { logger } = require('../common/utils');

describe('authValidation middleware service', function () {
it('rejects unauthorized request', async function () {
Expand Down
2 changes: 1 addition & 1 deletion resfulservice/spec/middlewares/isInternal.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { expect, should } = require('chai');
const { setInternal, getInternal } = require('../../src/middlewares/isInternal');
const logger = require('../logger');
const { logger } = require('../common/utils');

should();

Expand Down

0 comments on commit 706b7b6

Please sign in to comment.