Cleaner fix for race condition bugs in JS code hints unit tests.

This commit is contained in:
Peter Flynn committed 2013-10-10 18:45:42 -07:00
1 parent af57cff028
commit 087a4519a5
2 files changed
+8 -7

No files matched your search

@@ -1444,6 +1444,12 @@ define(function (require, exports, module) {
function handleProjectOpen(projectRootPath) {
initPreferences(projectRootPath);
}
/** Used to avoid timing bugs in unit tests */
function _readyPromise() {
return deferredPreferences;
}
exports.getBuiltins = getBuiltins;
exports.getResolvedPath = getResolvedPath;
@@ -1456,5 +1462,6 @@ define(function (require, exports, module) {
exports.requestParameterHint = requestParameterHint;
exports.handleProjectClose = handleProjectClose;
exports.handleProjectOpen = handleProjectOpen;
exports._readyPromise = _readyPromise;
});
@@ -424,7 +424,6 @@ define(function (require, exports, module) {
}
}
var firstTest = true;
function setupTest(path, primePump) { // FIXME: primePump argument ignored even though used below
DocumentManager.getDocumentForPath(path).done(function (doc) {
testDoc = doc;
@@ -439,10 +438,7 @@ define(function (require, exports, module) {
testEditor = createMockEditor(testDoc);
preTestText = testDoc.getText();
if (firstTest) {
waits(1000); // give time to load preferences file; code hints NPE otherwise
firstTest = false;
}
waitsForDone(ScopeManager._readyPromise());
});
}
@@ -747,8 +743,6 @@ define(function (require, exports, module) {
end = { line: 6, ch: 8 },
endplus = { line: 6, ch: 12 };
waits(1000); // TODO filesystem: why does this test need a delay to pass most of the time?
runs(function () {
testDoc.replaceRange("A1.prop", start, start);
testEditor.setCursorPos(middle);