Hazyzh / jest-html-reporters

🌈 Reporter for jest test framework. 🌈
https://hazyzh.github.io/report.html
MIT License
522 stars 100 forks source link

Modify custom infos after tests #284

Closed FedericoDesio closed 11 months ago

FedericoDesio commented 1 year ago

Hi all, I would need to add to the report custom infos the coverage against swagger, i know the number of endpoint tested after all tests execution so i'm trying to set the process.env.JEST_HTML_REPORTERS_CUSTOM_INFOS var in "afterAll()" hook invoked from a file configured in "setupFilesAfterEnv", but it doesn't work maybe it is too late as the report has been already rendered..do you have any idea to do it? Thank you in advance. Federico

Hazyzh commented 11 months ago

I can trying to get custom infos a bit later, but I think it will still not worked. normal, setupFilesAfterEnv script will running in child process, so you will setup a env in child process, but the report script was running in main process, so the report script cannot got the values you set in setupFilesAfterEnv file script. unless you are using --runInBand to run test in current process.

FedericoDesio commented 11 months ago

Hi @Hazyzh , thanks for the reply. Yes I use the --runInBand jest parameter, so then with the last release of jest-html-reporters i can try to modify custominfo in setFilesAfterEnv?

Hazyzh commented 11 months ago

Hi @Hazyzh , thanks for the reply. Yes I use the --runInBand jest parameter, so then with the last release of jest-html-reporters i can try to modify custominfo in setFilesAfterEnv?

not yet, let have a try to see if we can support it.

Hazyzh commented 11 months ago

hi @FedericoDesio unfortunately, after testing I found that, even I using --runInBand then modify environment variable in setFilesAfterEnv script, still can not got the environment variable in report function. so maybe we can not support it.

image

FedericoDesio commented 11 months ago

Hi @Hazyzh, ok that’s a pity, i would like to add the swagger coverage percentage to the report custominfos, and I can calculate that value only after all the tests execution.