You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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.
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: