Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

When I want to test something in JavaScript, I open up a new browser window (mostly Firefox) and start writing code in the provided console (mostly Firebug).

However, this tends to be really tedious and slow. Is there an environment, like an IDE with self-execution capability for example, in which we can test JavaScript?

Guide: I'm looking for something like jsfiddle, but not in the browser, and not online. I'd like to have an execution environment which is both off-line, and is not a browser.

All I'm asking is to have something like the Firebug Console as a separate applications (preferably Windows application) which can be opened by double-clicking, and in which, you can write JavaScript code and hit execute. That's all.

In simpler terms, all I want is Firebug's console, without Firefox. Do we have such a thing on the market?

share|improve this question

closed as off-topic by gnat, Kilian Foth, GlenH7, MichaelT, Dan Pichelman Oct 27 at 18:57

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking us to recommend a tool, library or favorite off-site resource are off-topic for Programmers as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – gnat, Kilian Foth, GlenH7, MichaelT, Dan Pichelman
If this question can be reworded to fit the rules in the help center, please edit the question.

    
I found this page. It has plenty of these stand-alone shells for JavaScript. –  Saeed Neamati Oct 11 '11 at 7:49

6 Answers 6

node.js is a popular server-side javascript platform.

It has a REPL that allows you to quickly test snippets. There are also other tools that can do this like the chrome console (I use it personally, responsive and fast) or the firefox6 scratchpad.

In combination with zombie or phantom, which are headless browsers, testing becomes a brease. You can easily write a suite of unit tests that interacts with your website.

share|improve this answer

Have a look at JS-Test-Driver by Misko Hevery http://code.google.com/p/js-test-driver/wiki/GettingStarted

Javascript is a language that is implemented inside browsers, so in order to test it outside, you would need a complete implementation of it.

But JS-Test-Driver "captures" the browser, thus making the whole process a bit easier and more automatic.

share|improve this answer

Selenium automates browsers.

And htmlUnit provides javascript testing functionality for Java.

share|improve this answer

If you just want the JavaScript language, either Rhino or V8 work as command-line environments, complete with a REPL. Most developer editors allow you to send the text content to a command-line process.

If, on the other hand, you want to test a browser-like environment, complete with a DOM tree, you can try env.js, originally by John Resig (yes, the jQuery guy).

share|improve this answer
    
I would say libraries like jsdom are better alternatives to env.js. –  Raynos Sep 17 '11 at 23:45

As others have mentioned, node.js is fantastic for testing Javascript. I just want to add that testing in Firebug may have unexpected results. Actually, the Firebug input is evaled, which is not exactly the same as executing the code as it is. For instance, all variables are created without the [[DontDelete]] flag. This post explains the matter in more detail.

share|improve this answer

When it comes to core-javascript testing you can consider about Rhino, a Mozilla project. It's much lighter than nodejs because Rhino is an implementation of core language only. But Rhino won't come handy for HTML manipulation as Firebug.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.