diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index e9655b18e..e7f366c14 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -27,10 +27,22 @@ jobs: with: go-version: "1.19" - - name: Unit tests + - name: Run backend unit tests run: | go test ./... -coverprofile coverage.out -covermode count go tool cover -func coverage.out + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: 16 + - name: Install frontend test dependencies + run: | + cd ui + npm ci + - name: Run UI unit tests + run: | + cd ui + npm test -- --browsers=ChromeHeadless --watch=false - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v3 with: diff --git a/Makefile b/Makefile index dac8ccc83..3e0866fce 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,9 @@ update-vendor: # Run unit tests test: go test -v ./... + cd ui/ && npm test -- --browsers=ChromeHeadless --watch=false # Run code coverage with unit tests test-coverage: go test ./... -coverprofile coverage.out -covermode count go tool cover -func coverage.out + cd ui/ && npm test -- --browsers=ChromeHeadless --watch=false diff --git a/ui/angular.json b/ui/angular.json index b9bd39c69..e8b11d760 100644 --- a/ui/angular.json +++ b/ui/angular.json @@ -106,7 +106,11 @@ "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css", "src/styles.scss" ], - "scripts": [] + "scripts": [], + "codeCoverage": true, + "codeCoverageExclude": [ + "**/mocks/**" + ] } } } diff --git a/ui/dist/ui/index.html b/ui/dist/ui/index.html index efb99c0de..e5676bee8 100644 --- a/ui/dist/ui/index.html +++ b/ui/dist/ui/index.html @@ -12,5 +12,5 @@