From 514965162d1cc14887d0888609c3f0bfb2ec7b5f Mon Sep 17 00:00:00 2001 From: Carlos Santos <4a.santos@gmail.com> Date: Wed, 23 Apr 2025 14:57:06 +0200 Subject: [PATCH] ci: add jest-junit for test reporting and update integration test workflow --- .github/workflows/integration-test.yaml | 18 +++++----- backend/package-lock.json | 47 +++++++++++++++++++++++++ backend/package.json | 13 ++++--- 3 files changed, 66 insertions(+), 12 deletions(-) diff --git a/.github/workflows/integration-test.yaml b/.github/workflows/integration-test.yaml index 0cccf2e..4093b0c 100644 --- a/.github/workflows/integration-test.yaml +++ b/.github/workflows/integration-test.yaml @@ -1,12 +1,5 @@ name: Integration Tests -on: - push: - branches: - - main - - pull_request: - branches: - - main +on: [push, pull_request] jobs: @@ -60,6 +53,15 @@ jobs: cd backend npm install npm run test:integration-rooms + env: + JEST_JUNIT_OUTPUT_DIR: './reports/' + - name: Publish Test Report + uses: mikepenz/action-junit-report@v4 + if: always() + with: + report_paths: '**/reports/junit.xml' + fail_on_failure: true + require_tests: true test-recordings: name: Recordings API Tests diff --git a/backend/package-lock.json b/backend/package-lock.json index 4187a50..b75e0f1 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -49,6 +49,7 @@ "eslint-config-prettier": "9.0.0", "jest": "^29.7.0", "jest-fetch-mock": "^3.0.3", + "jest-junit": "^16.0.0", "nodemon": "3.1.9", "openapi-generate-html": "^0.4.2", "openapi-zod-client": "1.18.2", @@ -9043,6 +9044,45 @@ "fsevents": "^2.3.2" } }, + "node_modules/jest-junit": { + "version": "16.0.0", + "resolved": "https://registry.npmjs.org/jest-junit/-/jest-junit-16.0.0.tgz", + "integrity": "sha512-A94mmw6NfJab4Fg/BlvVOUXzXgF0XIH6EmTgJ5NDPp4xoKq0Kr7sErb+4Xs9nZvu58pJojz5RFGpqnZYJTrRfQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "mkdirp": "^1.0.4", + "strip-ansi": "^6.0.1", + "uuid": "^8.3.2", + "xml": "^1.0.1" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/jest-junit/node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true, + "license": "MIT", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jest-junit/node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "dev": true, + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/jest-leak-detector": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz", @@ -13124,6 +13164,13 @@ "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, + "node_modules/xml": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz", + "integrity": "sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw==", + "dev": true, + "license": "MIT" + }, "node_modules/xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", diff --git a/backend/package.json b/backend/package.json index db93611..13cd63b 100644 --- a/backend/package.json +++ b/backend/package.json @@ -36,10 +36,10 @@ "package:build": "npm run build:prod && npm pack", "lib:sync-pro": "npm run package:build && cp openvidu-meet-server-*.tgz ../../openvidu-meet-pro/backend", "typings:sync": "npm run sync-ce --prefix ../typings", - "test:integration": "node --experimental-vm-modules node_modules/.bin/jest --runInBand --forceExit --testPathPattern \"tests/integration\"", - "test:integration-rooms": "node --experimental-vm-modules node_modules/.bin/jest --runInBand --forceExit --testPathPattern \"tests/integration/api/rooms\"", - "test:integration-recordings": "node --experimental-vm-modules node_modules/.bin/jest --runInBand --forceExit --testPathPattern \"tests/integration/api/recordings\"", - "test:integration-security": "node --experimental-vm-modules node_modules/.bin/jest --runInBand --forceExit --testPathPattern \"tests/integration/api/security\"", + "test:integration": "node --experimental-vm-modules node_modules/.bin/jest --runInBand --forceExit --testPathPattern \"tests/integration\" --ci --reporters=default --reporters=jest-junit", + "test:integration-rooms": "node --experimental-vm-modules node_modules/.bin/jest --runInBand --forceExit --testPathPattern \"tests/integration/api/rooms\" --ci --reporters=default --reporters=jest-junit", + "test:integration-recordings": "node --experimental-vm-modules node_modules/.bin/jest --runInBand --forceExit --testPathPattern \"tests/integration/api/recordings\" --ci --reporters=default --reporters=jest-junit", + "test:integration-security": "node --experimental-vm-modules node_modules/.bin/jest --runInBand --forceExit --testPathPattern \"tests/integration/api/security\" --ci --reporters=default --reporters=jest-junit", "lint:fix": "eslint src --fix", "format:code": "prettier --ignore-path .gitignore --write '**/*.{ts,js,json,md}'" }, @@ -84,6 +84,7 @@ "eslint-config-prettier": "9.0.0", "jest": "^29.7.0", "jest-fetch-mock": "^3.0.3", + "jest-junit": "^16.0.0", "nodemon": "3.1.9", "openapi-generate-html": "^0.4.2", "openapi-zod-client": "1.18.2", @@ -93,5 +94,9 @@ "ts-jest-resolver": "^2.0.1", "ts-node": "10.9.2", "typescript": "5.4.5" + }, + "jest-junit": { + "outputDirectory": "test-results", + "outputName": "junit.xml" } }