syzzana / indent-list-reporter

Playwright list reporter with colorful terminal and indentation
MIT License
2 stars 1 forks source link

The reporter doesn't work properly for Playwright with TypeScript #63

Open vgagaleski opened 2 months ago

vgagaleski commented 2 months ago

I was looking for a simple terminal-reporter in order to improve my Playwright test results when I saw indent-list-reporter. The functionality is all I need, but unfortunately I cannot make the reporter run with my project. The reporter is failing to import my playwright.config.ts file.

I tried to debug, and it seems like the import for the playwright.config.ts is failing. The first reason was an external package for managing env vars that I use - https://www.npmjs.com/package/envconfig and then it reverts to playwright.config.js

Did you mean to import dotenv-defaults/config.js?
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/playwright-e2e-testing/playwright.config.js' imported from /playwright-e2e-testing/node_modules/indent-list-reporter/dist/src/loggin-tests-data.js

I also tried removing the problematic package completely which triggered the indent-list-reporter, but it failed right after because of:

Error in reporter TypeError: Cannot read properties of undefined (reading 'file')

Which fails here:

const fileLocationStyle = styleErrorFileLocation(error.location);

Am I doing something wrong, or just there is no proper support for TypeScript yet? :)

On another note: I think it is not great to hardcode the playwright config file as there are a lot of examples where the name could be different or there might be even multiple config files where we would like to use the reporter.

syzzana commented 1 month ago

Hi @vgagaleski. Thank you for opening the issue. Hm yes the TS config is tricky, I tried to solve it before, I tried a different solution which I thought fixed the problem but look like that's not the case. I tested with the npm link feature to import the package. I will try to debug again and release a in the next two weeks. About the config naming, thank you that is a really good idea, I have not thought about that before. I will include this with the fix too.

Thank you!!