From 09f8b6a8a8db3dc4014334e9638628f26ec04806 Mon Sep 17 00:00:00 2001 From: Manish Menaria Date: Fri, 27 Dec 2024 16:29:30 +0530 Subject: [PATCH] Update actions/upload-artifact from v3 to v4 to use the latest version. Also fix E2E test artifacts generation by configuring jest-html-reporters. (#2180) * Bump actions/upload-artifact from v3 to v4 * Try reverting to v3 * Use ubuntu-22.04 * Testing "E2E tests" workflow * Add missing jest-html-reporters configuration - Add jest-html-reporters configuration to generate HTML test reports - Reports will be saved in ./artifacts/report.html * Add jest-html-reporters to generate HTML test reports * Remove failing tests which was added for testing * Update jest-html-reporters version --- .github/workflows/e2e-tests.yml | 2 +- .github/workflows/linting.yml | 2 +- package-lock.json | 29 +++++++++++++++++++++++++++-- package.json | 13 ++++++++++++- 4 files changed, 41 insertions(+), 5 deletions(-) diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 33c950a16..fdbdeb491 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -7,7 +7,7 @@ on: jobs: Setup: name: Setup - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - name: Cache node modules diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index b3345342b..e55ce18d9 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -49,7 +49,7 @@ jobs: continue-on-error: true - if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }} name: Upload ESLint report - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: eslint_report.json path: eslint_report.json diff --git a/package-lock.json b/package-lock.json index bac9da75e..6f6ec1099 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,6 +22,7 @@ "cross-env": "7.0.3", "eslint-plugin-import": "2.29.1", "github-label-sync": "2.3.1", + "jest-html-reporters": "^3.1.7", "jest-puppeteer": "10.1.0", "lodash": "4.17.21", "node-wp-i18n": "1.2.7", @@ -35,8 +36,8 @@ "uglify-js": "3.19.3" }, "engines": { - "node": "^20.11.1", - "npm": "9.1.3" + "node": "20.17.0", + "npm": "10.8.2" } }, "node_modules/@ampproject/remapping": { @@ -14044,6 +14045,30 @@ "fsevents": "^2.3.2" } }, + "node_modules/jest-html-reporters": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/jest-html-reporters/-/jest-html-reporters-3.1.7.tgz", + "integrity": "sha512-GTmjqK6muQ0S0Mnksf9QkL9X9z2FGIpNSxC52E0PHDzjPQ1XDu2+XTI3B3FS43ZiUzD1f354/5FfwbNIBzT7ew==", + "dev": true, + "dependencies": { + "fs-extra": "^10.0.0", + "open": "^8.0.3" + } + }, + "node_modules/jest-html-reporters/node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/jest-leak-detector": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz", diff --git a/package.json b/package.json index aa1fa7906..6fa0d4942 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,17 @@ ], "globals": { "STORE_URL": "http://localhost:8802" - } + }, + "reporters": [ + "default", + [ + "jest-html-reporters", + { + "publicPath": "./artifacts", + "filename": "report.html" + } + ] + ] }, "config": { "wp_org_slug": "storefront", @@ -90,6 +100,7 @@ "eslint-plugin-import": "2.29.1", "github-label-sync": "2.3.1", "jest-puppeteer": "10.1.0", + "jest-html-reporters": "^3.1.7", "lodash": "4.17.21", "node-wp-i18n": "1.2.7", "onchange": "7.1.0",