Append links HTML if no </head>
tag is found
#135
Append links HTML if no </head>
tag is found
#135
Conversation
Signed-off-by: Andrew Welch <andrew@nystudio107.com>
Thanks! Would you mind adding a unit test? |
I don't know how I could reasonably do it for this? Be happy to try if you guide me tho. |
@brunocodutra happy to do whatever it takes, I just need some guidance on what you need / how to implement it |
@khalwat sorry for the sparce response from my side, I'm currently on a trip. You mentioned you decided to target the branch that supports v4 of html-webpack-plugin, is there anything preventing this PR from targeting master? The reason I ask is that currently the support for v4 of html-webpack-plugin can't be merged, because it lacks unit tests for that version, which may make it harder for you to add unit tests for your PR. In any case, you should be able to replicate any of the currently existing unit tests. You will likely have to create a new fixture for the expected output of your changes, because it is expected to generate a completely different HTML from the other ones. Let me know if you need specific guidance. |
It looks like the code isn't exactly the same for the
The primary difference is that the promise passes in the |
For my purposes, I'm only really interested in the I've never created a fixture for unit tests for a JavaScript project before, though, so I'm probably not the best person to do it. |
These fixtures are really nothing fancy - simply generate the output as you would for any project and copy into that folder, that's it. Unit tests are supposed to generate the files in some temporary folder and compare (bitwise) them against the fixtures. Don't worry about targeting master then, just bear in mind when generating the fixtures that unit tests still use html-webpack-plugin v3. |
Alrighty, I'm going to give it a go. Question: is html-webpack-plugin v3 compatible with webpack 4? I was going on the assumption that html-webpack-plugin v4 was needed for webpack 4 (thus the reason for me using it at all), but I think that assumption may be faulty? If that's the case... then I could easily make the PR against As I've never set up a JavaScript unit test in this fashion, I assume I'd just need to:
Then my remaining question is... how to run the tests? I'm guessing it's as simple as just executing it with node? |
Awesome!
Yes.
Correct.
Either that or just create a new file just for it.
Tests need to be run through ava. The easiest is to run |
Looking good!
I'll close this PR and make a new one for the current |
As per the discussion here:
#134
Signed-off-by: Andrew Welch andrew@nystudio107.com