Commit Graph

80 Commits

Author SHA1 Message Date
Joshua Pan ed9eb3bdb5 tests: Make test-js-with-node handling smarter.
Added support for passing a filename without `.js` suffix.
This then fixed the issue of no complaints for invalid test
files. Now, throws an error for invalid test files.

Fixes #8579.
2018-03-26 06:35:58 -04:00
Tarun Kumar c8d5cf7d6c user-groups: Achieve 100% node-test coverage of user_groups.js.
Fixes #8704.
2018-03-15 10:09:28 -07:00
Steve Howell fef2840531 Add FetchStatus class.
We will use this in subsequent commits to replace the
`load_more_enabled` flag.
2018-03-09 14:20:58 -08:00
Steve Howell 3e76d523c7 node tests: Add tests for user_pill.js.
This gets coverage to 100%.  (We already had a lot of indirect
coverage, but these tests should have more obvious failure
symptoms.)
2018-03-07 15:53:11 -08:00
Tim Abbott 4d8e18e58f settings: Move display_checkmark to settings_ui.js. 2018-03-04 18:26:27 -08:00
Tim Abbott 530e098916 node: Remove 100% coverage requirement for user groups.
This is a temporary change to get CI passing again; we lost some
coverage in aed8cc9062, which fixed some
major bugs in the feature.
2018-03-04 10:11:11 -08:00
YJDave f5a24efdd8 static/js: Add `settings_ui.js` file for common settings UI functions. 2018-03-03 08:38:54 -08:00
Steve Howell 1f6ddf0110 refactor: Extract transmit.js from compose.js.
We now isolate the code to transmit messages into transmit.js.
It is stable code that most folks doing UI work in compose.js don't
care about the details of, so it's just clutter there.  Also, we may
soon have other widgets than the compose box that send messages.

This change mostly preserves test coverage, although in some cases
we stub at a higher level for the compose path (this is a good thing).
Extracting out transmit.js allows us to lock down 100% coverage on that
file.
2018-02-20 09:29:26 -08:00
Aditya Bansal efbddce34d settings_user_groups.js: Add 100% node test coverage. 2018-01-20 08:01:06 -05:00
Cynthia Lin a937750b1a node tests: Add 100% test coverage for user_groups.js. 2018-01-06 11:50:52 -05:00
cPhost 470e57db49 node tests: Enforce 100% coverage for stream_data.js. 2017-12-28 09:39:45 -05:00
cPhost 3dc315a0a1 node tests: Add 100% coverage for narrow_state.js. 2017-12-18 09:57:43 -05:00
Greg Price 137c0e65bb tools: Revert to Python 2 typing syntax for now.
This reverts commit 66261f1cc.  See parent commit for reason; here,
provision worked but `tools/run-dev.py` would give errors.

We need to figure out a test that reproduces these issues, then make a
version of these changes that keeps that test working, before we
re-merge them.
2017-12-13 10:38:15 -08:00
rht 66261f1cc3 tools: Use Python 3 syntax for typing in many files. 2017-12-12 17:42:57 -08:00
rht f689813f38 test-js-with-node: Port from optparse to argparse. 2017-11-10 15:52:43 -08:00
neiljp (Neil Pilgrim) 9f90a3174b mypy: Add explicit Any as Dict parameters in check_line_coverage in test-js-with-node. 2017-11-04 19:47:44 -07:00
Tim Abbott bcca964548 test-js-with-node: Fix doing too many imports before sanity_check.
This wasn't benefitting from the nice error message.
2017-10-17 22:22:00 -07:00
Steve Howell 810532641e activity.js: Extract get_filtered_and_sorted_user_ids().
This function was extracted from build_user_sidebar().  We
also slightly streamlined it to not unnecessarily call
filter() when the filter text was blank. This extraction
also eliminated the need for us to have the two-line
filter_and_sort() function.

Also, we get to 100% coverage in this commit.
2017-10-08 12:01:59 -07:00
Tim Abbott 55136cec68 Disabled 100% coverage requirement for activity.js for now. 2017-10-04 22:50:04 -07:00
rht f15bdce90e tools: Remove print_function.
Tweaked by tabbott to exclude the linter libraries.
2017-09-29 15:44:56 -07:00
Greg Price a099e698e2 py3: Switch almost all shebang lines to use `python3`.
This causes `upgrade-zulip-from-git`, as well as a no-option run of
`tools/build-release-tarball`, to produce a Zulip install running
Python 3, rather than Python 2.  In particular this means that the
virtualenv we create, in which all application code runs, is Python 3.

One shebang line, on `zulip-ec2-configure-interfaces`, explicitly
keeps Python 2, and at least one external ops script, `wal-e`, also
still runs on Python 2.  See discussion on the respective previous
commits that made those explicit.  There may also be some other
third-party scripts we use, outside of this source tree and running
outside our virtualenv, that still run on Python 2.
2017-08-16 17:54:43 -07:00
Steve Howell f0de6bd461 node tests: Add "Starting node tests..." message. 2017-08-15 14:50:10 -04:00
Steve Howell 30646f2a3b test-js-with-node: Add "Success:" to success message. 2017-08-01 13:43:35 -04:00
Steve Howell bc0761b22b Extract topic_data.js.
This new module tracks the recent topic names for any given
stream.

The code was pulled over almost verbatim from stream_data.js,
with minor renames to the function names.

We introduced a minor one-line function called stream_has_topics.
2017-07-27 14:26:22 -07:00
Steve Howell 7e88fb25b3 Move sent_messages callbacks into transmit_message().
This mostly sets the stage for a subsequent commit to start
using client_message_id as the key into sent_messages.

It has the nice side effect of making it more explicit that
certain things should always happen when transmit_message()
succeeds.

This commit does regress our node test coverage a bit.
2017-07-13 23:42:27 -04:00
Steve Howell f6d670ae3d Extract sent_messages.js.
This is mostly straightforward moving of code out of compose.js.

The code that was moved currently supports sending time
reports for sent messages, but we intend to grow out the new
module to track more state about sent messages.

The following function names in this commit are new, but their
code was basically pulled over verbatim:

    process_success (was process_send_time)
    set_timer_for_restarting_event_loop
    clear
    initialize

All the code in the new module is covered by previous tests that
had been written for compose.js.  This commit only modifies
a few things to keep those tests.

The new module has 100% node coverage, so we updated `enforce_fully_covered`.
2017-07-13 23:42:27 -04:00
Cory Lynch 099a7052e4 Enforce 100% test coverage for stream_events.js. 2017-07-05 17:57:52 -04:00
Steve Howell 6cf4c65d92 node tests: Add 100% coverage for channel.js. 2017-06-30 09:48:04 -04:00
Yago González 00a7f89ba9 node tests: Add coverage to composebox_typeahead.js. 2017-06-26 19:33:25 -04:00
Aditya Bansal 1cb5c9faa8 node tests: Enforce 100% test coverage upon emoji.js. 2017-06-26 14:24:20 -04:00
Aditya Bansal d1fe75ce3b node tests: Enforce 100% node coverage in activity.js. 2017-06-26 14:24:20 -04:00
Joshua Pan a63fd95b6a test-js-with-node: Add check for fully covered files that are not enforced. 2017-06-23 16:05:16 -04:00
Joshua Pan c625a80b90 test-js-with-node: Extract check_line_coverage function. 2017-06-23 16:05:16 -04:00
Joshua Pan 3557c47d76 node tests: Enforce 100% node coverage in user_events.js. 2017-06-23 16:05:16 -04:00
Aditya Bansal eb39e82629 Update enforce_fully_covered list with pm_list.js. 2017-06-23 11:13:47 -04:00
Joshua Pan bd9459f27d node test: Enforce 100% node coverage in typeahead_helper.js. 2017-06-21 00:03:05 -04:00
Cory Lynch 005d06eb38 message_store.js: Add tests for message id change.
This gets message_store.js to 100% line coverage.
2017-06-20 06:24:27 -04:00
Joshua Pan 23dc32a0f3 node tests: Enforce 100% coverage in markdown.js and presence.js. 2017-06-19 08:00:55 -04:00
Joshua Pan d1408125b2 tools: Make sure missing lines in node test coverage are correct. 2017-06-19 07:59:50 -04:00
Cory Lynch 7f8ecb62c9 fenced_code.js: Improve coverage to 100%. 2017-06-19 06:53:25 -04:00
Cory Lynch 6653e19e3a Add URL for viewing node coverage data on dev server.
Running test-js-with-node --coverage now provides a URL
to view the output data on the web.

Fixes #5177.
2017-06-09 16:17:30 -07:00
Joshua Pan a72b1bd98e node tests: Enforce 100% test coverage for util.js. 2017-06-07 23:26:46 -07:00
Joshua Pan fdb244fd3b node tests: Add support for enforcing 100% test coverage.
Fixes #5178.
2017-06-07 22:13:02 -07:00
Tim Abbott 5ffdce9aab test-js-with-node: Set timezone to UTC for tests. 2017-05-29 08:47:26 -07:00
Steve Howell 6b4825a763 tools: Convert test-js-with-node to Python.
This is mostly a straight port from bash to Python, but we
rename the coverage option to `--coverage` and we add checks
for being in a venv and being correctly provisioned.

Fixes #4009.
2017-04-05 12:02:49 -07:00
umkay 798e6faa9e provision: Use NVM to install node and npm.
NVM takes a specific node version and installs the node package and
a corresponding compatible npm package.

We use it in a somewhat hackish way to install node/npm globally with
a pinned version, since that's how we actually want to consume node in
our development environment.

Other details:
- Travis CI now is configured to use the version of node installed by
provision; the easiest way to do this was to sabotage the existing node
installation.
- jsdom is upgraded to a current version, which both requires recent
node and also is required for the tests to pass with recent node.
This fixes running the node tests on Xenial.

Fixes #1498.

[tweaked by tabbott]
2016-09-23 14:34:44 -07:00
Taranjeet Singh 4350b6e0fb provision.py: Create dir var/node-coverage for js test coverage.
test-js-with-node: Move istanbul test coverage to var/node-coverage.

This commit moves js test coverage generated through istanbul to
var/node-coverage.
2016-08-25 19:58:30 -07:00
Tomasz Kolek 4a25b92298 Cleanup result message code in test-js-with-node.
Remove duplicate code after quick fix in passing returned code.

Fixes: #1489.
2016-08-09 16:46:24 -07:00
Tim Abbott 09b677b605 test-js-with-node: Fix istanbul not being in PATH. 2016-08-04 09:29:30 -07:00
Tim Abbott 82b1218af9 test-js-with-node: Fix return status on failure. 2016-08-04 09:27:54 -07:00