Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

For testing Mithril.js, I wrote a mock window object, which allow you to do things like simulate requestAnimationFrame clicks, JSON-P calls and browser quirks from non-browser environments (e.g. from a Node.js script). So to test, you simply swap `window` with the mock and you can drive your fake browser however you wish.

http://lhorie.github.io/mithril/mithril.deps.html

You can cover a lot of ground with that approach and make an extremely fast test suite that is suitable for a save-refresh-test workflow and then you can put trickier tests in a secondary test suite that you only run once in a while (e.g. before a commit)



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: