-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Testing Enhancements #116
Comments
One option is mocking the hs.api before each test. The advantage of that approach is that it would solve all 3 problems but if anything uses utils like lib.functional.map that relies on the hs.fnutils, it will need to either be mocked or reimplemented so the code that is testing is more accurate. |
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Follow up to #106 is to keep thinking and improving on test performance and consistency. When running the tests, it's going through the https://www.hammerspoon.org/docs/hs.ipc.html API to communicate with the hammerspoon process remotely.
While it means our tests can use the hs api (including lib/functional.fnl which leverages some of the hs.fnutils), it does create some consistency problems.
For example if you save a file and it causes spacehammer to restart, it needs time to restart before tests can be run. If the tests run too early, it will not be able to connect to the server and throws an error.
The other issue is that spacehammer has a global environment meaning writing tests for systems like the advising system meant advice was persisting between running tests throwing errors because advice was seemingly already added.
Reloading hammerspoon resets the test state, but it also means any state like say tmux repl session data, is also reset.
My current workaround was to create a reset function for advice to clear out the advice after all the advice tests run.
The text was updated successfully, but these errors were encountered: