Commit Graph

172 Commits

Author SHA1 Message Date
Steve Howell 42a67576b4 Have better stack traces for node tests.
(imported from commit 7053852dcd1b8479f1dbcb8cf7e46f008afe8a5a)
2014-02-10 15:11:42 -05:00
Tim Abbott 7aef6423de Include /usr/lib/nodejs in node search path.
(imported from commit c818905a91a5fe5754a0bddeb12caa00b50bfed3)
2013-12-02 17:49:08 -05:00
Scott Feeney 5f2517bddc Add support for analyzing test coverage with Istanbul
To use, make sure your Node installation is up to date and install
istanbul with npm:

  sudo npm install -g istanbul      # 'sudo' may be optional on OSX

Then run

  tools/test-js-with-node cover

and navigate to coverage/lcov-report/js/index.html in a browser.

(imported from commit 2da4894d1725e2f9540b3895304246e3cd138f6c)
2013-08-20 10:46:45 -04:00
Scott Feeney 69efe2a695 Add a Node.js-based test runner
There are no functional changes; you can still use the shell script
tools/test-js-with-node. It just delegates now to the new index.js to
iterate through all the other .js files in the test directory and run
them. This sets the stage for Istanbul to correctly compute test
coverage.

(imported from commit 6f521c78b7a314d010fa113f9c2c971ab999b637)
2013-08-20 10:46:22 -04:00
Zev Benjamin e0eddabeb1 Add util.enforce_arity
util.enforce_arity takes a function and returns a new version which
throws an error if an incorrect number of arguments (as determined by
the function prototype) are passed.

(imported from commit 20e69a6dc7b6f8455726ab4fae8d5b7b04dc4103)
2013-08-09 17:12:23 -04:00
Steve Howell 9130fbec84 Show script names in test-js-with-node.
This makes it more like how we do other tests.

(imported from commit e7d96ad31aeed6186ef6ff1d23f8028c68762caa)
2013-08-09 14:47:11 -04:00
Steve Howell abba52fd4d Simplify test-js-with-node to simply run *.js in the test directory.
I finally got tired of the tedium of adding files explicitly to the
script.

(imported from commit 4c573fe4752c32a452e592fad687dd5145a173c8)
2013-08-09 14:23:36 -04:00
Steve Howell 6790ed79cc Add a unit test for activity.js.
This includes slightly invasive, but harmless, changes to
the production code.

(imported from commit ff40af504de2360ada866508da262e0d2e9f7ad9)
2013-08-09 13:11:59 -04:00
Steve Howell cf1d94edef Add a test for stream_color.js (pick_color).
(imported from commit a49f96a4a7b61ef51c057e8a3f11c116d77ebb49)
2013-08-09 12:29:02 -04:00
Steve Howell cef72fd8b8 Add tests for the Filter class.
(imported from commit ef0917bd7911c5cc6f6d20d356c156d483ba723f)
2013-08-09 12:04:43 -04:00
Steve Howell cc73619a9d Add unit tests to narrow.js.
This includes slightly invasive, but harmless, changes to
production code.

(imported from commit 847557c11088b75c836cc399d0af75353a8faa3a)
2013-08-09 11:59:32 -04:00
Steve Howell 50b28dec49 Add node-based unit tests for util.js.
(imported from commit df666a5b96d378787e911c2cd6e509b7d42e1cb4)
2013-08-08 17:25:24 -04:00
Steve Howell 57f518c9c2 Add node JS unit tests for MessageList.
(imported from commit 486a343add91fd5037431504e1ce4a750bfa9fbf)
2013-08-07 09:25:13 -04:00
Tim Abbott e111a2f9a5 [manual] Rename Django app from zephyr to zerver.
This needs to be deployed to both staging and prod at the same
off-peak time (and the schema migration run).

At the time it is deployed, we need to make a few changes directly in
the database:

(1) UPDATE django_content_type set app_label='zerver' where app_label='zephyr';
(2) UPDATE south_migrationhistory set app_name='zerver' where app_name='zephyr';

(imported from commit eb3fd719571740189514ef0b884738cb30df1320)
2013-08-06 07:39:36 -04:00
Steve Howell 3726b86a94 (tests) Rename search.js -> search_suggestion.js
This follows up on extracting code to js/search_suggestion.js, and all
the search tests apply to the new module.

(imported from commit dec6c8614c25b4f82da57edeaddc7cfef28260a5)
2013-08-02 17:28:03 -04:00
Steve Howell 2442edee9e Add the "static" directory to NODE_PATH for unit tests.
I added our "static" directory to NODE_PATH for our JS unit tests.
This eliminates most of the verbosity in our require statements, but
it still requires us to explicitly call out "js" or "third"
subdirectories, which should make it a bit easier for folks reading
the tests to distinguish modules from js, third, or node itself.

(imported from commit b77a5283135d388d46f4b7e511acc59986f1a8ba)
2013-08-01 17:58:25 -04:00
Zev Benjamin e8112ff1c1 test-js-with-node: Fix searching for node binary
Previously, when the first `which` failed, the entire script would
fail with exist status 1 because we pass `-e` to the interpreter.

(imported from commit 601de3b3e3edd90110fc478f7874e644009d1b62)
2013-07-30 17:58:06 -04:00
Zev Benjamin b950121fc2 Account for nodejs sometimes being installed as 'node' and sometimes as 'nodejs'
(imported from commit 751216c9544671106dd555823e31ad9d4553a7aa)
2013-07-30 17:29:47 -04:00
Steve Howell d82ccb6243 rename tests
(imported from commit cd98a86a5e07765f753ac1904e45ccd1213d6d67)
2013-07-30 09:05:49 -04:00
Steve Howell 998a22eabb Created test_search.js. (unit tests for search.js)
(imported from commit 8127c04ccc68a9ac106e5684a7ea9a621cb1831f)
2013-07-30 08:55:44 -04:00
Steve Howell 46c4a6a9b3 Add unit test coverage to unread.js.
This covers most of the module's functionality, with special
emphasis on lines that use underscore.js (_.each and _.filter).

(imported from commit 074181a0273286a258504be634bdd1cead2eecd5)
2013-07-29 13:47:57 -04:00
Steve Howell 958955da23 Run node-based JS unit tests from test-all
(imported from commit 5bf9b690dfd3ac83296a58cf44a170960adaed39)
2013-07-26 14:52:33 -04:00