With macOS 10.13.6 (High Sierra), and an up to date Google Chrome browser, there is a single CodeMirror6 view/test that fails … sometimes.
The test code is
it(“can cross large line widgets during line motion”, function () {
var cm = tempEditor(“one\ntwo”, [ViewField.decorations({
create: function () {
return Decoration.set([
Decoration.widget(3, { widget: new BigWidget(undefined), side: 1, block: true }),
Decoration.widget(4, { widget: new BigWidget(undefined), side: -1, block: true })
]);
},
update: function (deco) { return deco; }
})]);
ist_1(cm.contentDOM.offsetHeight, 400, “>”);
ist_1(cm.movePos(0, “forward”, “line”), 4);
ist_1(cm.movePos(2, “forward”, “line”), 6);
ist_1(cm.movePos(3, “forward”, “line”), 7);
ist_1(cm.movePos(4, “backward”, “line”), 0);
ist_1(cm.movePos(5, “backward”, “line”), 1);
ist_1(cm.movePos(7, “backward”, “line”), 3);
});
The particular line that is failing is in bold. It is the first call to movePos that tests the backward motion. The expected value is 0, but when this fails, the value returned by movePos is 3.
Most odd though is that this sometimes passes in the same OS and browser today.
When I first observed the problem, the test was served with a simple python file server. When I switched to loading the index.html file using file:/// from the Chrome search bar, the problem was also there, same test failing, same message about 3 != 0. But now for the past hour or more, this test case is only failing for the python server case and it is passing for the direct loaded file case. I have ensured caching is disabled and I have manually changed the expected response from 0, to 3, and ascertained that the page and it’s test does return a different value depending on how the page is loaded.
So does this point to a bug in the Chrome browser or is there some uninitialized data possible in the javascript code that could sometimes yield one answer or the other?
Short of other ideas, I may whittle down the test_built.js file first to see how small it can be made and still show the inconsistency.