zulip/frontend_tests/zjsunit
Priyank Patel 305a1ac57d node_tests: Don't remove require cache of module in zrequire.
There is good reason to do this (explanation is bit long!). With the
TypeScript migration, and the require and ES6 migrations that come
with it, we use require instead of set_global which loads the entire
module. Suppose we have a util module, which is used by some other
module, say message_store, and util is being required in message_store
since it is removed from window. Then, if a test zrequires
message_store first, and then zrequires the util module qand mocks one
of its methods, it will not be mocked for the message_store
module. The reason is:
 1. zrequire('message_store') leads to require('util').
 2. zrequire('util') removes the util module from cache and it is
    reloaded. Now the util module in message_store and the one in
    the test will be different and any updates to it in tests won't
    be reflected in the actual code.

Which can lead to confusion for folks writing tests. I'll mention this
can be avoided doing zrequire('util') first but...that is not ideal.

And, since there was one outlier test that relied on this behavior,
we add the namespace.reset_module function.
2020-09-01 19:55:58 -07:00
..
finder.js js: Add "use strict" directive to CommonJS files. 2020-07-31 22:09:46 -07:00
handlebars.js js: Add "use strict" directive to CommonJS files. 2020-07-31 22:09:46 -07:00
i18n.js js: Add "use strict" directive to CommonJS files. 2020-07-31 22:09:46 -07:00
index.js node_tests: Don't remove require cache of module in zrequire. 2020-09-01 19:55:58 -07:00
markdown_assert.js js: Elide .js and .ts extensions from imports and requires. 2020-09-01 16:43:02 -07:00
mdiff.js js: Add "use strict" directive to CommonJS files. 2020-07-31 22:09:46 -07:00
namespace.js node_tests: Don't remove require cache of module in zrequire. 2020-09-01 19:55:58 -07:00
stub.js js: Add "use strict" directive to CommonJS files. 2020-07-31 22:09:46 -07:00
zblueslip.js js: Add "use strict" directive to CommonJS files. 2020-07-31 22:09:46 -07:00
zjquery.js popovers: Align user profile popover with right col USERS header. 2020-08-31 14:01:11 -07:00