cheshire137 / gh-notifications-snoozer

Lists and filters and snoozing pull requests, oh my! This is an app for managing your notifications on GitHub by way of filtering issues and pull requests that are of interest to you.
MIT License
15 stars 10 forks source link

Faster tests #10

Closed probablycorey closed 8 years ago

probablycorey commented 8 years ago

This PR does two things.

  1. Renames Main to App (based on the comment in https://github.com/cheshire137/gh-notifications-snoozer/pull/9#issuecomment-232754084). Since all electron apps are single page apps, I think is a good name.
  2. Uses electron-mocha instead of spectron. This will make are tests much faster. And if they are a lot faster, I am more likely to use them!

spectron

> mocha

  application launch
    ✓ shows an initial window
    1) renders sarah

  1 passing (3s)
  1 failing

  1) application launch renders sarah:
     NoSuchElement: An element could not be located on the page using the given search parameters.
      at elements("p") - getText.js:51:17
      at getText("p") - main-test.js:29:28

npm ERR! Test failed.  See above for more details.
npm test  1.43s user 0.35s system 41% cpu 4.320 total

electron-mocha

> electron-mocha --recursive --compilers js:babel-register test

  App
    ✓ renders

  1 passing (70ms)

npm test  1.77s user 0.27s system 105% cpu 1.941 total

4.3s vs 1.9s. It's not much now, but spectron opens a new electron window for every test, and that would become super slow.

cc @cheshire137

cheshire137 commented 8 years ago

I approve of this test sweet. 😆