mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
node tests: Remove features to output HTML to files.
I don't think anybody ever really used this feature, which I developed but don't even use myself. It kind of runs counter to the minimalist approach of the rest of node tests. I would eventually like to re-think the template tests altogether. They're slow, and we could solve that somewhat by replacing jsdon/jquery with an HTML parser library to verify structural things. It's also possible that we can just rely on our template linters to catch the biggest class of errors (malformed tags) and let code review do the rest. And it's also possible that we should make a second attempt to ramp up tooling on making it easy to verify templates, but it doesn't have to be part of the node tests. If we did that, we would also potentially use tooling for Python-side templates.
This commit is contained in:
@@ -35,26 +35,6 @@ see if there are corresponding test in `frontend_tests/node_tests`. If
|
||||
there are, you should strive to follow the patterns of the existing tests
|
||||
and add your own tests.
|
||||
|
||||
## HTML output
|
||||
|
||||
The JavaScript unit tests can generate output to be viewed in the
|
||||
browser. The best examples of this are in `frontend_tests/node_tests/templates.js`.
|
||||
|
||||
The main use case for this mechanism is to be able to unit test
|
||||
templates and see how they are rendered without the complications
|
||||
of the surrounding app. (Obviously, you still need to test the
|
||||
app itself!) The HTML output can also help to debug the unit tests.
|
||||
|
||||
Each test calls a method named `write_handlebars_output` after it
|
||||
renders a template with similar data. This API is still evolving,
|
||||
but you should be able to look at existing code for patterns.
|
||||
|
||||
When you run `tools/test-js-with-node`, it will present you with a
|
||||
message like "To see more output, open var/test-js-with-node/index.html."
|
||||
Basically, you just need to open the file in the browser. (If you are
|
||||
running a VM, this might require switching to another terminal window
|
||||
to launch the `open` command.)
|
||||
|
||||
## Coverage reports
|
||||
|
||||
You can automatically generate coverage reports for the JavaScript unit
|
||||
|
||||
Reference in New Issue
Block a user