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

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

2 Answers 2


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

  • 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. Commented Aug 18, 2023 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. Commented Aug 18, 2023 at 15:07
  • Same issue, I already have tests in my .forceignore file # LWC Jest /__tests__/
    – muchavie
    Commented Dec 24, 2023 at 14:24

I changed

import { createElement } from 'lwc';


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

and that seems to have taken care of it.

You must log in to answer this question.

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