Closed bmag closed 7 years ago
Ok, thank you very much.) I have merged these commits: 63a0bcf0f773e2fc25d7d031a067bac9678b1378 ec30dc1fa9bfef8173338e4fa49b4ce2be6cda82 9600f1b73dfa328d4c81e9ee14f6ad7b99ba3b72 And skipped these: commit to check that Travis CI is hooked, Disable coverage for now, Enable coverage.
I think maybe I didn't enable persp-mode correctly
Looks like buttercup run tests in batch mode, so it doesn't create any frames. Interesting, are there any way to run tests with graphical or text frames?
Yes, buttercup run tests in batch mode. I think there's a way to run it in a regular instance, but haven't tried that. I have a package where frame size matters, so I use this in buttercup-init.el
:
(set-frame-width nil 80)
(set-frame-height nil 24)
Somehow it works, but it still can't open new frames. Perhaps you can write a small test runner and replace:
{CASK} exec buttercup -L . -L tests
with:
{CASK} exec {EMACS} -Q -L . -L tests -l test-runner.el
Which can probably work if you run it locally, but how do you see the results in Travis and exit Emacs with a correct exit status for make
to realise the tests failed? Maybe worth a feature request for buttercup.
How to set up automatic testing
This PR does most of the work for setting up automatic tests with Travis CI, including coverage report with coveralls.io. Before merging this, you should:
After merging this PR, you should be able to view test results in Travis and coverage report in Coveralls. For example, here are the test results for my branch. For some reason, I couldn't get undercover.el to send coverage reports to Coveralls. I hope it is something local to my fork, and that it will just work when you merge. Even if it doesn't, testing with Travis will still work, you just won't have a coverage report.
I didn't squash the commits, because I wanted them to match the build history in my example link above.
I think you might prefer to merge the PR into a temporary branch, instead of directly to master, but that's up to you.
How to use this
Every time you push changes to Github, a Travis build will start automatically. When the build finishes, you can view the results in Travis. You can also set it up to send you emails when tests fail (that might be the default behavior, actually).
To run the tests locally, you will have to install Cask. Running the tests is simple as:
If you have several Emacs versions installed, you can run the tests for a specific version easily:
Writing tests
Tests are written with Buttercup, and instructions are here.
I tried to write some basic tests that enable
persp-mode
and then testpersp-switch
, but for some reason they had errors and failed. I think maybe I didn't enablepersp-mode
correctly (I just called(persp-mode)
), but didn't investigate.