Use @tenbin/jest

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski
2025-01-09 13:59:27 +00:00
parent 6a7aa172c4
commit 034e11abe7
6 changed files with 49 additions and 9 deletions

View File

@@ -164,16 +164,13 @@ jobs:
if: matrix.project == 'WebKit' && steps.playwright-cache.outputs.cache-hit == 'true'
run: yarn playwright install-deps webkit
# Restore test-results.json file, which records the execution time of each test file.
# splitTests function uses this file for sharding.
# Restore playwright-results.json file, which records the execution time of each test file.
# The splitTests function uses this file for sharding.
- name: Restore playwright-results.json
uses: actions/cache/restore@v4
with:
path: playwright-results.json
key: playwright-results-${{ github.ref_name }}
restore-keys: |
playwright-results-${{ github.base_ref }}
playwright-results-develop
key: playwright-results
# We skip tests tagged with @mergequeue when running on PRs, but run them in MQ and everywhere else
- name: Run Playwright tests
@@ -234,7 +231,7 @@ jobs:
uses: actions/cache/save@v4
with:
path: playwright-results.json
key: playwright-results-${{ github.ref_name }}
key: playwright-results
# Upload the HTML report even if one of our reporters fails, this can happen when stale screenshots are detected
- name: Upload HTML report

View File

@@ -64,6 +64,14 @@ jobs:
id: cpu-cores
uses: SimenB/github-actions-cpu-cores@97ba232459a8e02ff6121db9362b09661c875ab8 # v2
# Restore tenbin-report.json file, which records the execution time of each test file.
# @tenbin/jest/sequencer uses this file for sharding.
- name: Restore tenbin-report.json
uses: actions/cache/restore@v4
with:
path: tenbin-report.json
key: tenbin-report
- name: Run tests
run: |
yarn test \
@@ -78,6 +86,14 @@ jobs:
# tell jest to use coloured output
FORCE_COLOR: true
# @tenbin/jest/reporter generates tenbin-report.json for each shard.
- name: Upload tenbin-report.json
if: github.ref_name == 'main'
uses: actions/upload-artifact@v4
with:
name: tenbin-report-${{ matrix.runner }}
path: tenbin-report.json
- name: Move coverage files into place
if: env.ENABLE_COVERAGE == 'true'
run: mv coverage/lcov.info coverage/${{ steps.setupNode.outputs.node-version }}-${{ matrix.runner }}.lcov.info
@@ -112,3 +128,16 @@ jobs:
context: SonarCloud Code Analysis
sha: ${{ github.sha }}
target_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
# Download, merge & upload tenbin-report.json
- uses: actions/download-artifact@v4
with:
path: tenbin-report
pattern: tenbin-report-*
- name: Merge tenbin-report
run: jq -s add tenbin-report/**/tenbin-report.json > tenbin-report.json
- name: Cache tenbin-report.json
uses: actions/cache/save@v4
with:
path: tenbin-report.json
key: tenbin-report

View File

@@ -52,11 +52,12 @@ const config: Config = {
testResultsProcessor: "@casualbot/jest-sonar-reporter",
prettierPath: null,
moduleDirectories: ["node_modules", "test/test-utils"],
testSequencer: "@tenbin/jest/sequencer",
};
// if we're running under GHA, enable the GHA reporter
if (env["GITHUB_ACTIONS"] !== undefined) {
const reporters: Config["reporters"] = [["github-actions", { silent: false }], "summary"];
const reporters: Config["reporters"] = [["github-actions", { silent: false }], "summary", "@tenbin/jest/reporter"];
// if we're running against the develop branch, also enable the slow test reporter
if (env["GITHUB_REF"] == "refs/heads/develop") {

View File

@@ -21,6 +21,8 @@ export default {
"src/hooks/useLocalStorageState.ts",
"src/components/views/elements/InfoTooltip.tsx",
"src/components/views/elements/StyledCheckbox.tsx",
// This throws an error trying to load tenbin for an unknown reason
"src/playwright.config.ts",
],
ignoreDependencies: [
// Required for `action-validator`

View File

@@ -182,6 +182,7 @@
"@sentry/webpack-plugin": "^2.7.1",
"@stylistic/eslint-plugin": "^2.9.0",
"@svgr/webpack": "^8.0.0",
"@tenbin/jest": "^0.5.0",
"@tenbin/playwright": "^0.5.0",
"@testcontainers/postgresql": "^10.16.0",
"@testing-library/dom": "^10.4.0",

View File

@@ -2722,6 +2722,15 @@
resolved "https://registry.yarnpkg.com/@tenbin/core/-/core-0.5.0.tgz#394f74d90e618e9c15a1f376871a5247b06e35d7"
integrity sha512-QawJTsn1svoLDJipr0dDl/L3npkiMmA1pO5OfveoV6/hajQSrEI0QJtxg/kXMyi0P+EUJ55KL0BVsDkh78OvZA==
"@tenbin/jest@^0.5.0":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@tenbin/jest/-/jest-0.5.0.tgz#5f89396de18d5aa1f78d91926cf8941be89aa2e5"
integrity sha512-CWjyHGMzibiQWJYXuXEsiPgEmXPjoPfRJItTFbvNEmW4lWazuMsQcihxs4ZpyCUq8LxDDMFYf2Egt7ZMjsTEQA==
dependencies:
"@jest/test-sequencer" "^29.7.0"
"@tenbin/core" "0.5.0"
picocolors "^1.1.0"
"@tenbin/playwright@^0.5.0":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@tenbin/playwright/-/playwright-0.5.0.tgz#8203d3419144fb812430663cc6362658df462abd"
@@ -3560,13 +3569,14 @@
"@vector-im/matrix-wysiwyg-wasm@link:../../.cache/yarn/v6/npm-@vector-im-matrix-wysiwyg-2.38.0-af862ffd231dc0a6b8d6f2cb3601e68456c0ff24-integrity/node_modules/bindings/wysiwyg-wasm":
version "0.0.0"
uid ""
"@vector-im/matrix-wysiwyg@2.38.0":
version "2.38.0"
resolved "https://registry.yarnpkg.com/@vector-im/matrix-wysiwyg/-/matrix-wysiwyg-2.38.0.tgz#af862ffd231dc0a6b8d6f2cb3601e68456c0ff24"
integrity sha512-cMEVicFYVzFxuSyWON0aVGjAJMcgJZ+LxuLTEp8EGuu8cRacuh0RN5rapb11YVZygzFvE7X1cMedJ/fKd5vRLA==
dependencies:
"@vector-im/matrix-wysiwyg-wasm" "link:../../.cache/yarn/v6/npm-@vector-im-matrix-wysiwyg-2.38.0-af862ffd231dc0a6b8d6f2cb3601e68456c0ff24-integrity/node_modules/bindings/wysiwyg-wasm"
"@vector-im/matrix-wysiwyg-wasm" "link:../../Library/Caches/Yarn/v6/npm-@vector-im-matrix-wysiwyg-2.38.0-af862ffd231dc0a6b8d6f2cb3601e68456c0ff24-integrity/node_modules/bindings/wysiwyg-wasm"
"@webassemblyjs/ast@1.14.1", "@webassemblyjs/ast@^1.14.1":
version "1.14.1"