Skip to content

Testing Enhancements #116

@jaidetree

Description

@jaidetree

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions