background preloader

Testing

Facebook Twitter

Sinon.JS - Documentation. Nock/README.md at master · pgte/nock. Supertest/Readme.md at master · visionmedia/supertest. TDD is dead. Long live testing. (DHH) Test-first fundamentalism is like abstinence-only sex ed: An unrealistic, ineffective morality campaign for self-loathing and shaming. It didn't start out like that. When I first discovered TDD, it was like a courteous invitation to a better world of writing software. A mind hack to get you going with the practice of testing where no testing had happened before. It opened my eyes to the tranquility of a well-tested code base, and the bliss of confidence it grants those making changes to software. The test-first part was a wonderful set of training wheels that taught me how to think about testing at a deeper level, but also some I quickly left behind.

Over the years, the test-first rhetoric got louder and angrier, though. It was yoyo cycle of pride, when I was able to adhere to the literal letter of the teachings, and a crash of despair, when I wasn't. Enough. I suggest you take a hard look at what that approach is doing to the integrity of your system design as well. Long live testing. Jest | Painless JavaScript Unit Testing. Familiar Approach Built on top of the Jasmine test framework, using familiar expect(value).toBe(other) assertions Short Feedback Loop DOM APIs are mocked and tests run in parallel via a small node.js command line utility Why not just use vanilla Jasmine? Jest provides you with multiple layers on top of Jasmine: Getting Started Consider a scenario where you want to test the following sum.js file: function sum(value1, value2) { return value1 + value2;} module.exports = sum; We can get up and running with the following 4 steps:

PhantomJS. Maenu/grunt-template-jasmine-istanbul.