Using JSDOM to Mock Browser and DOM Objects for JS Testing

725 views
Skip to first unread message

The Zelus

unread,
Apr 13, 2012, 4:35:50 AM4/13/12
to js...@googlegroups.com
I'm trying to use JSTest.NET to test my JS code. This framework uses CScript to run JS. The issue that I'm currently facing is that my JS code is using window and document objects. I'm looking for a library that can mock Browser and DOM Objects so that I can test my JS code without actually instantiating a browser. Someone pointed me to JSDOM for mocking, but I'm kinda confused how to use this. Can anyone link me some resources that can help me to get started with JSDOM.

Elijah Insua

unread,
Apr 13, 2012, 4:17:01 PM4/13/12
to js...@googlegroups.com
On Fri, Apr 13, 2012 at 1:35 AM, The Zelus <thez...@gmail.com> wrote:
I'm trying to use JSTest.NET to test my JS code. This framework uses CScript to run JS. The issue that I'm currently facing is that my JS code is using window and document objects. I'm looking for a library that can mock Browser and DOM Objects so that I can test my JS code without actually instantiating a browser. Someone pointed me to JSDOM for mocking, but I'm kinda confused how to use this. Can anyone link me some resources that can help me to get started with JSDOM.

Have you read the readme (https://github.com/tmpvar/jsdom/blob/master/README.md)?  Jsdom attempts to provide a functional headless browser. This includes window, document, and friends.

-- Elijah

beyond8848

unread,
Oct 25, 2012, 10:35:34 PM10/25/12
to js...@googlegroups.com
Hi The Zelus,
 
did you firgure out how does JSTest.Net intergrate with JSDOM? could you tell me how to do that? i am running into the same issue while i am using JStest.Net to do jsUnit test.
Thanks a lot.

Joey Burgett

unread,
Apr 9, 2013, 7:07:12 AM4/9/13
to js...@googlegroups.com
Sorry to bring up a year old post but was wondering if you ever discovered how to implement JSDOM with JSTest.NET?
Reply all
Reply to author
Forward
0 new messages