Skip to content

Various test tweaks - #4012

Merged
nstepien merged 2 commits into
mainfrom
testssss
Mar 23, 2026
Merged

nstepien merged 2 commits into
mainfrom
testssss

Conversation

@nstepien

Copy link
Copy Markdown
Collaborator

No description provided.

@nstepien nstepien self-assigned this Mar 22, 2026
Comment thread src/DataGrid.tsx
const [min, max] =
previousRowIdx < rowIdx ? [previousRowIdx, rowIdx] : [rowIdx, previousRowIdx];

for (let i = min + 1; i < max; i++) {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed a bug Claude found

? firefoxCI
: firefox;
const gridTemplateColumns =
server.browser === 'chromium' ? chrome : import.meta.env.CI ? firefoxCI : firefox;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking server.browser instead of navigator.userAgent seems safer.
Also moved CI check to import.meta.env.CI instead of defining a global variable, seems more idiomatic.

// failing test
// cannot use `test.fails` as console logs lead to timeout in parallel tests
// https://github.com/vitest-dev/vitest/issues/9941
test.skip('virtualization is disabled with some frozen columns', async () => {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no virtualization + frozen columns = we render frozen columns multiple times, leading to duplicate key warnings.
I'll fix it in a separate PR

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙈

Comment thread test/failOnConsole.ts
console.error = (...params) => {
// use split mocks to not increase the calls count when ignoring undesired logs
const errorMock = vi.fn(console.error).mockName('console.error');
vi.spyOn(console, 'error').mockImplementation(function error(...params) {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread vite.config.ts

const isCI = process.env.CI === 'true';
const isTest = process.env.NODE_ENV === 'test';
const isTest = process.env.VITEST === 'true';

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL

Comment thread vite.config.ts
},
plugins: [
ecij(),
(!isTest || isPreview) &&

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check wasn't working correctly...

Comment thread vite.config.ts
}),
react()
],
plugins: isPreview

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now properly disable plugins when running preview

Comment thread vite.config.ts
routesDirectory: 'website/routes',
autoCodeSplitting: true
}),
react()

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure react() does anything when running tests... tests work fine without it, I left it just in case.

Comment thread vite.config.ts
}
},
slowTestThreshold: 1000,
browser: {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deduped browser settings

@nstepien
nstepien marked this pull request as ready for review March 22, 2026 21:08
@nstepien
nstepien requested a review from amanmahajan7 as a code owner March 22, 2026 21:08
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.41%. Comparing base (b830cbc) to head (f4dab4c).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4012   +/-   ##
=======================================
  Coverage   97.41%   97.41%           
=======================================
  Files          37       37           
  Lines        1470     1470           
  Branches      471      472    +1     
=======================================
  Hits         1432     1432           
  Misses         38       38           
Files with missing lines Coverage Δ
src/DataGrid.tsx 98.91% <100.00%> (ø)
src/utils/index.ts 90.90% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@amanmahajan7 amanmahajan7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great

await testSelection(1, false);
await testSelection(2, false);

// backward selection

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

// failing test
// cannot use `test.fails` as console logs lead to timeout in parallel tests
// https://github.com/vitest-dev/vitest/issues/9941
test.skip('virtualization is disabled with some frozen columns', async () => {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙈

Comment thread test/failOnConsole.ts Resolved
Comment thread vite.config.ts

const isCI = process.env.CI === 'true';
const isTest = process.env.NODE_ENV === 'test';
const isTest = process.env.VITEST === 'true';

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL

Comment thread vite.config.ts Resolved
@nstepien
nstepien merged commit a5d99e8 into main Mar 23, 2026
1 check passed
@nstepien
nstepien deleted the testssss branch March 23, 2026 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants