¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

[TDD] How to TDD JavaScript so it thinks it is in a browser.


 

¿ªÔÆÌåÓý

Have you tried webdriver + phantomjs?

---
Nayan Hajratwala ... @nhajratw ... 734.658.6032 ...

On Apr 4, 2014, at 5:35 PM, Ian <hobson42@...> wrote:

?

Hi all,

How can I set up some programmed tests to test JavaScript, so it thinks
its in a browser?

The JavaScript code modifies the style objects and the DOM.

Have tried various utilities that claim to test JavaScript in the
browser, and they have
proved impractically slow. (A paste of a 25 character string took over 3
minutes!)

So I guess the JavaScript has to be run elsewhere (WSH?) and made to
think it is in a browser,
but I have no ideas how to do this.

I can use Windows or Linux - (No mac :( ).

Thanks

Ian


 

I usually TDD with node.js and karma. It allows me to test my code in various browsers
at the same time.

Cheers,

Yoann

Le 4 avr. 2014 23:47, "Nayan Hajratwala" <nayan@...> a ¨¦crit :

?

Have you tried webdriver + phantomjs?

---
Nayan Hajratwala ... @nhajratw ... 734.658.6032 ...

On Apr 4, 2014, at 5:35 PM, Ian <hobson42@...> wrote:

?

Hi all,

How can I set up some programmed tests to test JavaScript, so it thinks
its in a browser?

The JavaScript code modifies the style objects and the DOM.

Have tried various utilities that claim to test JavaScript in the
browser, and they have
proved impractically slow. (A paste of a 25 character string took over 3
minutes!)

So I guess the JavaScript has to be run elsewhere (WSH?) and made to
think it is in a browser,
but I have no ideas how to do this.

I can use Windows or Linux - (No mac :( ).

Thanks

Ian


 

Karma is a kick ass tool for integration testing. It's better if you can test most of the "business logic" with jsdom, a few mocks, or less. The tests will be super fast that way.?


On Sunday, April 6, 2014, Yoann R. <artissae@...> wrote:
?

I usually TDD with node.js and karma. It allows me to test my code in various browsers
at the same time.

Cheers,

Yoann

Le 4 avr. 2014 23:47, "Nayan Hajratwala" <nayan@...> a ¨¦crit :
?

Have you tried webdriver + phantomjs?

---
Nayan Hajratwala ... @nhajratw ... 734.658.6032 ...

On Apr 4, 2014, at 5:35 PM, Ian <hobson42@...> wrote:

?

Hi all,

How can I set up some programmed tests to test JavaScript, so it thinks
its in a browser?

The JavaScript code modifies the style objects and the DOM.

Have tried various utilities that claim to test JavaScript in the
browser, and they have
proved impractically slow. (A paste of a 25 character string took over 3
minutes!)

So I guess the JavaScript has to be run elsewhere (WSH?) and made to
think it is in a browser,
but I have no ideas how to do this.

I can use Windows or Linux - (No mac :( ).

Thanks

Ian


Adam Miller
 

There are plenty of options for doing TDD with Javascript, qunit with phantomjs is another one.


On Sun, Apr 6, 2014 at 3:52 PM, Adam Sroka <adam.sroka@...> wrote:
?

Karma is a kick ass tool for integration testing. It's better if you can test most of the "business logic" with jsdom, a few mocks, or less. The tests will be super fast that way.?



On Sunday, April 6, 2014, Yoann R. <artissae@...> wrote:
?

I usually TDD with node.js and karma. It allows me to test my code in various browsers
at the same time.

Cheers,

Yoann

Le 4 avr. 2014 23:47, "Nayan Hajratwala" <nayan@...> a ¨¦crit :
?

Have you tried webdriver + phantomjs?

---
Nayan Hajratwala ... @nhajratw ... 734.658.6032 ...

On Apr 4, 2014, at 5:35 PM, Ian <hobson42@...> wrote:

?

Hi all,

How can I set up some programmed tests to test JavaScript, so it thinks
its in a browser?

The JavaScript code modifies the style objects and the DOM.

Have tried various utilities that claim to test JavaScript in the
browser, and they have
proved impractically slow. (A paste of a 25 character string took over 3
minutes!)

So I guess the JavaScript has to be run elsewhere (WSH?) and made to
think it is in a browser,
but I have no ideas how to do this.

I can use Windows or Linux - (No mac :( ).

Thanks

Ian