Skip to content
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

Impossible to test components with custom render method and template(s) #7

Closed
seckardt opened this issue May 22, 2024 · 0 comments · Fixed by #20
Closed

Impossible to test components with custom render method and template(s) #7

seckardt opened this issue May 22, 2024 · 0 comments · Fixed by #20

Comments

@seckardt
Copy link

In an attemot to test SSR'ing of a component wrapping the <lightning-combobox> we came across an Error trying to execute renderToMarkup without any additional hint about what could possibly have gone wrong. After a lengthy debugging session trying to narrow down the culprit, we ended up seeing that taking the <lightning-base-combobox-item> out of the DOM suddenly made the complation at least pass. Looking into that component - trying to figure out the root cause - two things became apparent:

  1. The component uses a custom render method conditionally returning one of two possible templates.
  2. None of the two templates is using the component's name.

The moment we introduced a third template with the component's name (without even importing/referencing this template somewhere), the problem went away. So there must be a subtle issue/difference in the way the LWC compiler behaves in the test runner compared to other stacks like LWR or existing Jest tests.

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 a pull request may close this issue.

1 participant