2020-08-01 03:43:15 +02:00
|
|
|
"use strict";
|
|
|
|
|
2019-06-20 11:59:55 +02:00
|
|
|
const blueslip_stacktrace = zrequire("blueslip_stacktrace");
|
|
|
|
|
|
|
|
run_test("clean_path", () => {
|
|
|
|
// Local file
|
|
|
|
assert.strictEqual(
|
|
|
|
blueslip_stacktrace.clean_path("webpack:///static/js/upload.js"),
|
2020-07-02 02:16:03 +02:00
|
|
|
"/static/js/upload.js",
|
2019-06-20 11:59:55 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
// Third party library (jQuery)
|
|
|
|
assert.strictEqual(
|
|
|
|
blueslip_stacktrace.clean_path(
|
2020-07-02 02:16:03 +02:00
|
|
|
"webpack:///.-npm-cache/de76fb6f582a29b053274f9048b6158091351048/node_modules/jquery/dist/jquery.js",
|
2019-06-20 11:59:55 +02:00
|
|
|
),
|
2020-07-02 02:16:03 +02:00
|
|
|
"jquery/dist/jquery.js",
|
2019-06-20 11:59:55 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
// Third party library (underscore)
|
|
|
|
assert.strictEqual(
|
|
|
|
blueslip_stacktrace.clean_path(
|
2020-07-02 02:16:03 +02:00
|
|
|
"webpack:///.-npm-cache/de76fb6f582a29b053274f9048b…58091351048/node_modules/underscore/underscore.js",
|
2019-06-20 11:59:55 +02:00
|
|
|
),
|
2020-07-02 02:16:03 +02:00
|
|
|
"underscore/underscore.js",
|
2019-06-20 11:59:55 +02:00
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
run_test("clean_function_name", () => {
|
|
|
|
assert.deepEqual(blueslip_stacktrace.clean_function_name(undefined), undefined);
|
|
|
|
|
|
|
|
// Local file
|
|
|
|
assert.deepEqual(
|
|
|
|
blueslip_stacktrace.clean_function_name("Object../static/js/upload.js.exports.options"),
|
|
|
|
{
|
|
|
|
scope: "Object../static/js/upload.js.exports.",
|
|
|
|
name: "options",
|
2020-07-02 02:16:03 +02:00
|
|
|
},
|
2019-06-20 11:59:55 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
// Third party library (jQuery)
|
|
|
|
assert.deepEqual(blueslip_stacktrace.clean_function_name("mightThrow"), {
|
|
|
|
scope: "",
|
|
|
|
name: "mightThrow",
|
|
|
|
});
|
|
|
|
|
|
|
|
// Third party library (underscore)
|
|
|
|
assert.deepEqual(
|
|
|
|
blueslip_stacktrace.clean_function_name(
|
2020-07-02 02:16:03 +02:00
|
|
|
"Function.../zulip-npm-cache/de76fb6f582a29b053274f…es/underscore/underscore.js?3817._.each._.forEach",
|
2019-06-20 11:59:55 +02:00
|
|
|
),
|
|
|
|
{
|
|
|
|
scope:
|
|
|
|
"Function.../zulip-npm-cache/de76fb6f582a29b053274f…es/underscore/underscore.js?3817._.each._.",
|
|
|
|
name: "forEach",
|
2020-07-02 02:16:03 +02:00
|
|
|
},
|
2019-06-20 11:59:55 +02:00
|
|
|
);
|
|
|
|
});
|