Javascript unit testing with V8
Asked Answered
T

1

15

Currently, I am using PhantomJS for running Javascript unit tests in QUnit and Sinon framework on our build server.

But, PhantomJS uses JavaScriptCore with JIT compiler as its Javascript engine. Instead, I want to use the V8 engine, which is used in Google Chrome, or Chakra, which is used in IE. I want to do this because I want to check platform compatibility for the code.

Are there any popular test runners like PhantomJS, which use these engines?

Tiffanitiffanie answered 8/5, 2013 at 9:38 Comment(0)
Q
12

The closest I can think of is Zombie.js, which is a headless browser written in Javascript that runs under Node.js.

It's not a genuine browser in the way that Phantom is, so there are things you won't be able to do with it that you can do with Phantom, but since it uses Node.js, it obviously does use the V8 engine, so it fulfils your criteria.

But if you really want to test in all the browser's various engines, your other option is, of course, to use a real browser. You don't have to have a visible UI for it; use a tool like Selenium or Sahi, which can launch and run the browser from a script, and have it run in a VM; you don't ever need to even look at it. It may not be as quick as using Phantom, but it will be a genuine test, which is clearly what you're really interested in.

[EDIT]
Worth adding a note to this answer because I recently found out about SlimerJS, which is an open source project aiming to produce a PhantomJS-compatible browser that uses the Gecko engine. Again, this isn't exactly what was asked for in the question, but it is in the spirit of it; it's great to have another tool available to make cross-platform testing easier.

Quimby answered 8/5, 2013 at 11:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.