The current test setup includes a lot of repetition. While this does ensure that the code is thoroughly tested, it would be good to reduce some of this repetition in order to speed up the build process.
Initially, I think a lot could be said for adding more structure to the test descriptors. I'd especially like to separate tests for convert methods with tests for convertFile.
We also need to add tests for the CLI. I think these should also be kept separate from the API methods so that we can fine grain the tests to target the CLI. We need to cover all 3 flows for the CLI as well (i.e. files, STDIN -> STDOUT, STDIN -> filename), but we should be able to reuse the same tests. All options should be covered by these tests. The CWD should be set based on whether or not the test is "core" (i.e. defined in convert-svg-test-helper).
It might also be good to only run a specified number of success and/or failure tests against the methods on API, since this is much slower than those on Converter (as these tests share an Converter instance which avoids lots of Chromium instances being created and destroyed).
I realize that these changes might make the JSON a bit more noisy, but it should make it easier to manage. We could even consider splitting the above into multiple files, if it would help.
I'm not sure if it should fall under this issue, but I'd also like to replace our fixture images to some created by us. I'm not sure about the origin of these images, to be honest, as I took them from svg2png which was my inspiration for the original convert-svg-to-png package, released under WTFPL. Since these are technically published by convert-svg-test-helper, however, I'd feel more comfortable owning them. The standard.svg is an exception, which I grant permission to use, however, even then I would like to use completely impartial images that serve the unique purpose of testing these packages.
The current test setup includes a lot of repetition. While this does ensure that the code is thoroughly tested, it would be good to reduce some of this repetition in order to speed up the build process.
Initially, I think a lot could be said for adding more structure to the test descriptors. I'd especially like to separate tests for
convert
methods with tests forconvertFile
.We also need to add tests for the CLI. I think these should also be kept separate from the API methods so that we can fine grain the tests to target the CLI. We need to cover all 3 flows for the CLI as well (i.e. files, STDIN -> STDOUT, STDIN -> filename), but we should be able to reuse the same tests. All options should be covered by these tests. The CWD should be set based on whether or not the test is "core" (i.e. defined in
convert-svg-test-helper
).For example;
It might also be good to only run a specified number of success and/or failure tests against the methods on
API
, since this is much slower than those onConverter
(as these tests share anConverter
instance which avoids lots of Chromium instances being created and destroyed).I realize that these changes might make the JSON a bit more noisy, but it should make it easier to manage. We could even consider splitting the above into multiple files, if it would help.
I'm not sure if it should fall under this issue, but I'd also like to replace our fixture images to some created by us. I'm not sure about the origin of these images, to be honest, as I took them from svg2png which was my inspiration for the original
convert-svg-to-png
package, released under WTFPL. Since these are technically published byconvert-svg-test-helper
, however, I'd feel more comfortable owning them. Thestandard.svg
is an exception, which I grant permission to use, however, even then I would like to use completely impartial images that serve the unique purpose of testing these packages.