Skip to content

Commit 4625957

Browse files
authored
Merge branch 'main' into externaldimensions
2 parents e6d1977 + 154a598 commit 4625957

16 files changed

Lines changed: 139 additions & 104 deletions

.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

.vscode/settings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
"editor.defaultFormatter": "oxc.oxc-vscode",
99
"editor.formatOnSave": true,
1010
"editor.formatOnSaveMode": "file",
11-
"typescript.enablePromptUseWorkspaceTsdk": true,
12-
"typescript.tsdk": "node_modules/typescript/lib",
11+
"js/ts.tsdk.promptToUseWorkspaceVersion": true,
12+
"js/ts.tsdk.path": "node_modules/typescript/lib",
1313
"files.readonlyInclude": {
1414
"**/routeTree.gen.ts": true
1515
},

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

eslint.config.js

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -917,6 +917,24 @@ copy(
917917
'@eslint-react/no-create-ref': 0,
918918

919919
// https://github.com/vitest-dev/eslint-plugin-vitest#rules
920+
/*
921+
// copy all the rules from the rules table for easy pasting
922+
copy(
923+
Iterator.from(
924+
document
925+
// select rules table
926+
.querySelector('.markdown-heading:has(> a[href="#rules"]) ~ markdown-accessiblity-table')
927+
// select all rows with a rule
928+
.querySelectorAll('tr:has(a)')
929+
)
930+
// filter out deprecated rules
931+
.filter((row) => row.lastElementChild.textContent === '')
932+
// map row to rule declaration
933+
.map((row) => `'vitest/${row.firstElementChild.textContent}': 1,`)
934+
.toArray()
935+
.join('\n')
936+
);
937+
*/
920938
'vitest/consistent-each-for': 1,
921939
'vitest/consistent-test-filename': 0,
922940
'vitest/consistent-test-it': 1,
@@ -931,7 +949,6 @@ copy(
931949
'vitest/no-conditional-in-test': 0,
932950
'vitest/no-conditional-tests': 1,
933951
'vitest/no-disabled-tests': 0,
934-
'vitest/no-done-callback': 1,
935952
'vitest/no-duplicate-hooks': 1,
936953
'vitest/no-focused-tests': [1, { fixable: false }],
937954
'vitest/no-hooks': 0,
@@ -943,7 +960,19 @@ copy(
943960
'vitest/no-mocks-import': 1,
944961
'vitest/no-restricted-matchers': 0,
945962
'vitest/no-restricted-vi-methods': 0,
946-
'vitest/no-standalone-expect': 1,
963+
'vitest/no-standalone-expect': [
964+
1,
965+
{
966+
additionalTestBlockFunctions: [
967+
'beforeAll',
968+
'beforeEach',
969+
'afterAll',
970+
'afterEach',
971+
'aroundAll',
972+
'aroundEach'
973+
]
974+
}
975+
],
947976
'vitest/no-test-prefixes': 1,
948977
'vitest/no-test-return-statement': 1,
949978
'vitest/no-unneeded-async-expect-function': 1,
@@ -979,7 +1008,7 @@ copy(
9791008
'vitest/prefer-strict-equal': 1,
9801009
'vitest/prefer-to-be': 1,
9811010
'vitest/prefer-to-be-falsy': 0,
982-
'vitest/prefer-to-be-object': 0,
1011+
'vitest/prefer-to-be-object': 1,
9831012
'vitest/prefer-to-be-truthy': 0,
9841013
'vitest/prefer-to-contain': 1,
9851014
'vitest/prefer-to-have-been-called-times': 1,
@@ -990,7 +1019,8 @@ copy(
9901019
'vitest/require-hook': 0,
9911020
'vitest/require-local-test-context-for-concurrent-snapshots': 0,
9921021
'vitest/require-mock-type-parameters': 0,
993-
'vitest/require-to-throw-message': 0,
1022+
'vitest/require-test-timeout': 0,
1023+
'vitest/require-to-throw-message': 1,
9941024
'vitest/require-top-level-describe': 0,
9951025
'vitest/valid-describe-callback': 1,
9961026
'vitest/valid-expect': [1, { alwaysAwait: true }],

package.json

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -36,57 +36,56 @@
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",
4646
"eslint:fix": "node --run eslint -- --fix",
4747
"typecheck": "tsc --build"
4848
},
4949
"devDependencies": {
50-
"@eslint-react/eslint-plugin": "3.0.0-rc.0",
50+
"@eslint-react/eslint-plugin": "^3.0.0",
5151
"@eslint/markdown": "^7.5.1",
52-
"@faker-js/faker": "^10.0.0",
53-
"@tanstack/react-router": "^1.132.31",
54-
"@tanstack/router-plugin": "^1.132.31",
55-
"@types/node": "^25.0.2",
56-
"@types/react": "^19.2.0",
57-
"@types/react-dom": "^19.2.0",
58-
"@vitejs/plugin-react": "^5.1.1",
59-
"@vitest/browser-playwright": "^4.0.16",
60-
"@vitest/coverage-istanbul": "^4.0.16",
61-
"@vitest/eslint-plugin": "^1.6.4",
52+
"@faker-js/faker": "^10.3.0",
53+
"@tanstack/react-router": "^1.166.7",
54+
"@tanstack/router-plugin": "^1.166.7",
55+
"@types/node": "^25.5.0",
56+
"@types/react": "^19.2.14",
57+
"@types/react-dom": "^19.2.3",
58+
"@vitejs/plugin-react": "^6.0.1",
59+
"@vitest/browser-playwright": "^4.1.0",
60+
"@vitest/coverage-istanbul": "^4.1.0",
61+
"@vitest/eslint-plugin": "^1.6.12",
6262
"clsx": "^2.1.1",
6363
"ecij": "^0.4.1",
64-
"eslint": "^10.0.1",
64+
"eslint": "^10.0.3",
6565
"eslint-plugin-jest-dom": "^5.5.0",
6666
"eslint-plugin-react-hooks": "^7.0.1",
67-
"eslint-plugin-sonarjs": "^4.0.0",
68-
"eslint-plugin-testing-library": "^7.13.5",
69-
"jspdf": "^4.0.0",
70-
"jspdf-autotable": "^5.0.2",
71-
"oxfmt": "0.38.0",
67+
"eslint-plugin-sonarjs": "^4.0.2",
68+
"eslint-plugin-testing-library": "^7.16.0",
69+
"jspdf": "^4.2.0",
70+
"jspdf-autotable": "^5.0.7",
71+
"oxfmt": "0.41.0",
7272
"playwright": "~1.58.0",
7373
"postcss": "^8.5.2",
74-
"react": "^19.2.1",
75-
"react-dom": "^19.2.1",
74+
"react": "^19.2.4",
75+
"react-dom": "^19.2.4",
7676
"rolldown": "1.0.0-rc.5",
77-
"rolldown-plugin-dts": "^0.22.1",
77+
"rolldown-plugin-dts": "^0.22.5",
7878
"typescript": "~6.0.1-rc",
79-
"typescript-eslint": "^8.56.0",
80-
"vite": "^8.0.0-beta.16",
81-
"vitest": "^4.0.17",
82-
"vitest-browser-react": "^2.0.2"
79+
"typescript-eslint": "^8.57.0",
80+
"vite": "^8.0.0",
81+
"vitest": "^4.1.0",
82+
"vitest-browser-react": "^2.1.0"
8383
},
8484
"peerDependencies": {
8585
"react": "^19.2",
8686
"react-dom": "^19.2"
8787
},
8888
"overrides": {
89-
"typescript": "$typescript",
90-
"vite": "$vite"
89+
"typescript": "$typescript"
9190
}
9291
}

test/browser/column/key.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ test('key is escaped in query selectors', async () => {
99
}
1010
];
1111

12-
await expect(setup({ columns, rows: [] })).resolves.not.toThrowError();
12+
await expect(setup({ columns, rows: [] })).resolves.not.toThrow();
1313
});

test/failOnConsole.ts

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
11
let consoleErrorOrConsoleWarnWereCalled = false;
22

33
beforeAll(() => {
4-
// replace instead of mutating `console` to avoid infinite loops
5-
globalThis.console = {
6-
...console,
7-
error(...params) {
8-
consoleErrorOrConsoleWarnWereCalled = true;
9-
console.log(...params);
10-
},
11-
warn(...params) {
12-
consoleErrorOrConsoleWarnWereCalled = true;
13-
console.log(...params);
14-
}
4+
console.error = (...params) => {
5+
consoleErrorOrConsoleWarnWereCalled = true;
6+
console.log(...params);
7+
};
8+
9+
console.warn = (...params) => {
10+
consoleErrorOrConsoleWarnWereCalled = true;
11+
console.log(...params);
1512
};
1613
});
1714

18-
afterEach(() => {
19-
// Wait for both the test and `afterEach` hooks to complete to ensure all logs are caught
15+
afterEach(({ task, signal }) => {
16+
// Wait for the test and all `afterEach` hooks to complete to ensure all logs are caught
2017
onTestFinished(() => {
21-
// eslint-disable-next-line vitest/no-standalone-expect
22-
expect
23-
.soft(
24-
consoleErrorOrConsoleWarnWereCalled,
25-
'console.error() and/or console.warn() were called during the test'
26-
)
27-
.toBe(false);
18+
// avoid failing test runs twice
19+
if (task.result!.state !== 'fail' || signal.aborted) {
20+
expect
21+
.soft(
22+
consoleErrorOrConsoleWarnWereCalled,
23+
'errors/warnings were logged to the console during the test'
24+
)
25+
.toBe(false);
26+
}
2827

2928
consoleErrorOrConsoleWarnWereCalled = false;
3029
});

0 commit comments

Comments
 (0)