Skip to content
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
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ jobs:
name: Unit Tests
runs-on: ubuntu-22.04
needs: vars
permissions:
checks: write
pull-requests: write
steps:
- name: Checkout Repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
Expand Down Expand Up @@ -104,10 +107,22 @@ jobs:
path: ${{ github.workspace }}/cover.html
if: always()

- name: Test Report
uses: dorny/test-reporter@v1
with:
name: Unit Tests Report
path: unit-tests.xml
reporter: java-junit
only-summary: true
if: always()

njs-unit-tests:
name: NJS Unit Tests
runs-on: ubuntu-22.04
needs: vars
permissions:
checks: write
pull-requests: write
steps:
- name: Checkout Repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
Expand All @@ -125,6 +140,15 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}

- name: Test Report
uses: dorny/test-reporter@v1
with:
name: Unit Tests Report
path: ${{ github.workspace }}/internal/mode/static/nginx/modules/njs-unit-tests.xml
reporter: jest-junit
only-summary: true
if: always()

binary:
name: Build Binary
runs-on: ubuntu-22.04
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,8 @@ internal/mode/static/nginx/modules/coverage
# temporary files used for manifest generation
config/base/deploy.yaml
config/base/deploy.yaml.bak

# test reports
unit-tests.xml
unit-tests.json
njs-unit-tests.xml
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ lint: ## Run golangci-lint against code
unit-test: ## Run unit tests for the go code
# We have to run the tests in the cmd package using `go test` because of a bug with the CLI library cobra. See https://github.com/spf13/cobra/issues/2104.
go test -buildvcs ./cmd/... -race -shuffle=on -coverprofile=cmd-coverage.out -covermode=atomic
go run github.com/onsi/ginkgo/v2/ginkgo --randomize-all --randomize-suites --race --keep-going --fail-on-pending --fail-fast --trace --covermode=atomic --coverprofile=coverage.out --force-newlines $(GITHUB_OUTPUT) -p -v -r internal
go run github.com/onsi/ginkgo/v2/ginkgo --randomize-all --randomize-suites --race --keep-going --fail-on-pending --fail-on-empty --fail-fast --trace --covermode=atomic --coverprofile=coverage.out --junit-report=unit-tests.xml --json-report=unit-tests.json --force-newlines $(GITHUB_OUTPUT) -p -v -r internal
go tool cover -html=coverage.out -o cover.html
go tool cover -html=cmd-coverage.out -o cmd-cover.html

Expand Down
2 changes: 1 addition & 1 deletion internal/mode/static/nginx/modules/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"format": "prettier -w src/ test/",
"lint": "prettier -c src/ test/",
"test": "vitest run --coverage",
"test": "vitest run --coverage --config test/vitest.config.ts",
"clean": "rm -rf node_modules coverage"
},
"devDependencies": {
Expand Down
2 changes: 2 additions & 0 deletions internal/mode/static/nginx/modules/test/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { defineConfig } from 'vitest/config';

export default defineConfig({
test: {
reporters: ['verbose', 'junit'],
outputFile: './njs-unit-tests.xml',
coverage: {
reporter: ['text', 'json', 'html'],
},
Expand Down
Loading