Skip to content

Commit c82c1f7

Browse files
pawelangelowclaude
andcommitted
test(ci): run affected-only FE tests via jest --changedSince [experiment]
Experiment on branch test/fe-affected-tests to measure CI time of an affected-only run. Adds test:affected (jest --changedSince=origin/main) and switches the FE job to it with fetch-depth: 0 for the merge-base. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent ae4712a commit c82c1f7

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

.github/workflows/tests-frontend.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ jobs:
1313
name: Frontend tests
1414
steps:
1515
- uses: actions/checkout@v7.0.0
16+
with:
17+
# Full history so jest's --changedSince can find the merge-base with main.
18+
fetch-depth: 0
1619

1720
- name: Install all libs and dependencies
1821
uses: ./.github/actions/install-all-build-libs
@@ -35,9 +38,15 @@ jobs:
3538
FILENAME=$FILENAME DEPS="UI dev" node .github/deps-audit-report.js &&
3639
curl -H "Content-type: application/json" --data @slack.$FILENAME -H "Authorization: Bearer $SLACK_AUDIT_REPORT_KEY" -X POST https://slack.com/api/chat.postMessage
3740
38-
- name: Unit tests UI
41+
# EXPERIMENT (branch test/fe-affected-tests): run only tests related to
42+
# files this branch changed vs main, via jest --changedSince. Measures the
43+
# CI time of an affected-only run. No coverage (an affected subset would
44+
# trip the global coverageThreshold).
45+
- name: Unit tests UI (affected only)
3946
timeout-minutes: 30
40-
run: yarn test:cov --ci --silent
47+
run: |
48+
git fetch --no-tags origin main
49+
yarn test:affected --ci --silent
4150
4251
- name: Upload Test Report
4352
uses: actions/upload-artifact@v7

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"test:api": "yarn --cwd redisinsight/api test",
5252
"test:api:integration": "yarn --cwd redisinsight/api test:api",
5353
"test:watch": "jest --watch -w 1",
54+
"test:affected": "jest --changedSince=origin/main --passWithNoTests -w 3",
5455
"test:cov": "cross-env NODE_OPTIONS='' jest --testLocationInResults --json --outputFile=\"report/coverage/report.json\" --silent --coverage --no-cache --forceExit -w 3",
5556
"test:cov:unit": "jest --group=-component --coverage -w 1",
5657
"test:cov:component": "jest --group=component --coverage -w 1",

0 commit comments

Comments
 (0)