Skip to main content

Unable to resolve issue with default file created from sf generate component command.

sf project generate --name sampleProjectcd sampleProject npm installsf lightning generate component --name myComponent --type lwc --output-dir force-app/main/default/lwc

Open 'lwc/myComponent/__tests__/myComponent.test.js' file in vscode, problem is displayed.

How to fix vscode probrem LWC1702 on lwc's default test.js

I can't solve the problem because I don't have enough detail about this probrem.

  • I'ts only vscode problem
    • test running is fine 
  • .forceignore file is already added.
    • **/__test__/**
    • it is not compliation error
8 件の回答
  1. 2024年4月21日 16:46
    import { createElement } from '@lwc/engine-dom';

    Adding this resolved the error for me.

0/9000