Jest Test files generated by IC don't match SF suggested filenames

Issue #2031 resolved
Aidan Harding created an issue

It’s great that I can use New->Lightning Web Component Test to generate a test file.

However, the default filename doesn’t match the suggested format from SF. They suggest

Jest runs JavaScript files in the __tests__ directory. Test files must have names that end in .js, and we recommend that tests end in .test.js. 

See https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.unit_testing_using_jest_create_tests#unit_testing_using_jest_create_tests__naming

IC creates the right directory, but the default filename is myComponentTest.js instead of myComponent.test.js

Can we change that?

Comments (4)

  1. Scott Wells repo owner

    Thank for pointing this out, Aidan. Yes, IC should follow documented best practices/recommendations. I've updated the default filename for a created Jest test accordingly for inclusion in the next build.

  2. Log in to comment