mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
js: Convert static/js/blueslip.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Steve Howell
parent
b0ceaa1ea0
commit
3ef6f6e2e2
@@ -11,7 +11,7 @@ const handlebars = require("./handlebars");
|
||||
const stub_i18n = require("./i18n");
|
||||
const namespace = require("./namespace");
|
||||
const test = require("./test");
|
||||
const {make_zblueslip} = require("./zblueslip");
|
||||
const blueslip = require("./zblueslip");
|
||||
const zjquery = require("./zjquery");
|
||||
|
||||
require("@babel/register")({
|
||||
@@ -93,7 +93,8 @@ try {
|
||||
_.throttle = immediate;
|
||||
_.debounce = immediate;
|
||||
|
||||
const blueslip = namespace.set_global("blueslip", make_zblueslip());
|
||||
namespace.mock_esm("../../static/js/blueslip", blueslip);
|
||||
require("../../static/js/blueslip");
|
||||
namespace.set_global("i18n", stub_i18n);
|
||||
|
||||
run_one_module(file);
|
||||
|
||||
@@ -120,9 +120,7 @@ const templatesPath = staticPath + "templates" + path.sep;
|
||||
exports.complain_about_unused_mocks = function () {
|
||||
for (const filename of module_mocks.keys()) {
|
||||
if (!used_module_mocks.has(filename)) {
|
||||
throw new Error(
|
||||
`You asked to mock ${filename} but we never saw it during compilation.`,
|
||||
);
|
||||
console.error(`You asked to mock ${filename} but we never saw it during compilation.`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
const namespace = require("./namespace");
|
||||
const zblueslip = require("./zblueslip");
|
||||
const $ = require("./zjquery");
|
||||
|
||||
let current_file_name;
|
||||
@@ -34,5 +35,5 @@ exports.run_test = (label, f, opts) => {
|
||||
throw error;
|
||||
}
|
||||
// defensively reset blueslip after each test.
|
||||
window.blueslip.reset();
|
||||
zblueslip.reset();
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
exports.make_zblueslip = function () {
|
||||
function make_zblueslip() {
|
||||
const lib = {};
|
||||
|
||||
const opts = {
|
||||
@@ -124,4 +124,6 @@ exports.make_zblueslip = function () {
|
||||
lib.preview_node = (node) => "node:" + node;
|
||||
|
||||
return lib;
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = make_zblueslip();
|
||||
|
||||
Reference in New Issue
Block a user