I'm trying to write some tests using Playwright inside /tests
folder.
I'd like to use some helper functions which I could put under /tests/lib/helpers
.
.ts
extension is not explicitly specified in the import.TS2691: An import path cannot end with a '.ts' extension. Consider importing './lib/helpers/fresh-storage.js' instead
. Though the scripts are being imported, successfully compiled and are functional.If I would be to add this helper function under /src/lib
and import them in /tests
there would be no problems. So I assume I should be able change some config somewhere to be able to import typescript modules from /tests
just like I can from /src/lib
at the moment.
Alias has to be set in svelte.config.js
// svelte.config.js
const config = {
kit: {
...
alias: {
'$tests': 'tests',
'$tests/*': 'tests/*',
}
}
};