Skip to content
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

Open
3 tasks
jaidetree opened this issue Sep 11, 2021 · 1 comment
Open
3 tasks

Testing Enhancements #116

jaidetree opened this issue Sep 11, 2021 · 1 comment

Comments

@jaidetree
Copy link
Collaborator

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.

  • Improve test performance
  • Improve test running consistency
  • Improve test state consistency
@jaidetree
Copy link
Collaborator Author

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.

@jaidetree jaidetree mentioned this issue Sep 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant