Is it possible to unit-test javascript ?

I'm very new to the platform, with a background in javascript programming and tdd in general, and I haven't yet been able to figure out a way to unit-test my javascript code.

Unity's peculiarities with the language don't allow using common javascript frameworks, at least the ones I've tried.

On the other hand, I've found a couple of Unity-specific frameworks, one written in C#, the other in boo that I haven't been able to use to test my javascript classes, let alone write the tests themselves in js...

I could do with writing the tests in another language if that actually worked, eventhough test suites in js would be best, but most importantly, my quiestion is...

Is there a currently available framework that can be used to unit-test unity code written in javascript ?

Cheers !

The JavaScript that Unity uses isn't standard JavaScript. It's JIT-compiled into a .NET-compliant module and then inserted into the game, and the only reason it's called "JavaScript" is because of the near-identical syntax it has to its web counterpart, but that's about it.

If the Boo/C# unit test scripts are open sourced, you could attempt to convert them by hand (the syntax between Unity-JavaScript and Unity-C# isn't all that different), but as far as I know, there isn't already a JavaScript unit test available for Unity.

UUnit from the Unify wiki looks like what you're looking for.

See this discussion on the Unity Forum for ideas on what to test.

I’ve put some examples onto the UUnit page both in Javascript and C#.
Check out the test examples.

I wrote a little script that provides a basic framework for unit tests, which might meet your needs (or the needs of someone who googles this, since this is a pretty old question): GitHub - asross/unity_tests: A basic tool to write tests for Unity3D.

It’s written in JS, but you can use it for C# classes too as long as you put the script in Assets/Plugins.