fix(core): not working first plugin when icon option enabled#137
Conversation
Codecov Report
@@ Coverage Diff @@
## master #137 +/- ##
==========================================
- Coverage 88.75% 88.55% -0.21%
==========================================
Files 25 26 +1
Lines 418 428 +10
Branches 112 100 -12
==========================================
+ Hits 371 379 +8
- Misses 34 42 +8
+ Partials 13 7 -6
Continue to review full report at Codecov.
|
|
Ah nice, we bumped into the same problem today as well! Thanks for the PR, that should fix the problem yes 🙌 One minor suggestion maybe: how about extracting the "config merging" into a separate function and test that? Relying on an SVG snapshot to test merged configs is kind of not intuitive. I/we can also open up a new PR to improve the testing if we don't want to do that in this PR. |
|
|
||
|
|
||
| function concatArrays(objValue, srcValue) { | ||
| if (isArray(objValue)) { |
| const svgoRcConfig = await explorer.search(filePath) | ||
| const svgo = new SVGO( | ||
| merge(getBaseSvgoConfig(config), svgoRcConfig, config.svgoConfig), | ||
| mergeWith(getBaseSvgoConfig(config), svgoRcConfig, config.svgoConfig, concatArrays), |
There was a problem hiding this comment.
Nitpick: like suggested, I would extract the "merging" into a separate function and test that in isolation to make sure the "merged" config is correct.
|
@emmenko thank you for comments! just make improvements on your suggestions! what about it? |
|
Cool, thanks! Much better now 👌 PS: can you run prettier on the changed/test files? The formatting looks weird. |
|
@emmenko sorry for formatting! done with prettier. |
|
Awesome thanks 🙏 ! |
Hello! Just got not working plugin when enable
iconoption.Problem:
not working config:
working config:
Solution: add lodash merge function for concat arrays instead merge them and add test for it.