moving from zombie.js to request-promise / cheerio

Some prior posts have been showing different ways to test using zombie.js. Once I got the hang zombie, it was really straight forward, but… I never really felt comfortable. Tests would sometimes randomly fail with timeouts and if I ran them again, they would pass (mostly). This happened both locally and on the CI server. Still, I didn’t mind using zombie, especially since this was on a side project and part of building a side project is learning about other packages vs defaulting to what one knows (supertest, cheerio, etc).

Then, I upgraded bluebirdjs and my zombie tests blew up. Every single zombie test failed with a timeout issue. I spent a few hours spinning my wheels trying to figure out what was going on… and then, I threw up my hands and decided to jump ship.

I decided to use request-promise, as I was already using it in my project, and go back to using cheerio to parse the response. It took about a day to change all my zombie tests but I’m really glad I did. The setup is straight forward and things just work. This might be due to the fact I’m back to using cheerio / chai expect vs the built in zombie tests but still, I’m happy.

Also, an added bonus — my mock tests are now working… I worked on getting zombie and nock to play nice but after a day of trying, I set it aside to address later (and later never circled back around). I’ll write more about nock in a future post.

So for now, my tests use: mocha, request-promise, cheerio, and chai (and nock)

I will say that zombie creator @assaf was awesome when I did ask questions and responded within a few hours which was really great — and if you want to play around w/ a headless browser I’d still recommend zombie for very simple testing.