aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes
diff options
context:
space:
mode:
authorTimo Tijhof <krinkle@fastmail.com>2025-03-08 16:53:01 -0800
committerKrinkle <krinkle@fastmail.com>2025-03-26 19:37:59 +0000
commitcc1970b97e102d5113d5dfbe9215140e9089076d (patch)
tree21cce920dec0c1ec7f5f22607aec64f3ccc31320 /tests/phpunit/includes
parent2c025ead5ff12bd507773392e5748fce161cfe46 (diff)
downloadmediawikicore-cc1970b97e102d5113d5dfbe9215140e9089076d.tar.gz
mediawikicore-cc1970b97e102d5113d5dfbe9215140e9089076d.zip
ResourceLoader: Add page title to user script syntax error
This follows-up Ie309e761f (53a3c8b417), in which we switched from calling JsMinPlus/JSParser (which took $fileName as argument, and throw an exception that already included "on line N in X.js") to calling Peast. That patch formatted the error as "on line N" but forgot to include "in X.js". Test plan: * Log in as admin and create "MediaWiki:Common.js" with "foo/;", which is invalid syntax. Then browse the main page and check the browser console. * Before: "Parse error: Unexpected: ; on line 1" * After: "Parse error: Unexpected: ; on line 1 in MediaWiki:Common.js" While at it, document why this cache key is not purely MD5-based, but also includes wiki and page title. Change-Id: I16c3b1dacd02ee26a254809e6a9ac60f72aba4da
Diffstat (limited to 'tests/phpunit/includes')
-rw-r--r--tests/phpunit/includes/ResourceLoader/ModuleTest.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/phpunit/includes/ResourceLoader/ModuleTest.php b/tests/phpunit/includes/ResourceLoader/ModuleTest.php
index 951e4f916bd0..b9d7bddf2e0a 100644
--- a/tests/phpunit/includes/ResourceLoader/ModuleTest.php
+++ b/tests/phpunit/includes/ResourceLoader/ModuleTest.php
@@ -156,17 +156,17 @@ class ModuleTest extends ResourceLoaderTestCase {
yield 'valid ES2017 async-await' => [
"var foo = async function(x) { return await x.fetch(); }",
- 'Parse error: Unexpected: function on line 1'
+ 'Parse error: Unexpected: function on line 1 in input.js'
];
yield 'valid ES2018 spread in object literal' => [
"var x = {b: 2, c: 3}; var y = {a: 1, ...x};",
- 'Parse error: Unexpected: ... on line 1'
+ 'Parse error: Unexpected: ... on line 1 in input.js'
];
yield 'SyntaxError' => [
"var a = 'this is';\n {\ninvalid",
- 'Parse error: Unclosed { on line 3'
+ 'Parse error: Unclosed { on line 3 in input.js'
];
// If an implementation matches inputs using a regex with runaway backtracking,