Conversation
|
Should these tests be including in the Are we going to want to run these in ci? /cc @nodejs/build |
|
@thealphanerd I put them there because tools/doc is its own independent package which could be distributed separately from node code. |
tools/doc/tests/test_json.js
Outdated
There was a problem hiding this comment.
Any reason not to use assert.equal(output.source, 'foo'), assert.deepStrictEqual(output, item.json)?
There was a problem hiding this comment.
Because I didn't know those existed. Let me fix that.
931ff1d to
f240d02
Compare
Should definitely run in ci.
I think these tests should be in docs/ |
|
This PR adds |
Yes. Tests should go in the As far as where in the |
I see the logic there and wouldn't stand in the way if others agreed. I look at it this way, though: All tests for the project are in the |
CI runs the |
|
Another argument for adding these to the project-wide EDIT: Putting them in |
|
Last comment for now, I promise, sorry for the storm of notifications: YES YES YES! +100 to having some tests for the doc tools. |
|
@Trott I don't have access to a windows system. I could put some code in vcbuild.bat and hope that it works if you'd like. |
One more benefit to putting these tests in |
|
@Trott here's a version with the tests living under |
💯 😍 👍 |
|
@thealphanerd @jasnell I'm adding the |
tools/doc/tests/test_html.js
Outdated
| @@ -0,0 +1,50 @@ | |||
| 'use strict'; | |||
|
|
|||
| var assert = require('assert'); | |||
There was a problem hiding this comment.
Nit (which means you can ignore this comment if you want to): The project has been favoring const over var for module imports like this.
|
👍 |
|
I think that is pretty much what @silverwind intended. Good stuff. |
tools/doc/tests/test_html.js
Outdated
| }); | ||
| } | ||
|
|
||
| test_toHTML(); |
There was a problem hiding this comment.
Can we not wrap this in a function. With this being the only thing in the file, it's a bit redundant.
|
Thanks for the contribution! I'm with @Trott. Please make every variable I would prefer that we keep these in the |
tools/doc/tests/test_html.js
Outdated
| // Test data is a list of objects with two properties. | ||
| // The file property is the file path. | ||
| // The html property is some html which will be generated by the doctool. | ||
| // This html will be stripped of all whitespace. |
There was a problem hiding this comment.
Maybe change the comment to state that it will be stripped of all unnecessary whitespace?
Edit: disregard. I just realized why you were doing that. Maybe update the comment to be more clear?
|
Looks like CI passed. |
|
Looks like the new tests got picked up fine: https://ci.nodejs.org/job/node-test-commit-linux/3062/nodes=debian8-64/tapTestReport/test.tap-1065/ LGTM |
7da4fd4 to
c7066fb
Compare
|
@silverwind Is there anyone else I need to get to take a look at this? |
test/doctool/test-doctool-html.js
Outdated
There was a problem hiding this comment.
shouldn't common.mustCall... be aligned with input?
|
@iankronquist after you've handled above comments, I suggest you squash the commits into a single one and add a nice summary of the changes in the commit message. |
Addresses nodejs#5955 on GitHub. * Test the toHTML function in html.js. Check that given valid markdown it produces the expected html. One test case will prevent regressions of big nodejs#5873. * Check that when given valid markdown toJSON produces valid JSON with the expected schema. * Add doctool to the list of built in tests so it runs in CI.
b7968ed to
94318cd
Compare
|
@silverwind fixed & squashed. |
* Test the toHTML function in html.js. Check that given valid markdown it produces the expected html. One test case will prevent regressions of #5873. * Check that when given valid markdown toJSON produces valid JSON with the expected schema. * Add doctool to the list of built in tests so it runs in CI. PR-URL: #6031 Fixes: #5955 Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Rich Trott <rtrott@gmail.com>
|
Thanks! Landed in 2e845f8 with some minor corrections to the commit message. Nice work! |
|
Yes, really nice. Thx for the effort. Time to try it myself :) Awesome guys. |
|
@silverwind excellent, thanks! |
* Test the toHTML function in html.js. Check that given valid markdown it produces the expected html. One test case will prevent regressions of #5873. * Check that when given valid markdown toJSON produces valid JSON with the expected schema. * Add doctool to the list of built in tests so it runs in CI. PR-URL: #6031 Fixes: #5955 Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Rich Trott <rtrott@gmail.com>
|
if someone would like to see this landed it will need to be manually backported |
|
@thealphanerd didn't this land in 2e845f8? Do you mean landed in the next release? |
|
Sorry for not being exact... I was referring to lts |
* Test the toHTML function in html.js. Check that given valid markdown it produces the expected html. One test case will prevent regressions of #5873. * Check that when given valid markdown toJSON produces valid JSON with the expected schema. * Add doctool to the list of built in tests so it runs in CI. PR-URL: #6031 Fixes: #5955 Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Rich Trott <rtrott@gmail.com>
* Test the toHTML function in html.js. Check that given valid markdown it produces the expected html. One test case will prevent regressions of #5873. * Check that when given valid markdown toJSON produces valid JSON with the expected schema. * Add doctool to the list of built in tests so it runs in CI. PR-URL: #6031 Fixes: #5955 Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Rich Trott <rtrott@gmail.com>
* Test the toHTML function in html.js. Check that given valid markdown it produces the expected html. One test case will prevent regressions of #5873. * Check that when given valid markdown toJSON produces valid JSON with the expected schema. * Add doctool to the list of built in tests so it runs in CI. PR-URL: #6031 Fixes: #5955 Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Rich Trott <rtrott@gmail.com>
Pull Request check-list
make -j8 test(UNIX) orvcbuild test nosign(Windows) pass withthis change (including linting)?
test (or a benchmark) included?
existing APIs, or introduces new ones)? (N/A)
Affected core subsystem(s)
tools/doc
Description of change
Add tests for tools/doc. Fixes #5955. Includes tests for the functions toHTML (in html.js) and doJSON (in json.js). Also includes a regression test for #5873. Also introduces a new make target to run the tests.
I expect to be asked to squash these commits.