Stenciljs autocomplete the unit testing files when the tsx files are changed
Is there a way to autocomplete the .spec.tsx
file so that it matches the changes made in the .tsx
file or every time it has to be done by hand. To be more precise, I would like to autocomplete expect(page.root).toEqualHtml(RIGHT_HERE)
.
Here is an example:
import { newSpecPage } from '@stencil/core/testing';
import { MyComp} from './mapc-events';
describe('my-component-name', () => {
it('renders', async () => {
const page = await newSpecPage({
components: [MyComp],
html: `<my-component></my-component>`,
autoApplyChanges: true
});
expect(page.root).toEqualHtml(`
<my-component>
<mock:shadow-root>
<slot></slot>
</mock:shadow-root>
</my-component>
`);
});
});
Unfortunately that's not possible at this time, as toEqualHtml
accepts a string argument (I.E. it's just as acceptable to TypeScript's type checker to pass it 'HelloWorld' or any other invalid HTML). There's no great way for a development environment to recognize a change in the TSX of a stencil component and reflect that properly in the string provided to toEqualHtml