Skip to content

Commit b8d769c

Browse files
Run a single test command in CI (#4007)
* Run a single test command in CI * add link to bug * cleaner * test changing screenshot name, screenshot failure, and adding new screenshot * don't pass a glob string to rm * remove soft failure * Update screenshots Co-authored-by: nstepien * tweak git config, reset test * Update screenshots --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 3a824a5 commit b8d769c

File tree

11 files changed

+56
-47
lines changed

11 files changed

+56
-47
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,18 @@ jobs:
3838
run: npx playwright install chromium firefox
3939

4040
- name: Test
41-
run: node --run test
41+
run: node --run test:ci
4242
timeout-minutes: 4
4343

44-
- name: Visual regression test
45-
run: node --run visual
46-
4744
- name: Upload test failure artifacts
4845
if: failure()
4946
uses: actions/upload-artifact@v7
5047
with:
5148
name: test-artifacts
5249
path: |
53-
test/browser/**/__screenshots__/**
54-
test/browser/**/__traces__/**
55-
.vitest-attachments/test/**/*
50+
test/**/__screenshots__/**
51+
test/**/__traces__/**
52+
.vitest-attachments/test/**
5653
if-no-files-found: ignore
5754

5855
- name: Upload coverage

.github/workflows/publish.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,9 @@ jobs:
4949
run: npx playwright install chromium firefox
5050

5151
- name: Test
52-
run: node --run test
52+
run: node --run test:ci
5353
timeout-minutes: 4
5454

55-
- name: Visual regression test
56-
run: node --run visual
57-
5855
- name: Update version
5956
run: |
6057
git config user.name "${{ github.actor }}"

.github/workflows/update-screenshots.yml

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@ on:
55
types: [labeled]
66
workflow_dispatch:
77

8-
env:
9-
AUTHOR_NAME: 'github-actions[bot]'
10-
AUTHOR_EMAIL: '41898282+github-actions[bot]@users.noreply.github.com'
11-
COMMIT_MESSAGE: |
12-
Update screenshots
13-
14-
Co-authored-by: ${{ github.actor }}
15-
168
jobs:
179
update-screenshots:
1810
if: ${{ github.event.label.name == 'Update Screenshots' || github.event_name == 'workflow_dispatch' }}
@@ -46,12 +38,12 @@ jobs:
4638
run: npx playwright install chromium firefox
4739
- name: Update screenshots
4840
run: |
49-
rm -r test/visual/__screenshots__
50-
node --run visual:update
41+
rm -r test/**/screenshots/**
42+
node --run test:ci:update
5143
- name: Push new screenshots
5244
run: |
53-
git config --global user.name "${{ env.AUTHOR_NAME }}"
54-
git config --global user.email "${{ env.AUTHOR_EMAIL }}"
55-
git add test/visual/__screenshots__/.
56-
git diff-index --quiet HEAD || git commit -m "${{ env.COMMIT_MESSAGE }}"
45+
git config user.name "${{ github.actor }}"
46+
git config user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
47+
git add "test/**/screenshots/**"
48+
git diff-index --quiet HEAD || git commit -m "Update screenshots"
5749
git push

.gitignore

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
/.cache
22
/.claude
3-
/coverage
43
/dist
54
/lib
65
/node_modules
76
/package-lock.json
8-
test/browser/**/__screenshots__
97

108
npm-debug.log
119
**.orig
1210
.idea
13-
.vitest-attachments
1411

15-
__traces__
12+
# Vitest
13+
/.vitest-attachments
14+
/coverage
15+
/test/**/__screenshots__
16+
/test/**/__traces__
17+
/test/**/screenshots/**/*-win32.png

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ website/ # demo site (Vite + TanStack Router)
5555
- Browser tests use `vitest/browser` + Playwright. `test/setupBrowser.ts` configures `page.render()` via `vitest-browser-react` and registers custom locators via `locators.extend()` — prefer `page.getGrid()`, `page.getCell({ name })`, `page.getRow()`, `page.getHeaderCell()`, `page.getSelectedCell()`, etc. over raw `page.getByRole()`.
5656
- Test helpers in `test/browser/utils.tsx`: `setup()`, `getRowWithCell()`, `getCellsAtRowIndex()`, `validateCellPosition()`, `scrollGrid()`, `tabIntoGrid()`, `testCount()`, `testRowCount()`.
5757
- `test/failOnConsole.ts` fails tests on unexpected console warnings/errors.
58-
- **Never run visual regression tests locally** — screenshots are CI-only and environment-dependent.
58+
- **Never run visual regression tests** — screenshots are environment-dependent so visual regression tests must run in CI only.
5959

6060
## Validation
6161

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@
3636
"preview": "vite preview",
3737
"build:website": "vite build",
3838
"build": "rolldown -c",
39-
"test": "vitest run --project browser --project node --coverage.reportsDirectory='./coverage/test'",
39+
"test": "vitest run --project browser --project node",
4040
"test:watch": "vitest watch --project browser --project node",
41-
"visual": "vitest run --project visual --coverage.reportsDirectory='./coverage/visual'",
42-
"visual:update": "vitest run --project visual --update",
41+
"test:ci": "vitest run",
42+
"test:ci:update": "vitest run --project visual --update",
4343
"format": "oxfmt",
4444
"format:check": "oxfmt --check",
4545
"eslint": "eslint --max-warnings 0 --cache --cache-location .cache/eslint --cache-strategy content",

test/visual/__screenshots__/basicGrid.test.tsx/basic-grid-chromium-linux.png renamed to test/visual/screenshots/basicGrid.test.tsx/basic-grid-chromium-linux.png

File renamed without changes.

test/visual/__screenshots__/basicGrid.test.tsx/basic-grid-firefox-linux.png renamed to test/visual/screenshots/basicGrid.test.tsx/basic-grid-firefox-linux.png

File renamed without changes.

test/visual/__screenshots__/treeGrid.test.tsx/tree-grid-chromium-linux.png renamed to test/visual/screenshots/treeGrid.test.tsx/tree-grid-chromium-linux.png

File renamed without changes.

test/visual/__screenshots__/treeGrid.test.tsx/tree-grid-firefox-linux.png renamed to test/visual/screenshots/treeGrid.test.tsx/tree-grid-firefox-linux.png

File renamed without changes.

0 commit comments

Comments
 (0)