File tree Expand file tree Collapse file tree 11 files changed +152
-5
lines changed
Expand file tree Collapse file tree 11 files changed +152
-5
lines changed Original file line number Diff line number Diff line change 1+ name : CI
2+
3+ on :
4+ push :
5+ pull_request :
6+
7+ jobs :
8+ lint-and-test :
9+ runs-on : self-hosted
10+ steps :
11+ - name : Checkout repo
12+ uses : actions/checkout@v4
13+
14+ - name : Start containers
15+ run : docker compose up -d --build
16+
17+ - name : Lint backend
18+ run : docker exec $(docker ps -qf "name=backend") npm run lint
19+
20+ - name : Lint frontend
21+ run : docker exec $(docker ps -qf "name=frontend") npm run lint
22+
23+ - name : Test backend
24+ run : docker exec $(docker ps -qf "name=backend") npm test
25+
26+ - name : Test frontend
27+ run : docker exec $(docker ps -qf "name=frontend") npm test
28+
29+ - name : Stop containers
30+ run : docker compose down
Original file line number Diff line number Diff line change @@ -20,6 +20,11 @@ COPY ./frontend/ ./
2020RUN npm install
2121RUN npm install -g @angular/cli
2222
23+ # Install chromium for headless browser testing
24+ RUN apk add --no-cache chromium harfbuzz ttf-freefont
25+ # Set the chromium binary path
26+ ENV CHROME_BIN=/usr/bin/chromium
27+
2328EXPOSE 4200
2429CMD ["npm" , "start" ]
2530
Original file line number Diff line number Diff line change 1+ module . exports = {
2+ parser : "@typescript-eslint/parser" ,
3+ parserOptions : {
4+ ecmaVersion : "latest" ,
5+ sourceType : "module" ,
6+ } ,
7+ plugins : [ "@typescript-eslint" ] ,
8+ extends : [
9+ "eslint:recommended" ,
10+ "plugin:@typescript-eslint/recommended" ,
11+ ] ,
12+ rules : {
13+ "@typescript-eslint/no-unused-vars" : "warn" , // Turns unused var error into warning
14+ }
15+ } ;
Original file line number Diff line number Diff line change 1+ import type { Config } from 'jest' ;
2+
3+ const config : Config = {
4+ preset : 'ts-jest' ,
5+ testEnvironment : 'node' ,
6+ transform : {
7+ '^.+\\.ts$' : 'ts-jest' ,
8+ } ,
9+ moduleFileExtensions : [ 'ts' , 'js' ] ,
10+ collectCoverage : true , // Enable code coverage
11+ coverageDirectory : 'coverage' ,
12+ testMatch : [ '**/tests/**/*.test.ts' ] , // Only test files ending in .test.ts
13+ } ;
14+
15+ export default config ;
Original file line number Diff line number Diff line change 66 "scripts" : {
77 "build" : " npx tsc" ,
88 "start" : " node dist/index.js" ,
9- "dev" : " nodemon --exec ts-node -r tsconfig-paths/register src/index.ts"
9+ "dev" : " nodemon --exec ts-node -r tsconfig-paths/register src/index.ts" ,
10+ "lint" : " eslint --config .eslintrc.js --ext .ts ./src/" ,
11+ "test" : " jest --coverage" ,
12+ "test:watch" : " jest --watch"
1013 },
1114 "repository" : {
1215 "type" : " git" ,
4144 "nodemon" : " ^3.1.9" ,
4245 "ts-node" : " ^10.9.1" ,
4346 "tsconfig-paths" : " ^4.0.0" ,
44- "typescript" : " ^5.7.3"
47+ "typescript" : " ^5.7.3" ,
48+ "eslint" : " ^8.57.0" ,
49+ "@typescript-eslint/parser" : " ^6.14.0" ,
50+ "@typescript-eslint/eslint-plugin" : " ^6.14.0" ,
51+ "jest" : " ^29.7.0" ,
52+ "ts-jest" : " ^29.1.0" ,
53+ "@types/jest" : " ^29.5.0" ,
54+ "supertest" : " ^6.3.0"
4555 }
4656}
Original file line number Diff line number Diff line change 1+ // Test die altijd zal slagen om CI te testen
2+ it ( 'should always pass' , ( done ) => {
3+ done ( ) ;
4+ } ) ;
5+
Original file line number Diff line number Diff line change 1+ {
2+ "root" : true ,
3+ "overrides" : [
4+ {
5+ "files" : [" *.ts" ],
6+ "extends" : [
7+ " eslint:recommended" ,
8+ " plugin:@typescript-eslint/recommended" ,
9+ " plugin:@angular-eslint/recommended"
10+ ],
11+ "parserOptions" : {
12+ "project" : [" tsconfig.json" ],
13+ "createDefaultProgram" : true
14+ },
15+ "rules" : {
16+ "@typescript-eslint/explicit-function-return-type" : " off"
17+ }
18+ },
19+ {
20+ "files" : [" *.html" ],
21+ "extends" : [" plugin:@angular-eslint/template/recommended" ],
22+ "rules" : {}
23+ }
24+ ]
25+ }
26+
Original file line number Diff line number Diff line change 8080 "test" : {
8181 "builder" : " @angular-devkit/build-angular:karma" ,
8282 "options" : {
83+ "karmaConfig" : " karma.conf.js" ,
8384 "polyfills" : [
8485 " zone.js" ,
8586 " zone.js/testing"
9596 ],
9697 "scripts" : []
9798 }
99+ },
100+ "lint" : {
101+ "builder" : " @angular-eslint/builder:lint" ,
102+ "options" : {
103+ "lintFilePatterns" : [" src/**/*.ts" , " src/**/*.html" ]
104+ }
98105 }
99106 }
100107 }
Original file line number Diff line number Diff line change 1+ module . exports = function ( config ) {
2+ config . set ( {
3+ frameworks : [ 'jasmine' , '@angular-devkit/build-angular' ] ,
4+ plugins : [
5+ require ( 'karma-jasmine' ) ,
6+ require ( 'karma-chrome-launcher' ) ,
7+ require ( 'karma-jasmine-html-reporter' ) ,
8+ require ( 'karma-coverage' ) ,
9+ require ( '@angular-devkit/build-angular/plugins/karma' )
10+ ] ,
11+ client : {
12+ clearContext : false
13+ } ,
14+ browsers : [ 'ChromeHeadlessNoSandbox' ] ,
15+ customLaunchers : {
16+ ChromeHeadlessNoSandbox : {
17+ base : 'ChromeHeadless' ,
18+ flags : [ '--no-sandbox' , '--disable-gpu' ]
19+ }
20+ } ,
21+ reporters : [ 'progress' , 'kjhtml' ] ,
22+ singleRun : true ,
23+ autoWatch : false
24+ } ) ;
25+ } ;
Original file line number Diff line number Diff line change 66 "start" : " ng serve --host 0.0.0.0" ,
77 "build" : " ng build" ,
88 "watch" : " ng build --watch --configuration development" ,
9- "test" : " ng test"
9+ "test" : " ng test" ,
10+ "lint" : " ng lint"
1011 },
1112 "private" : true ,
1213 "dependencies" : {
2627 "zone.js" : " ~0.14.3"
2728 },
2829 "devDependencies" : {
29- "@angular/core" : " ^17.3.0" ,
3030 "@angular-devkit/build-angular" : " ^17.3.0" ,
31+ "@angular-eslint/builder" : " ^19.1.0" ,
32+ "@angular-eslint/eslint-plugin" : " ^19.1.0" ,
33+ "@angular-eslint/eslint-plugin-template" : " ^19.1.0" ,
34+ "@angular-eslint/schematics" : " ^19.1.0" ,
35+ "@angular-eslint/template-parser" : " ^19.1.0" ,
3136 "@angular/cli" : " ^17.3.0" ,
3237 "@angular/compiler-cli" : " ^17.3.0" ,
38+ "@angular/core" : " ^17.3.0" ,
3339 "@types/jasmine" : " ~5.1.0" ,
40+ "@typescript-eslint/eslint-plugin" : " ^8.25.0" ,
41+ "@typescript-eslint/parser" : " ^8.25.0" ,
42+ "eslint" : " ^9.21.0" ,
3443 "jasmine-core" : " ~5.1.0" ,
3544 "karma" : " ~6.4.0" ,
3645 "karma-chrome-launcher" : " ~3.2.0" ,
You can’t perform that action at this time.
0 commit comments