mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
zjsunit: Remove rewiremock dependency.
We now just use a module._load hook to inject stubs into our code. For conversion purposes I temporarily maintain the API of rewiremock, apart from the enable/disable pieces, but I will make a better wrapper in an upcoming commit. We can detect when rewiremock is called after zrequire now, and I fix all the violations in this commit, mostly by using override. We can also detect when a mock is needlessly created, and I fix all the violations in this commit. The one minor nuisance that this commit introduces is that you can only stub out modules in the Zulip source tree, which is now static/js. This should not really be a problem--there are usually better techniques to deal with third party depenencies. In the prior commit I show a typical workaround, which is to create a one-line wrapper in your test code. It's often the case that you can simply use override(), as well. In passing I kill off `reset_modules`, and I eliminated the second argument to zrequire, which dates back to pre-es6 days.
This commit is contained in:
committed by
Steve Howell
parent
8006c29748
commit
30c7108955
@@ -45,4 +45,4 @@ API_FEATURE_LEVEL = 40
|
||||
# historical commits sharing the same major version, in which case a
|
||||
# minor version bump suffices.
|
||||
|
||||
PROVISION_VERSION = "131.1"
|
||||
PROVISION_VERSION = "132.0"
|
||||
|
Reference in New Issue
Block a user