Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidated Coverage Report for FE & BE #244

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 5 additions & 20 deletions .github/workflows/coverage_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,12 @@ name: Coverage Report

on:
pull_request:
branches: [main , frontend_testing]

branches: [main]
push:
branches:
- main
jobs:
backend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: |
cd backend
npm install --save-dev typescript-coverage-report
- name: Generate coverage report
run: |
cd backend
npm run ts-coverage
frontend:
Coverage_Report:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -29,9 +16,7 @@ jobs:
node-version: 16
- name: Install dependencies
run: |
cd frontend
npm install
- name: Generate coverage report
run: |
cd frontend
npm run coverage
2 changes: 1 addition & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: ES Lint

on:
pull_request:
branches: [main, frontend]
branches: [main,frontend]
jobs:
lint:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ jobs:
- name: Test
run: |
cd frontend
npm test
npm test
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,5 @@ models/*.js

# MacOS
.DS_Store

package-lock.json
8 changes: 7 additions & 1 deletion backend/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,11 @@ module.exports = {
//"/node_modules/",
//"\\.pc/",
// "/frontend/",
]
], testMatch: [
'<rootDir>/src/**/__tests__/**/*.{ts,tsx}',
'<rootDir>/src/**/*.{spec,test}.{ts,tsx}',
],
collectCoverage: true,
collectCoverageFrom: ["src/**/*.{ts,tsx}", "!**/node_modules/**"],
verbose: true
};
4 changes: 2 additions & 2 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"build": "tsc -p .",
"test": "jest",
"lint": "eslint --fix --ext .ts,.js .",
"ts-coverage": "typescript-coverage-report"
"coverage": "jest --coverage"
},
"dependencies": {
"@ericblade/quagga2": "^1.8.2",
Expand Down Expand Up @@ -63,4 +63,4 @@
"ts-node-dev": "^2.0.0",
"typescript": "^4.9.5"
}
}
}
6 changes: 1 addition & 5 deletions backend/src/__tests__/smoke.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
describe('smoke test', () => {
test('returns an integer 2', () => {
expect(1+1).toBe(2);
expect(1 + 1).toBe(2);
});

test('can import entry point without errors', () => {
expect(() => require('../routes/index.js')).not.toThrow();
});

});

File renamed without changes.
41 changes: 41 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
module.exports = {
projects: [
{
displayName: 'FE TEST',
testEnvironment: 'jsdom',
testMatch: ['<rootDir>/frontend/__tests__/**/*.{js,jsx,ts,tsx}'],
rootDir: '.',
testPathIgnorePatterns: ['<rootDir>/backend'],
moduleDirectories: ['node_modules'],
testMatch: [
'<rootDir>/frontend/src/**/__tests__/**/*.{js,jsx,ts,tsx}',
'<rootDir>/frontend/src/**/*.{spec,test}.{js,jsx,ts,tsx}',
],
transform: {
'^.+\\.(ts|js|tsx|jsx)$': '@swc/jest',
}, setupFilesAfterEnv: ['@testing-library/jest-dom/extend-expect']
},
{
displayName: 'BE TEST',
testEnvironment: 'node',
testMatch: ['<rootDir>/backend/__tests__/**/*.{js,jsx,ts,tsx}'],
moduleDirectories: ['node_modules'],
rootDir: '.',
//setupFilesAfterEnv: ['@types/express'],
testMatch: [
'<rootDir>/backend/src/**/__tests__/**/*.{ts,tsx}',
'<rootDir>/backend/src/**/*.{spec,test}.{ts,tsx}',
]
},
],
collectCoverage: true,
coverageDirectory: './docs/coverage',
collectCoverageFrom: [
'frontend/src/pages/**/*.{ts,tsx}',
'frontend/src/Components/**/*.{ts,tsx}',
'backend/src/models/*.ts',
'backend/src/routes/*.ts',
'!**/node_modules/**',
],
coverageReporters: ['html', 'text', 'lcov'],
};
86 changes: 86 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"name": "combinedcoveragereport",
"version": "0.0.0",
"private": true,
"dependencies": {
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@ericblade/quagga2": "^1.8.2",
"@fontsource/roboto": "^4.5.8",
"@mui/icons-material": "^5.11.11",
"@mui/material": "^5.11.12",
"@reduxjs/toolkit": "^1.9.3",
"@swc/jest": "^0.2.26",
"@testing-library/react": "^14.0.0",
"@types/express": "^4.17.17",
"@types/jest": "^29.5.0",
"@types/node": "^16.18.13",
"@types/passport": "^1.0.12",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"@types/react-router-dom": "^5.3.3",
"@typescript-eslint/eslint-plugin": "^5.58.0",
"@typescript-eslint/parser": "^5.58.0",
"axios": "^1.4.0",
"bcrypt": "^5.0.0",
"bcryptjs": "^2.4.3",
"body-parser": "^1.19.0",
"connect-flash": "^0.1.1",
"cookie-parser": "^1.4.5",
"cookie-session": "^1.4.0",
"cors": "^2.8.5",
"debug": "~2.6.9",
"dotenv": "^16.0.3",
"ejs": "^3.1.9",
"expres": "^0.0.5",
"express": "^4.18.2",
"express-favicon": "^2.0.1",
"express-session": "^1.17.1",
"fontawesome": "^5.6.3",
"formik": "^2.2.9",
"http-errors": "~1.6.3",
"jade": "~1.11.0",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"jshint-reporter-badge": "^0.1.0",
"jslint": "^0.12.1",
"jsonwebtoken": "^9.0.0",
"jwt-decode": "^3.1.2",
"miragejs": "^0.1.47",
"mongoose": "^5.9.11",
"morgan": "~1.9.1",
"nodemon": "^2.0.22",
"passport": "^0.6.0",
"passport-local": "^1.0.0",
"pg": "^8.9.0",
"pg-hstore": "^2.3.4",
"quagga": "^0.12.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-redux": "^8.0.5",
"react-router-dom": "^6.10.0",
"recharts": "^2.5.0",
"run": "^1.4.0",
"typescript": "^4.9.5",
"web-vitals": "^2.1.4"
},
"scripts": {
"test": "jest --no-coverage",
"coverage": "jest --coverage"
},
"devDependencies": {
"@swc/jest": "^0.2.26",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^14.0.0",
"@types/express": "^4.17.17",
"@types/jest": "^29.5.0",
"@types/react-dom": "^18.0.11",
"@types/react-router-dom": "^5.3.3",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"miragejs": "^0.1.47",
"react-router-dom": "^6.10.0",
"source-map": "^0.7.4",
"ts-jest": "^29.1.0"
}
}