mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
This reverts commit 42070d49da
.
Overriding Error.stack like this seems to break the browser's own sourcemapping of stack-traces. Plus, it adds quite a significant performance overhead to tests (QUnit seems to rely on Error.stack even when tests pass). Reverting for now, but perhaps we can build a way to make this only apply to the UI-displayed stack traces in future 🤔
This commit is contained in:
parent
a7a0b3d58e
commit
3df8ee9775
@ -70,9 +70,6 @@ module.exports = function (defaults) {
|
|||||||
util: require.resolve("util/"),
|
util: require.resolve("util/"),
|
||||||
// Also for sinon
|
// Also for sinon
|
||||||
timers: false,
|
timers: false,
|
||||||
// For source-map-support
|
|
||||||
path: require.resolve("path-browserify"),
|
|
||||||
fs: false,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
@ -225,13 +222,6 @@ module.exports = function (defaults) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
resolve: {
|
|
||||||
fallback: {
|
|
||||||
// For source-map-support
|
|
||||||
path: require.resolve("path-browserify"),
|
|
||||||
fs: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -95,7 +95,6 @@
|
|||||||
"loader.js": "^4.7.0",
|
"loader.js": "^4.7.0",
|
||||||
"message-bus-client": "^4.3.8",
|
"message-bus-client": "^4.3.8",
|
||||||
"messageformat": "0.1.5",
|
"messageformat": "0.1.5",
|
||||||
"path-browserify": "^1.0.1",
|
|
||||||
"pretender": "^3.4.7",
|
"pretender": "^3.4.7",
|
||||||
"qunit": "^2.20.0",
|
"qunit": "^2.20.0",
|
||||||
"qunit-dom": "^2.0.0",
|
"qunit-dom": "^2.0.0",
|
||||||
@ -104,7 +103,6 @@
|
|||||||
"sinon": "^16.0.0",
|
"sinon": "^16.0.0",
|
||||||
"float-kit": "1.0.0",
|
"float-kit": "1.0.0",
|
||||||
"source-map": "^0.7.4",
|
"source-map": "^0.7.4",
|
||||||
"source-map-support": "^0.5.21",
|
|
||||||
"terser": "^5.20.0",
|
"terser": "^5.20.0",
|
||||||
"truth-helpers": "1.0.0",
|
"truth-helpers": "1.0.0",
|
||||||
"util": "^0.12.5",
|
"util": "^0.12.5",
|
||||||
|
@ -42,13 +42,6 @@ import SiteSettingService from "discourse/services/site-settings";
|
|||||||
import jQuery from "jquery";
|
import jQuery from "jquery";
|
||||||
import { setupDeprecationCounter } from "discourse/tests/helpers/deprecation-counter";
|
import { setupDeprecationCounter } from "discourse/tests/helpers/deprecation-counter";
|
||||||
import { configureRaiseOnDeprecation } from "discourse/tests/helpers/raise-on-deprecation";
|
import { configureRaiseOnDeprecation } from "discourse/tests/helpers/raise-on-deprecation";
|
||||||
import SourceMapSupport from "source-map-support";
|
|
||||||
|
|
||||||
// Updates Error.stack to include source-mapped locations.
|
|
||||||
// Makes QUnit errors more human-readable
|
|
||||||
SourceMapSupport.install({
|
|
||||||
handleUncaughtExceptions: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
const Plugin = $.fn.modal;
|
const Plugin = $.fn.modal;
|
||||||
const Modal = Plugin.Constructor;
|
const Modal = Plugin.Constructor;
|
||||||
@ -309,18 +302,8 @@ export default function setupTests(config) {
|
|||||||
throw new Error(error);
|
throw new Error(error);
|
||||||
};
|
};
|
||||||
|
|
||||||
pretender.checkPassthrough = (request) => {
|
pretender.checkPassthrough = (request) =>
|
||||||
const requestUrl = new URL(request.url, location.href);
|
request.requestHeaders["Discourse-Script"];
|
||||||
if (
|
|
||||||
requestUrl.origin === location.origin &&
|
|
||||||
requestUrl.pathname.startsWith("/assets/")
|
|
||||||
) {
|
|
||||||
// Likely a request from source-map-support package
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return request.requestHeaders["Discourse-Script"];
|
|
||||||
};
|
|
||||||
|
|
||||||
applyPretender(ctx.module, pretender, pretenderHelpers());
|
applyPretender(ctx.module, pretender, pretenderHelpers());
|
||||||
|
|
||||||
@ -412,7 +395,6 @@ export default function setupTests(config) {
|
|||||||
setupToolbar();
|
setupToolbar();
|
||||||
reportMemoryUsageAfterTests();
|
reportMemoryUsageAfterTests();
|
||||||
patchFailedAssertion();
|
patchFailedAssertion();
|
||||||
patchStacktraceOrigin();
|
|
||||||
|
|
||||||
if (!hasPluginJs && !hasThemeJs) {
|
if (!hasPluginJs && !hasThemeJs) {
|
||||||
configureRaiseOnDeprecation();
|
configureRaiseOnDeprecation();
|
||||||
@ -440,25 +422,6 @@ function patchFailedAssertion() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Stacktraces tend to look something like `http://localhost:4200/assets/...`.
|
|
||||||
* This patch removes the `http://localhost:4200` part to make things cleaner.
|
|
||||||
*/
|
|
||||||
function patchStacktraceOrigin() {
|
|
||||||
const oldPushResult = QUnit.assert.pushResult;
|
|
||||||
|
|
||||||
QUnit.assert.pushResult = function (resultInfo) {
|
|
||||||
if (resultInfo.source) {
|
|
||||||
resultInfo.source = resultInfo.source.replaceAll(
|
|
||||||
`${window.origin}/`,
|
|
||||||
"/"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
oldPushResult.call(this, resultInfo);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleLegacyParameters() {
|
function handleLegacyParameters() {
|
||||||
for (const param of [
|
for (const param of [
|
||||||
"qunit_single_plugin",
|
"qunit_single_plugin",
|
||||||
|
@ -8782,11 +8782,6 @@ patch-package@^8.0.0:
|
|||||||
tmp "^0.0.33"
|
tmp "^0.0.33"
|
||||||
yaml "^2.2.2"
|
yaml "^2.2.2"
|
||||||
|
|
||||||
path-browserify@^1.0.1:
|
|
||||||
version "1.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-1.0.1.tgz#d98454a9c3753d5790860f16f68867b9e46be1fd"
|
|
||||||
integrity sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==
|
|
||||||
|
|
||||||
path-exists@^3.0.0:
|
path-exists@^3.0.0:
|
||||||
version "3.0.0"
|
version "3.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515"
|
resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515"
|
||||||
@ -9866,7 +9861,7 @@ source-map-resolve@^0.5.0:
|
|||||||
source-map-url "^0.4.0"
|
source-map-url "^0.4.0"
|
||||||
urix "^0.1.0"
|
urix "^0.1.0"
|
||||||
|
|
||||||
source-map-support@^0.5.21, source-map-support@~0.5.20:
|
source-map-support@~0.5.20:
|
||||||
version "0.5.21"
|
version "0.5.21"
|
||||||
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f"
|
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f"
|
||||||
integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==
|
integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==
|
||||||
|
Loading…
Reference in New Issue
Block a user