Migrating to @stencil/vitest leads to all tests failing with TypeError: Prop is not a function
#6755
Replies: 2 comments 1 reply
-
|
hey @kleinfreund - sorry to hear you're having issues. If I had to guess, it sounds like vitest is trying to process some of your stencil component code? Here's a codesandbox (or the corresponding gh repo) where tests seem to be running ok - see if you can see anything obvious. If you find anything make a branch and I'll take a look
|
Beta Was this translation helpful? Give feedback.
-
|
ohhh @kleinfreund I see the issue and sorry for the confusion ... this snippet: import { render, h, describe, test, expect } from '@stencil/vitest';
import './my-component.js';
describe('my-component', () => {
test('renders', async () => {
const { root } = await render(<my-component></my-component>);
await expect(root).toEqualHtml(`
<my-component><p>Hi</p></my-component>
`);
});
});Stencil/vitest offers 2 different ways of component testing:
When you do |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I'm trying to migrate a Stencil project that currently uses
stencil test --spec(with Jest 29) to usestencil-test --prod --project spec(with@stencil/vitest). The tests are currently working; however, once I migrate, every single test fails withTypeError: Prop is not a function(Propjust happens to be the "earliest" decorator in the file; any other Stencil decorator moved before it fails as well).using:
@stencil/vitest@1.13.2andvitest@4.1.9test command:
stencil-test --prod --project specgot
buildDist: trueinstencil.config.tsgot
jsc: 'react', jsxFactory: 'h', jsxFragmentFactory: 'Fragment'intsconfig.jsoncompiler optionsthe
specproject config invitest.config.ts(otherwise only references the stencil config)vitest.setup.ts:await import('./dist/components/index.js'); export {};example component being tested:
test:
The decorators no longer working seems like such a basic issue for which I couldn't find a corresponding GitHub issue that I must be doing fundamentally wrong, but at the same time: it worked before and it's only with this migration attempt, that the decorators start to fail.
Beta Was this translation helpful? Give feedback.
All reactions