Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test runner #5686

Merged
merged 4 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/anchor_test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
if (typeof process !== "undefined") {
require("amd-loader");
}

"use strict";

var Document = require("./document").Document;
Expand Down
4 changes: 0 additions & 4 deletions src/background_tokenizer_test.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
if (typeof process !== "undefined") {
require("amd-loader");
}

"use strict";

var EditSession = require("./edit_session").EditSession;
var JavaScriptMode = require("./mode/javascript").Mode;

Check warning on line 4 in src/background_tokenizer_test.js

View workflow job for this annotation

GitHub Actions / build (16.x)

'JavaScriptMode' is assigned a value but never used
var LuaMode = require("./mode/lua").Mode;

Check warning on line 5 in src/background_tokenizer_test.js

View workflow job for this annotation

GitHub Actions / build (16.x)

'LuaMode' is assigned a value but never used
var Range = require("./range").Range;
var assert = require("./test/assertions");

Expand Down
4 changes: 0 additions & 4 deletions src/commands/command_manager_test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
if (typeof process !== "undefined") {
require("amd-loader");
}

"use strict";

var CommandManager = require("./command_manager").CommandManager;
Expand Down
9 changes: 4 additions & 5 deletions src/config_test.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
if (typeof process !== "undefined") {
require("amd-loader");
}

"use strict";

var config = require("./config");
var assert = require("./test/assertions");
var {defaultEnglishMessages} = require("./lib/default_english_messages");

module.exports = {

tearDown: function() {
config.setMessages(defaultEnglishMessages);
},
"test: path resolution" : function(done) {
config.set("packaged", true);
var url = config.moduleUrl("kr_theme", "theme");
Expand Down
4 changes: 0 additions & 4 deletions src/document_test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
if (typeof process !== "undefined") {
require("amd-loader");
}

"use strict";

var Document = require("./document").Document;
Expand Down
52 changes: 39 additions & 13 deletions src/edit_session_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@

"test issue 83": function() {
var session = new EditSession("");
var editor = new Editor(new MockRenderer(), session);

Check warning on line 439 in src/edit_session_test.js

View workflow job for this annotation

GitHub Actions / build (16.x)

'editor' is assigned a value but never used
var document = session.getDocument();

session.setUseWrapMode(true);
Expand All @@ -448,7 +448,7 @@

"test wrapMode init has to create wrapData array": function() {
var session = new EditSession("foo bar\nfoo bar");
var editor = new Editor(new MockRenderer(), session);

Check warning on line 451 in src/edit_session_test.js

View workflow job for this annotation

GitHub Actions / build (16.x)

'editor' is assigned a value but never used

session.setUseWrapMode(true);
session.setWrapLimitRange(3, 3);
Expand Down Expand Up @@ -1106,24 +1106,50 @@
},

"test: mode loading" : function(next) {
if (!require.undef) {
console.log("Skipping test: This test only runs in the browser");
next();
return;
}
delete EditSession.prototype.$modes["ace/mode/javascript"];
delete EditSession.prototype.$modes["ace/mode/css"];
delete EditSession.prototype.$modes["ace/mode/sh"];
require("./config").setLoader(function(name, onLoad) {
if (name == "ace/mode/javascript") {
return onLoad(null, require("./mode/javascript"));
}
if (name == "ace/mode/sh") {
return setTimeout(function() {
return onLoad(null, require("./mode/sh"));
});
}
if (name == "ace/mode/css") {
return setTimeout(function() {
return onLoad(null, require("./mode/css"));
});
}
});
var session = new EditSession([]);
session.setMode("ace/mode/javascript");
assert.equal(session.$modeid, "ace/mode/javascript");
session.on("changeMode", function() {
assert.equal(session.$modeid, "ace/mode/javascript");
assert.equal(session.$modeId, "ace/mode/javascript");

var modeChangeCallbacks = 0;
session.once("changeMode", function() {
assert.equal(session.$modeId, "ace/mode/sh");
modeChangeCallbacks++;
});
session.setMode("ace/mode/sh", function(mode) {
assert.ok(!mode);
session.setMode("ace/mode/sh", function() {
assert.equal(session.$mode.$id, "ace/mode/sh");
modeChangeCallbacks++;
});
assert.equal(session.$modeId, "ace/mode/sh");
assert.equal(session.$mode.$id, "ace/mode/javascript");
setTimeout(function() {
session.setMode("ace/mode/javascript", function(mode) {
session.setMode("ace/mode/javascript");
assert.equal(session.$modeid, "ace/mode/javascript");
assert.equal(modeChangeCallbacks, 2);
session.setMode("ace/mode/javascript");
assert.equal(session.$mode.$id, "ace/mode/javascript");
session.setMode("ace/mode/sh");
assert.equal(session.$mode.$id, "ace/mode/sh");
session.setMode("ace/mode/css");
assert.equal(session.$mode.$id, "ace/mode/sh");
// TODO this should not error
// session.destroy();
setTimeout(function() {
next();
});
}, 0);
Expand Down
4 changes: 0 additions & 4 deletions src/ext/beautify_test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
if (typeof process !== "undefined") {
require("amd-loader");
}

"use strict";

var assert = require("assert");
Expand Down
4 changes: 0 additions & 4 deletions src/ext/emmet_test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
if (typeof process !== "undefined") {
require("amd-loader");
}

"use strict";

require("../test/mockdom");
Expand Down
4 changes: 0 additions & 4 deletions src/ext/error_marker_test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
if (typeof process !== "undefined") {
require("amd-loader");
}

"use strict";

var assert = require("./../test/assertions");
Expand Down
4 changes: 0 additions & 4 deletions src/ext/hardwrap_test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
if (typeof process !== "undefined") {
require("amd-loader");
}

"use strict";

var assert = require("./../test/assertions");
Expand Down
4 changes: 0 additions & 4 deletions src/ext/static_highlight_test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
if (typeof process !== "undefined") {
require("amd-loader");
}

"use strict";

var assert = require("assert");
Expand All @@ -10,7 +6,7 @@
var JavaScriptMode = require("../mode/javascript").Mode;
var TextMode = require("../mode/text").Mode;
var dom = require("../lib/dom");
var config = require("../config");

Check warning on line 9 in src/ext/static_highlight_test.js

View workflow job for this annotation

GitHub Actions / build (16.x)

'config' is assigned a value but never used

// Execution ORDER: test.setUpSuite, setUp, testFn, tearDown, test.tearDownSuite
module.exports = {
Expand Down
4 changes: 0 additions & 4 deletions src/ext/whitespace_test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
if (typeof process !== "undefined") {
require("amd-loader");
}

"use strict";

require("../test/mockdom");
Expand Down
4 changes: 0 additions & 4 deletions src/incremental_search_test.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
if (typeof process !== "undefined") {
require("amd-loader");
}

"use strict";

var emacs = require('./keyboard/emacs');

Check warning on line 3 in src/incremental_search_test.js

View workflow job for this annotation

GitHub Actions / build (16.x)

'emacs' is assigned a value but never used
var EditSession = require("./edit_session").EditSession;
var Editor = require("./editor").Editor;
var MockRenderer = require("./test/mockrenderer").MockRenderer;
var Range = require("./range").Range;

Check warning on line 7 in src/incremental_search_test.js

View workflow job for this annotation

GitHub Actions / build (16.x)

'Range' is assigned a value but never used
var MultiSelect = require("./multi_select").MultiSelect;
var assert = require("./test/assertions");
var IncrementalSearch = require("./incremental_search").IncrementalSearch;
Expand Down
4 changes: 0 additions & 4 deletions src/keyboard/keybinding_test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
if (typeof process !== "undefined") {
require("amd-loader");
}

"use strict";

var EditSession = require("./../edit_session").EditSession,
Expand Down
4 changes: 0 additions & 4 deletions src/keyboard/textinput_test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
/*global CustomEvent*/

if (typeof process !== "undefined") {
require("amd-loader");
}

"use strict";

require("../test/mockdom");
Expand Down
4 changes: 0 additions & 4 deletions src/keyboard/vim_ace_test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
/*global CustomEvent*/

if (typeof process !== "undefined") {
require("amd-loader");
}

"use strict";

var assert = require("./../test/assertions");
Expand Down
2 changes: 1 addition & 1 deletion src/lib/app_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class AppConfig {
*/
nls(key, defaultString, params) {
if (!messages[key]) {
warn("No message found for the key '" + key + "' in the provided messages, trying to find a translation for the default string '" + defaultString + "'.");
warn("No message found for the key '" + key + "' in messages with id " + messages.$id + ", trying to find a translation for the default string '" + defaultString + "'.");
if (!messages[defaultString]) {
warn("No message found for the default string '" + defaultString + "' in the provided messages. Falling back to the default English message.");
}
Expand Down
4 changes: 0 additions & 4 deletions src/lib/event_emitter_test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
if (typeof process !== "undefined") {
require("amd-loader");
}

"use strict";

var oop = require("../lib/oop");
Expand Down
2 changes: 0 additions & 2 deletions src/mode/_test/highlight_rules_test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var fs = require("fs");
var path = require("path");
var regexpTokenizer = require("../../../tool/regexp_tokenizer");

Check warning on line 3 in src/mode/_test/highlight_rules_test.js

View workflow job for this annotation

GitHub Actions / build (16.x)

'regexpTokenizer' is assigned a value but never used
var EditSession = require("../../edit_session").EditSession;
var Editor = require("../../editor").Editor;
var MockRenderer = require("../../test/mockrenderer").MockRenderer;
Expand All @@ -10,8 +10,6 @@
if (!fs.existsSync)
fs.existsSync = path.existsSync;

require("amd-loader");

var cwd = __dirname + "/";
var root = path.normalize(cwd + Array(4).join("../"));

Expand Down
4 changes: 0 additions & 4 deletions src/mode/ada_test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
if (typeof process !== "undefined") {
require("amd-loader");
}

"use strict";

var EditSession = require("../edit_session").EditSession;
Expand Down
4 changes: 0 additions & 4 deletions src/mode/coldfusion_test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
if (typeof process !== "undefined") {
require("amd-loader");
}

"use strict";

var EditSession = require("../edit_session").EditSession;
Expand All @@ -17,8 +13,8 @@
"test: toggle comment lines" : function() {
var session = new EditSession([" abc", " cde", "fg"]);

var range = new Range(0, 3, 1, 1);

Check warning on line 16 in src/mode/coldfusion_test.js

View workflow job for this annotation

GitHub Actions / build (16.x)

'range' is assigned a value but never used
var comment = this.mode.toggleCommentLines("start", session, 0, 1);

Check warning on line 17 in src/mode/coldfusion_test.js

View workflow job for this annotation

GitHub Actions / build (16.x)

'comment' is assigned a value but never used
assert.equal([" <!--abc-->", " <!--cde-->", "fg"].join("\n"), session.toString());
},

Expand Down
4 changes: 0 additions & 4 deletions src/mode/css_test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
if (typeof process !== "undefined") {
require("amd-loader");
}

"use strict";

var EditSession = require("../edit_session").EditSession;
Expand Down
3 changes: 0 additions & 3 deletions src/mode/folding/basic_test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
if (typeof process !== "undefined")
require("amd-loader");

"use strict";

var BasicMode = require("../basic").Mode;
Expand Down
3 changes: 0 additions & 3 deletions src/mode/folding/coffee_test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
if (typeof process !== "undefined")
require("amd-loader");

"use strict";

var CoffeeMode = require("../coffee").Mode;
Expand Down
3 changes: 0 additions & 3 deletions src/mode/folding/cstyle_test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
if (typeof process !== "undefined")
require("amd-loader");

"use strict";

var JavaScriptMode = require("../javascript").Mode;
Expand Down
3 changes: 0 additions & 3 deletions src/mode/folding/fold_mode_test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
if (typeof process !== "undefined")
require("amd-loader");

"use strict";

var MarkdownMode = require("../markdown").Mode;
Expand Down
3 changes: 0 additions & 3 deletions src/mode/folding/html_test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
if (typeof process !== "undefined")
require("amd-loader");

"use strict";

var HtmlMode = require("../html").Mode;
Expand Down
3 changes: 0 additions & 3 deletions src/mode/folding/javascript_test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
if (typeof process !== "undefined")
require("amd-loader");

"use strict";

var JavaScriptMode = require("../javascript").Mode;
Expand Down
2 changes: 0 additions & 2 deletions src/mode/folding/latex_test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
if (typeof process !== "undefined") require("amd-loader");

"use strict";

var LatexMode = require("../latex").Mode;
Expand Down
2 changes: 0 additions & 2 deletions src/mode/folding/lua_test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
if (typeof process !== "undefined") require("amd-loader");

"use strict";

var LuaMode = require("../lua").Mode;
Expand Down
2 changes: 0 additions & 2 deletions src/mode/folding/php_test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
if (typeof process !== "undefined") require("amd-loader");

"use strict";

var PHPMode = require("../php").Mode;
Expand Down
3 changes: 0 additions & 3 deletions src/mode/folding/pythonic_test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
if (typeof process !== "undefined")
require("amd-loader");

"use strict";

var PythonMode = require("../python").Mode;
Expand Down
3 changes: 0 additions & 3 deletions src/mode/folding/ruby_test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
if (typeof process !== "undefined")
require("amd-loader");

"use strict";

var RubyMode = require("../ruby").Mode;
Expand Down
3 changes: 0 additions & 3 deletions src/mode/folding/vbscript_test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
if (typeof process !== "undefined")
require("amd-loader");

"use strict";

var VBScriptMode = require("../vbscript").Mode;
Expand Down
3 changes: 0 additions & 3 deletions src/mode/folding/xml_test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
if (typeof process !== "undefined")
require("amd-loader");

"use strict";

var XmlMode = require("../xml").Mode;
Expand Down
3 changes: 0 additions & 3 deletions src/mode/folding/yaml_test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
if (typeof process !== "undefined")
require("amd-loader");

"use strict";

var YamlMode = require("../yaml").Mode;
Expand Down
4 changes: 0 additions & 4 deletions src/mode/html_test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
if (typeof process !== "undefined") {
require("amd-loader");
}

"use strict";

var EditSession = require("../edit_session").EditSession;
Expand Down
4 changes: 0 additions & 4 deletions src/mode/javascript_test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
if (typeof process !== "undefined") {
require("amd-loader");
}

"use strict";

var EditSession = require("../edit_session").EditSession;
Expand Down
4 changes: 0 additions & 4 deletions src/mode/logiql_test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
if (typeof process !== "undefined") {
require("amd-loader");
}

"use strict";

var EditSession = require("../edit_session").EditSession;
Expand Down
4 changes: 0 additions & 4 deletions src/mode/odin_test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
if (typeof process !== "undefined") {
require("amd-loader");
}

"use strict";

var EditSession = require("../edit_session").EditSession;
Expand Down
4 changes: 0 additions & 4 deletions src/mode/php_test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
if (typeof process !== "undefined") {
require("amd-loader");
}

"use strict";

var EditSession = require("../edit_session").EditSession;
Expand Down
4 changes: 0 additions & 4 deletions src/mode/plain_text_test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
if (typeof process !== "undefined") {
require("amd-loader");
}

"use strict";

var EditSession = require("../edit_session").EditSession;
Expand Down
4 changes: 0 additions & 4 deletions src/mode/python_test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
if (typeof process !== "undefined") {
require("amd-loader");
}

"use strict";

var EditSession = require("../edit_session").EditSession;
Expand Down
Loading
Loading