Closed johncowen closed 4 years ago
@johncowen based on what we talked about, I updated the logic so that:
['none']
)'all'
anywhere in the config array will give you all of the components'none'
will only be considered if it's the only item in the arrayand updated the tests to match this. How's that all look to you?
Hey Matthew!
Yeah I defo prefer the 'it's always an array thing'. So yeah this looks good to me, so I'd say merge it as is. I think either of us can merge yeah? So feel free to merge in.
@johncowen awesome, thanks for bringing this up and adding those tests! And agreed re: always being an array and giving users more feedback (if they're looking at their server output 😬).
This PR mainly tests out the
filterComponents
method. In order to do this easier I made thefilterComponents
method accept a Funnel-like class as a third method, which if not passed it defaults to the real Funnel class. (I'm not sure if the node version we are targeting here supports default args but we can swap that out if not)Secondly I've included some tests to understand/prove what
filterComponents
does, pretty much which regular expression it will use depending on what you pass to it. The most important thing I found from doing this was that having anconfig.include
prop as['components/st-single-component']
would use the default (/components\/
) regular expression (see lines 89-92 ofindex-test.js
)Lastly I tested that when I pass
config.include
prop as['components/st-single-component']
to theexclusionFn
method when using the default regular expression that it doesn't exclude it - i.e. theexclusionFn
method returnsfalse
(see lines 184 - 187 ofindex-test.js
) - I would like this component to be included but no others. I've commented these lines out for the moment as they don't pass.I'm honestly not sure if I'm testing this right or what is expected here, so I thought I'd PR it anyway and we can catch up whenever see if I've done this completely wrong and we can close this PR or we need to tweak the behaviour.