-
Notifications
You must be signed in to change notification settings - Fork 787
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jest tests failed when you extend component with other class #272
Comments
Hello! Thank you for opening an issue with us! Would you be able to upload that code to a GitHub repo for me to pull down? |
@alepop - Thank you for the repo. I was able to come up with some workarounds for you. First, make the base class a component as such: import { Component } from '@stencil/core';
@Component({
tag: 'some-base'
})
export class SomeBase {
public log() {
console.warn('log');
}
} That fixes the test. There is code that is processing the meta-data as we translate the TypeScript into JavaScript for Jest. This is apparently not expecting naked base classes. Now the tests will work. But... this still won't build:
To get around this, rename the file from I created a PR against your repo to show these fixes. |
@kensodemann good job! Thank you so much! Keep going with your amazing project |
A bit more on that. I got to thinking why I had to do that, looking more into the error message. Another workaround is to leave the name of the file as I am not really sure I like that as solution, though, since each base component should really be in its own file named after the class that is in it (at least if following LIFT to any degree), so I much prefer |
We have an open issue already on that last bit: #235 So the end result of this issue is just clarifying how extending a base-class should work. |
fixed 4cc7e63 |
Stencil version:
I'm submitting a:
Current behavior:
When you import
class
from another module it causes error on a test.Expected behavior:
There is no error during the test
Steps to reproduce:
Update code of the
stencil-starter
to this:./src/utils/index.ts
:./src/components/my-name/my-name.tsx
:the same error happens when i extend component with imported
class
Project structure:
The text was updated successfully, but these errors were encountered: