Currently, I am working on writing tests with Playwright within the /tests
directory.
I want to include some helper functions that can be placed in the /tests/lib/helpers
folder.
- When the import does not specifically have a
.ts
extension, tests throw a module not found error. - However, if the import includes a
.ts
extension, IDE/Eslint raises an issue:
. Despite this warning, the imported scripts are compiled successfully and function properly.TS2691: An import path cannot end with a '.ts' extension. Consider importing './lib/helpers/fresh-storage.js' instead
If I were to move these helper functions to the /src/lib
directory and import them into /tests
, there would be no issues. Therefore, I believe it is possible to adjust a configuration setting somewhere to allow for importing typescript modules from /tests
similar to how it is done from /src/lib
currently.