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

import { createElement } causes "LWC1702: lwc" in jest test #5510

Open
rohledermarc opened this issue Mar 18, 2024 · 6 comments
Open

import { createElement } causes "LWC1702: lwc" in jest test #5510

rohledermarc opened this issue Mar 18, 2024 · 6 comments

Comments

@rohledermarc
Copy link

Type: Bug

Expected Behavior
Using the lightning web components extension and doing the following in a jest test with ignoring /tests/ through the .forceignore should not cause any problems:
import { createElement } from "lwc";

Actual Behavior:
Using the lightning web components extension and doing the following in a jest test with ignoring /tests/ through the .forceignore CAUSES problems:
import { createElement } from "lwc";
Problem: LWC1702: lwc

Extension version: 60.4.1
VS Code version: Code 1.87.2 (863d2581ecda6849923a2118d93a088b0745d9d6, 2024-03-08T15:20:57.520Z)
OS version: Darwin arm64 23.3.0
Modes:

Copy link

git2gus bot commented Mar 18, 2024

This issue has been linked to a new work item: W-15275731

@nwcm
Copy link

nwcm commented Jun 2, 2024

Seeing this with the standard __tests__/ dir in LWC components. **__tests__** in .forceignore does not work

@diyer
Copy link
Collaborator

diyer commented Jul 2, 2024

@rohledermarc Can you please describe the user impact of this bug?

@rohledermarc
Copy link
Author

@diyer all of your jest test files are marked red with a problem because of the import { createElement } from "lwc"; line. So you loose the overview, if there are real problems and it just looks awful if all files are marked red...
Tests are running fine, it seems just like false linting.

@rohledermarc
Copy link
Author

Still an issue... @diyer here you can see what I mean. Everything is red and looks like having issues, but it is all coming from that described issuing line...

image

@j-schreiber
Copy link

Change the import to import { createElement } from '@lwc/engine-dom';

Take note of the @lwc :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants