New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support a default HTML wrapper #39
Comments
We have default HTML files which are automatically provided when the test does not have it's own. |
The purpose of this request was for us to be able to provide a customized default HTML file besides the auto-generated one that the runner creates. Is that capability available now? |
Ah I see, no that isn't an option today. Will leave this open for consideration. |
👍 |
I think what this would take is adding some support for configuration in |
@natebosch are you still open for a PR on this feature? I'd be happy to look into this. |
Another option here would be to do this with a builder - it would be pretty trivial but would require the use of build_runner. However that is already a dependency for almost any web project. That way the EDIT: If there is already a basic templating language implemented (and that is how the default html file works) then doing something in this package is likely reasonable. |
Using |
You can't run the tests (in debug mode at least) until the whole package is built anyways - so I think for most users this wouldn't matter. Note that it does also now have the ability to only build a specific glob of files via the |
Hmm when I run a single test it only builds the files that are actually imported from that test (and their dependency graph ofc) |
If you run Also, as I mentioned you can now do the same with |
I talked with @natebosch a bit about this. We would be open to taking a PR for this in the test package. We would however like to ensure that it is very limited in scope. Most likely this means only supporting a single special placeholder in the template, which is for test file name. This would be string replaced to create the resulting html file. This will ensure we don't need to add any additional dependencies, and the maintenance burden would be very low. |
Ok, sounds good, I'll see what I can do. |
@jakemac53 I got something working, but I'm wondering what is the best way to create the resulting html file? Is just just |
It should be possible to never write this file to disk at all but simply add an extra handler to the test server which knows how to serve it when requested. I believe that is how the existing default html files are done. You can look at the browser platform code probably to find this - I can dig a bit and see if I can find a good link for you. |
|
Thanks @jakemac53 that's interesting, I was actually looking at
When are these different codepaths taken? |
I believe that what I linked is always what is used unless running in That part you linked is just where it is assigning the URL from which the suite should be loaded - but it doesn't actually generate the html. That is done in the handler, when the files are requested (assuming no explicit custom html file). |
Ah that makes sense. I missed the point that the handler will get called only when there isn't an actual file found. Thanks! |
This allows for reusing one template file across all tests in use cases where external scripts or html elements are required for all tests. The possibility to still use local html files per test file is retained. Fixes #39
For our use case we want to be able to provide a default HTML file instead of one for every test file. See have this PR into test_runner.dart googlearchive/test_runner.dart#35 for how we are accomplishing that there.
The text was updated successfully, but these errors were encountered: