Vitest UI Browser mode, not all test previews are available
Opened this issue · 5 comments
JacobPotter commented
When using Vitest UI with Browser mode, and using test suites, unable to preview individual tests in Browser UI:
Example code:
import {describe, expect, it} from "vitest";
import Line from "./Line";
import {render} from "vitest-browser-react";
import {FC} from "react";
describe('Line', () => {
it('renders without error', () => {
const {container} = render(
<Line
x0={0}
y0={0}
x1={10}
y1={10}
/>
);
expect(container.firstChild).toBeDefined();
});
it('renders with className', () => {
const {container} = render(
<Line
x0={0}
y0={0}
x1={10}
y1={10}
className='test-class'
/>
);
expect(container.querySelector('.test-class')).toBeDefined();
});
it('renders within given class', () => {
const Wrapper: FC = () => <div className="within-class"></div>;
const { container } = render(
<Line x0={0} y0={0} x1={10} y1={10} within="within-class" />,
{ wrapper: Wrapper },
);
const wrapperElement = container.parentElement;
expect(wrapperElement).toContainElement(container.firstChild);
});
});
sheremet-va commented
Not sure what you mean. The UI only shows the last running test, Vitest doesn't implement preview of different tests
JacobPotter commented
sheremet-va commented
in fact, I cannot run subtests in a suite from ui either
This has nothing to do with this package; this is how Vitest UI works at the moment. There is an open PR that implements this: vitest-dev/vitest#6641
sheremet-va commented
the preview from the last running test does not show if that test is part of a suite
This is interesting though, need to confirm first before closing
JacobPotter commented
Good to know, will watch the other PR for that. Let me know what you find on the second part though.