zenstruck / browser

A fluent interface for your Symfony functional tests.
MIT License
186 stars 17 forks source link

RFC Rename source code dump file to have .html extension #85

Closed benr77 closed 2 years ago

benr77 commented 2 years ago

The feature to dump the source code for a failed test to a file is very useful. It's something Codeception has done for a long time, and as a previous Codeception user, the first thing I tried to do with the dump file from a failed test was to try to open it in a browser to investigate the failure (using the PHPStorm "open in browser" feature).

However, this does not work as expected as PHPStorm will not offer the installed browsers as options, because the file extension is .txt. I see why this has been chosen, as the HTTP headers are also included at the start of the file before the source code.

Can I suggest that the source code file is instead saved with a .html extension, and that the HTTP headers at the start of the file are wrapped in an HTML comment tag, to make it a valid HTML file. This way the extension will better represent what the file contents are, and it will allow direct opening in a browser, using either PHPStorm or the OS default application.

I will submit a PR with these changes, but wanted to first double check that this change is acceptable.

Thanks