It would be good to make CodeMirror more testable and add some tests, possibly using QUnit for unit tests.
Description
Details
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Resolved | kaldari | T101246 Highlighted wikisyntax while editing articles [AOI] | |||
Resolved | MaxSem | T185030 Graduate Syntax Highlighting (CodeMirror) out of beta for non-RTL wikis on the 2010 wikitext editor | |||
Open | None | T186850 Wikimedia-deployed extensions/skins with no PHPUnit coverage | |||
Resolved | MusikAnimal | T169592 Create unit tests for CodeMirror |
Event Timeline
If unit tests are turning out to be hard (T179534#4048202), we should at minimum do some integration tests. I know breaking that code apart is not easy.
Maybe you mean acceptance tests? Those I think will be even harder... unless some wants to give me the rundown of the MediaWiki-way of doing it. Acceptance tests are nice because they can do some cross-browser testing, but from my experience they are slow and fragile. Here the "stream" and colouring is specified in markup produced by all those functions, so unit tests seem quite fitting.
No one has worked with QUnit? Maybe I could poke the VisualEditor folks for help.
Uh, I mean testing the entire module. Supplied x, Expected y and so on.
Pinging @Esanders in case he's got any pointers for us.
That sounds pretty great, and perhaps better! But dunno how to do that either :(
I assume it's all with QUnit, which brings me to my question for Ed -- How do you get Special:JavascriptTests to run tests within an extension? I have VisualEditor installed and it's not running those tests, either. Hard to diagnose over Phabricator, I'm sure, but maybe you know of some better how-to guides than Manual:JavaScript unit testing, or a guide specifically for doing this in extensions?
Got it to work! \o/ There was a typo :) I'm not sure why the VE tests aren't running, but I'm not going to worry about it. Thanks anyway!
Change 419513 had a related patch set uploaded (by MusikAnimal; owner: MusikAnimal):
[mediawiki/extensions/CodeMirror@master] [WIP] (not ready for merge) One passing test!
See the patch for the test cases I've added. That should cover all the highlighting tickets at MediaWiki-extensions-CodeMirror, along with some other basics.
Change 420833 had a related patch set uploaded (by MusikAnimal; owner: MusikAnimal):
[integration/config@master] Add QUnit to CodeMirror
Change 420833 merged by jenkins-bot:
[integration/config@master] Add QUnit to CodeMirror
Change 419513 merged by jenkins-bot:
[mediawiki/extensions/CodeMirror@master] Tests for MediaWiki CodeMirror syntax highlighting