This thread is trying to answer question "Is there a difference between spec.ts files and test.ts files?"
Personal preference, and in many places required best practice. But the hard answer is no, you don't hae to use .spec.ts
It does however, allow you to more easily isolate or find files in your config if all test files have a common suffix
// Other Jest configuration options...
testRegex: '\\.(test|spec)\\.ts$', // Recognize files with .test.ts or .spec.ts extension
};```
I love how so many convey "personal preference" as best practice on any issue, all the while there often is not standard... My personal choice would be to follow the convention that are in the docs. Something about when in Rome, do as... Being around as long as i have programming it seems most often the "Best Practices" change every 2 or 3 years π. I use to do a lot of "Business" programming working at banks, and we had set of rules to follow, a friend worked at Boeing and he had federally mandated standards he had to follow. Interesting so many points for "best practice" were different. Then another friend iworked as a games programming, ha! you guessed it, his "best practices" were again different from all of us... In the end would say "Best Practice" is defined where you work, that for me is the "Best Practice", as it will best help you to stay employed π Then even though some "practices" are ridiculous say like no lines longer than 80 characters, another place was do what you think looks best to read the code... Which is better? Often seems more like a religious argument... The one thing i would push is to be consistent and all code follows the same style, and thus the coding standards doc, and this often changes where ever you work at...
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].