1

Validation is failing due to this error . I have created new LWC component, it defaults created test.js file .I have removed and have only my component html,js and meta.xml file .I created PR in GitHub and validation fails . Can anyone please support here

2
  • Do you have tests folder inside the lwc component?
    – tugce
    Sep 9, 2022 at 10:43
  • createElement is used in jest test files
    – Damecek
    Sep 9, 2022 at 11:43

1 Answer 1

9

The Jest Unit-Tests should not be deployed to the org. You need to add a .forceignore file to your project.

Use this file as a template: https://github.com/trailheadapps/visualforce-to-lwc/blob/main/.forceignore

2
  • I get the above validation error in the jest test file. I'm not deploying to the org. I can see that sfdx Deploy is not deploying the just test js file. The test passes. It just fails validation in the __tests__\...test.js file. Aug 18 at 14:08
  • Update: I deleted the import line, but that caused a massive runtime error. Then I added it back (<ctrl>z). The runtime error and the validation error are now gone. Maybe it takes a while for all the configuration to get consumed and active. Also, my .forceignore file already had the test folder ignored. The behind-the-scenes magic must have done that. Aug 18 at 15:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .