Closed denysdovhan closed 2 years ago
I would be interested it looking into what automated testing could be applied.
shunit2 seems to be a good option. bhilburn/powerlevel9k theme has a test suit with shunit2. There is also a discussion about testing themes in here by @denysdovhan
Huge change to theme is being developed with #78 . So, It might be better to hold off testing until it's merged.
I'm not sure about unit testing library. Don't know how to implement tests properly. Actually, I was wondering about creating unified code base in one of high level scripting languages, like Python or JavaScript. Beside single code base there should be a loaders (adapters) for different shells. On my opinion, with that approach we can achieve few important benefits:
That's just an idea, but here is my attempt with default Oh-My-Zsh theme — robbyrussell. What do you think?
@denysdovhan what is the speed like with the rewritten JS version of robbyrussel?
@jwkicklighter we didn't achieve significant performance speed up.
@salmanulfarzy @maximbaz I'd like to pay your attention to this issue since it should have top priority for us. Spaceship has a lot of sections and it's easy to break something without noticing. We should finally find the way to test Spaceship at least for basic functionality.
@denysdovhan I was more concerned with it being less performant, which I guess it isn't based on your comment
I've no idea where to begin from and what to test. There isn't much to take reference from prompts that are tested. But following the powerlevel9K path, Made a single passing test about char
section and confused about how to proceed. If this the right approach, I can make a WIP pull request that we can further work.
ZUnit looks promising with powerful assertion library for Zsh specific testing. I haven't worked on this yet.
@salmanulfarzy your example of tests for chat
section LGTM. I would prefer to use shunit
since it's more trusted and battle-tested. Can you give any advantages of using Zunit?
I'm actively working on writing tests for all sections that have been ported from spaceship to spacefish so far. If it would help get this PR started, I encourage you to port over our tests, which should cover the same functional use cases: https://github.com/matchai/spacefish/tree/master/tests
Follow #458 for updates.
Currently, there aren't tests for Spaceship. Would be great if we find a way to lint or test this theme somehow.
Open for discussion.