How to run jQuery self tests
This is addition to official Running the Unit Tests topic.
Say you have rewritten half of jquery (for good reasons) and want to test it. jquery uses its own QUnit tool.
Build stable jquery
For demonstration of QUnit let's clone stable branch of jquery
$ git clone -b 1.11-stable https://github.com/jquery/jquery.git $ cd jquery
$ npm install $ grunt $ ll dist
Althrough we already installed
Anyway, you just configure HTTP server to serve root directory of jquery (not
test directory) and QUnit should be available at
First I tried simple CGI server
uwsgi but seems it doesn't work well with QUnit. Then I tried
lighttpd but some tests were still failed.
lighttpd this way
- Installed lighttpd and php. On Debian it is
# lighttpd-enable-mod fastcgi fastcgi-php
Added directory with local copy of jQuery repo to lighttpd. Simple and dirty way was to change
server.portfrom 80 to 8081.
# service lighttpd restart
Test page became available at
http://localhost:8081/test/index.html, but whole bunch of tests were failed.
Apache works good with QUnit:
Tests completed in 64047 milliseconds. 6089 assertions of 6092 passed, 3 failed.
One test is related to stylesheets was failed, as far as i understood one stylesheet was introduced by Chrome, not by document and this confused the test.
Two tests are related to focus/blur. May be it's time to update my Chromium?]
I tested in FF also:
Tests completed in 54904 milliseconds. 6086 assertions of 6086 passed, 0 failed.
Faster and no tests failed.
Tests completed in 93135 milliseconds. 6060 assertions of 6060 passed, 0 failed.