From 6e1e42cb258d9cc7cba790bc5b2cced2ecbbaef5 Mon Sep 17 00:00:00 2001 From: sayhiben Date: Sat, 18 May 2024 23:10:31 -0700 Subject: [PATCH] Try to make GHA useful. Adds jest-junit --- .github/workflows/test.yml | 29 +++++++++++++++++++++++++---- .gitignore | 3 ++- package-lock.json | 34 ++++++++++++++++++++++++++++++++++ package.json | 4 ++-- 4 files changed, 63 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1acdbda..aa00192 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,17 +1,38 @@ name: Node.js CI -on: [push] +on: + pull_request: + push: +permissions: + contents: read + actions: read + checks: write jobs: - build: + jest-coverage: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 with: node-version: 18.x + - run: npm install + - run: npm test env: CI: true + + - name: Test Report + uses: dorny/test-reporter@v1 + if: success() || failure() # run this step even if previous step failed + with: + name: JEST Tests # Name of the check run which will be created + path: reports/jest-*.xml # Path to test results + reporter: jest-junit # Format of test results + + - uses: ArtiomTr/jest-coverage-report-action@v2 + with: + test-script: npm test \ No newline at end of file diff --git a/.gitignore b/.gitignore index 5a19e8a..87a0fb5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules dist -coverage \ No newline at end of file +coverage +junit.xml \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index c4219d7..d47f42b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -55,6 +55,7 @@ "css-loader": "^6.7.3", "file-loader": "^6.2.0", "jest": "^29.5.0", + "jest-junit": "^16.0.0", "prettier": "2.8.7", "style-loader": "^3.3.2", "supertest": "^6.3.3", @@ -7709,6 +7710,21 @@ "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, + "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-leak-detector": { "version": "29.5.0", "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.5.0.tgz", @@ -9249,6 +9265,18 @@ "concat-map": "0.0.1" } }, + "node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true, + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -12183,6 +12211,12 @@ } } }, + "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 + }, "node_modules/xstate": { "version": "4.37.1", "resolved": "https://registry.npmjs.org/xstate/-/xstate-4.37.1.tgz", diff --git a/package.json b/package.json index 241c244..9dd0418 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,7 @@ "start": "npm run build -- --stats=errors-only && electron dist", "start-local": "npm run build -- --stats=errors-only && electron dist --control.address=http://localhost:4444 --control.username=streamwall --control.password=local-dev", "test-full": "jest", - "test": "jest --testPathIgnorePatterns=src/node/server.test.js", - "coverage": "jest --coverage --testPathIgnorePatterns=src/node/server.test.js" + "test": "jest --ci --reporters=default --reporters=jest-junit --testPathIgnorePatterns=src/node/server.test.js --coverage" }, "author": "Max Goodhart ", "license": "MIT", @@ -60,6 +59,7 @@ "css-loader": "^6.7.3", "file-loader": "^6.2.0", "jest": "^29.5.0", + "jest-junit": "^16.0.0", "prettier": "2.8.7", "style-loader": "^3.3.2", "supertest": "^6.3.3",