From 6f20ac290d691269f7938d166212a54aa1e2d39f Mon Sep 17 00:00:00 2001 From: Christopher Allen Date: Fri, 18 Aug 2023 18:06:52 +0100 Subject: [PATCH] refactor(tests): Use `import` instead of `goog.bootstrap` to load Blockly in mocha tests (#7406) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(build): Have buildShims clean up up after itself We need to create a build/package.json file to allow node.js to load build/src/core/blockly.js and the other chunk entry points as ES modules (it forcibly assumes .js means CJS even if one is trying to import, unless package.json says {"type": "module"}), but this interferes with scripts/migration/js2ts doing a require('build/deps.js'), which is _not_ an ES module. Specific error message was: /Users/cpcallen/src/blockly/scripts/migration/js2ts:56 require(path.resolve(__dirname, '../../build/deps.js')); ^ Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/cpcallen/src/blockly/build/deps.js from /Users/cpcallen/src/blockly/scripts/migration/js2ts not supported. deps.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules. Instead rename deps.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /Users/cpcallen/src/blockly/build/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead). at Object. (/Users/cpcallen/src/blockly/scripts/migration/js2ts:56:1) { code: 'ERR_REQUIRE_ESM' } * chore(tests): Reorder to put interesting script nearer top of file * chore(tests): Add missing imports of closure/goog/goog.js These modules were depending on being loaded via the debug module loader, which cannot be used without first loading base.js as a script, and thereby defining goog.declareModuleId as a side effect—but if they are to be loaded via direct import statements then they need to actually import their own dependencies. This is a temporary measure as soon the goog.declareMouleId calls can themselves be deleted. * refactor(tests): Use import instead of bootstrap to load Blockly * chores(build): Stop generating deps.mocha.js This file was only needed by tests/mocha/index.html's use of the debug module loader (via bootstrap.js), which has now been removed. * chore(tests): Remove unneeded goog.declareModuleId calls These were only needed because these modules were previously being loaded by goog.require and/or goog.bootstrap. * chores(tests): Remove dead code We are fully committed to proper modules now. --- scripts/gulpfiles/build_tasks.js | 33 +-- scripts/gulpfiles/config.js | 3 - tests/mocha/astnode_test.js | 2 - tests/mocha/block_json_test.js | 2 - tests/mocha/block_test.js | 2 - tests/mocha/blocks/lists_test.js | 2 - tests/mocha/blocks/logic_ternary_test.js | 2 - tests/mocha/blocks/procedures_test.js | 2 - tests/mocha/blocks/variables_test.js | 2 - tests/mocha/clipboard_test.js | 2 - tests/mocha/comment_deserialization_test.js | 2 - tests/mocha/comment_test.js | 2 - tests/mocha/connection_checker_test.js | 2 - tests/mocha/connection_db_test.js | 2 - tests/mocha/connection_test.js | 2 - tests/mocha/contextmenu_items_test.js | 2 - tests/mocha/cursor_test.js | 2 - tests/mocha/dropdowndiv_test.js | 2 - tests/mocha/event_block_change_test.js | 2 - tests/mocha/event_block_create_test.js | 2 - tests/mocha/event_block_delete_test.js | 2 - tests/mocha/event_block_drag_test.js | 2 - ...nt_block_field_intermediate_change_test.js | 2 - tests/mocha/event_block_move_test.js | 2 - tests/mocha/event_bubble_open_test.js | 2 - tests/mocha/event_click_test.js | 2 - tests/mocha/event_comment_change_test.js | 2 - tests/mocha/event_comment_create_test.js | 2 - tests/mocha/event_comment_delete_test.js | 2 - tests/mocha/event_comment_move_test.js | 2 - tests/mocha/event_marker_move_test.js | 2 - tests/mocha/event_selected_test.js | 2 - tests/mocha/event_test.js | 2 - tests/mocha/event_theme_change_test.js | 2 - tests/mocha/event_toolbox_item_select_test.js | 2 - tests/mocha/event_trashcan_open_test.js | 2 - tests/mocha/event_var_create_test.js | 2 - tests/mocha/event_var_delete_test.js | 2 - tests/mocha/event_var_rename_test.js | 2 - tests/mocha/event_viewport_test.js | 2 - tests/mocha/extensions_test.js | 2 - tests/mocha/field_angle_test.js | 2 - tests/mocha/field_checkbox_test.js | 2 - tests/mocha/field_colour_test.js | 2 - tests/mocha/field_dropdown_test.js | 2 - tests/mocha/field_image_test.js | 2 - tests/mocha/field_label_serializable_test.js | 2 - tests/mocha/field_label_test.js | 2 - tests/mocha/field_multilineinput_test.js | 2 - tests/mocha/field_number_test.js | 2 - tests/mocha/field_registry_test.js | 2 - tests/mocha/field_test.js | 2 - tests/mocha/field_textinput_test.js | 2 - tests/mocha/field_variable_test.js | 2 - tests/mocha/flyout_test.js | 2 - tests/mocha/generator_test.js | 2 - tests/mocha/gesture_test.js | 2 - tests/mocha/icon_test.js | 2 - tests/mocha/index.html | 231 +++++++++--------- tests/mocha/input_test.js | 2 - tests/mocha/insertion_marker_manager_test.js | 2 - tests/mocha/insertion_marker_test.js | 2 - tests/mocha/jso_deserialization_test.js | 2 - tests/mocha/jso_serialization_test.js | 2 - tests/mocha/json_test.js | 2 - tests/mocha/keydown_test.js | 2 - tests/mocha/metrics_test.js | 2 - tests/mocha/mutator_test.js | 2 - tests/mocha/names_test.js | 2 - tests/mocha/procedure_map_test.js | 2 - tests/mocha/registry_test.js | 2 - tests/mocha/render_management_test.js | 2 - tests/mocha/serializer_test.js | 2 - tests/mocha/shortcut_registry_test.js | 2 - tests/mocha/test_helpers/block_definitions.js | 2 - tests/mocha/test_helpers/code_generation.js | 2 - tests/mocha/test_helpers/common.js | 2 - tests/mocha/test_helpers/events.js | 2 - tests/mocha/test_helpers/fields.js | 2 - tests/mocha/test_helpers/procedures.js | 1 - tests/mocha/test_helpers/serialization.js | 22 +- tests/mocha/test_helpers/setup_teardown.js | 2 - .../mocha/test_helpers/toolbox_definitions.js | 2 - tests/mocha/test_helpers/user_input.js | 2 - tests/mocha/test_helpers/variables.js | 2 - tests/mocha/test_helpers/warnings.js | 2 - tests/mocha/test_helpers/workspace.js | 2 - tests/mocha/theme_test.js | 2 - tests/mocha/toolbox_test.js | 2 - tests/mocha/tooltip_test.js | 2 - tests/mocha/touch_test.js | 2 - tests/mocha/trashcan_test.js | 2 - tests/mocha/utils_test.js | 2 - tests/mocha/variable_map_test.js | 2 - tests/mocha/variable_model_test.js | 2 - tests/mocha/widget_div_test.js | 2 - tests/mocha/workspace_comment_test.js | 2 - tests/mocha/workspace_svg_test.js | 2 - tests/mocha/workspace_test.js | 2 - tests/mocha/xml_test.js | 2 - tests/mocha/zoom_controls_test.js | 2 - 101 files changed, 123 insertions(+), 359 deletions(-) diff --git a/scripts/gulpfiles/build_tasks.js b/scripts/gulpfiles/build_tasks.js index d6cc38b7c..0d7517750 100644 --- a/scripts/gulpfiles/build_tasks.js +++ b/scripts/gulpfiles/build_tasks.js @@ -22,7 +22,7 @@ const closureCompiler = require('google-closure-compiler').gulp(); const argv = require('yargs').argv; const {rimraf} = require('rimraf'); -const {BUILD_DIR, DEPS_FILE, RELEASE_DIR, TEST_DEPS_FILE, TSC_OUTPUT_DIR, TYPINGS_BUILD_DIR} = require('./config'); +const {BUILD_DIR, DEPS_FILE, RELEASE_DIR, TSC_OUTPUT_DIR, TYPINGS_BUILD_DIR} = require('./config'); const {getPackageJson} = require('./helper_tasks'); const {posixPath, quote} = require('../helpers'); @@ -305,36 +305,17 @@ function buildJavaScript(done) { * This task updates DEPS_FILE (deps.js), used by the debug module * loader (via bootstrap.js) when loading Blockly in uncompiled mode. * - * Also updates TEST_DEPS_FILE (deps.mocha.js), used by the mocha test - * suite. - * * Prerequisite: buildJavaScript. */ function buildDeps() { const roots = [ path.join(TSC_OUTPUT_DIR, 'closure', 'goog', 'base.js'), TSC_OUTPUT_DIR, - 'tests/mocha', ]; /** Maximum buffer size, in bytes for child process stdout/stderr. */ const MAX_BUFFER_SIZE = 10 * 1024 * 1024; - /** - * Filter a string to extract lines containing (or not containing) the - * specified target string. - * - * @param {string} text Text to filter. - * @param {string} target String to search for. - * @param {boolean?} exclude If true, extract only non-matching lines. - * @returns {string} Filtered text. - */ - function filter(text, target, exclude) { - return text.split('\n') - .filter((line) => Boolean(line.match(target)) !== Boolean(exclude)) - .join('\n'); - } - /** * Log unexpected diagnostics, after removing expected warnings. * @@ -374,9 +355,7 @@ error message above, try running: } else { log(stderr); // Anything not about mocha goes in DEPS_FILE. - fs.writeFileSync(DEPS_FILE, filter(stdout, 'tests/mocha', true)); - // Anything about mocha does in TEST_DEPS_FILE. - fs.writeFileSync(TEST_DEPS_FILE, filter(stdout, 'tests/mocha')); + fs.writeFileSync(DEPS_FILE, stdout); resolve(); } }); @@ -691,10 +670,8 @@ async function buildShims() { // ESM, but fortunately we don't attempt to import or require this // file from node.js - we only feed it to Closure Compiler, which // uses the type information in deps.js rather than package.json. - await fsPromises.writeFile( - path.join(BUILD_DIR, 'package.json'), - '{"type": "module"}' - ); + const TMP_PACKAGE_JSON = path.join(BUILD_DIR, 'package.json'); + await fsPromises.writeFile(TMP_PACKAGE_JSON, '{"type": "module"}'); // Import each entrypoint module, enumerate its exports, and write // a shim to load the chunk either by importing the entrypoint @@ -723,6 +700,8 @@ ${Object.keys(exports).map((name) => ` ${name},`).join('\n')} ); `); })); + + await fsPromises.rm(TMP_PACKAGE_JSON); } diff --git a/scripts/gulpfiles/config.js b/scripts/gulpfiles/config.js index 674432dde..02a0499c4 100644 --- a/scripts/gulpfiles/config.js +++ b/scripts/gulpfiles/config.js @@ -28,9 +28,6 @@ exports.BUILD_DIR = 'build'; // Dependencies file (used by bootstrap.js in uncompiled mode): exports.DEPS_FILE = path.join(exports.BUILD_DIR, 'deps.js'); -// Mocha test dependencies file (used by tests/mocha/index.html): -exports.TEST_DEPS_FILE = path.join(exports.BUILD_DIR, 'deps.mocha.js'); - // Directory to write typings output to. exports.TYPINGS_BUILD_DIR = path.join(exports.BUILD_DIR, 'declarations'); diff --git a/tests/mocha/astnode_test.js b/tests/mocha/astnode_test.js index a91119261..a9f0de0d3 100644 --- a/tests/mocha/astnode_test.js +++ b/tests/mocha/astnode_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.astNode'); - import {ASTNode} from '../../build/src/core/keyboard_nav/ast_node.js'; import { sharedTestSetup, diff --git a/tests/mocha/block_json_test.js b/tests/mocha/block_json_test.js index cd4337ef0..e89c68e7c 100644 --- a/tests/mocha/block_json_test.js +++ b/tests/mocha/block_json_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.blockJson'); - import {Align} from '../../build/src/core/inputs/align.js'; import { sharedTestSetup, diff --git a/tests/mocha/block_test.js b/tests/mocha/block_test.js index 7308ce607..2cf50fea0 100644 --- a/tests/mocha/block_test.js +++ b/tests/mocha/block_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.blocks'); - import {ConnectionType} from '../../build/src/core/connection_type.js'; import {createDeprecationWarningStub} from './test_helpers/warnings.js'; import {createRenderedBlock} from './test_helpers/block_definitions.js'; diff --git a/tests/mocha/blocks/lists_test.js b/tests/mocha/blocks/lists_test.js index e4875225a..07510513b 100644 --- a/tests/mocha/blocks/lists_test.js +++ b/tests/mocha/blocks/lists_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.lists'); - import {runSerializationTestSuite} from '../test_helpers/serialization.js'; import { sharedTestSetup, diff --git a/tests/mocha/blocks/logic_ternary_test.js b/tests/mocha/blocks/logic_ternary_test.js index 9a1e3be48..2afa51f7a 100644 --- a/tests/mocha/blocks/logic_ternary_test.js +++ b/tests/mocha/blocks/logic_ternary_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.logicTernary'); - import * as eventUtils from '../../../build/src/core/events/utils.js'; import {runSerializationTestSuite} from '../test_helpers/serialization.js'; import { diff --git a/tests/mocha/blocks/procedures_test.js b/tests/mocha/blocks/procedures_test.js index 5163e715d..6173179cd 100644 --- a/tests/mocha/blocks/procedures_test.js +++ b/tests/mocha/blocks/procedures_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.procedures'); - import * as Blockly from '../../../build/src/core/blockly.js'; import { assertCallBlockStructure, diff --git a/tests/mocha/blocks/variables_test.js b/tests/mocha/blocks/variables_test.js index 75afa9d56..caee68aec 100644 --- a/tests/mocha/blocks/variables_test.js +++ b/tests/mocha/blocks/variables_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.variables'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/clipboard_test.js b/tests/mocha/clipboard_test.js index f6cf10a25..f134b1d77 100644 --- a/tests/mocha/clipboard_test.js +++ b/tests/mocha/clipboard_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.clipboard'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/comment_deserialization_test.js b/tests/mocha/comment_deserialization_test.js index c7398bbe0..494c584e7 100644 --- a/tests/mocha/comment_deserialization_test.js +++ b/tests/mocha/comment_deserialization_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.commentDeserialization'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/comment_test.js b/tests/mocha/comment_test.js index fa3190d95..6f19aa7f0 100644 --- a/tests/mocha/comment_test.js +++ b/tests/mocha/comment_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.comments'); - import {assertEventFired} from './test_helpers/events.js'; import * as eventUtils from '../../build/src/core/events/utils.js'; import { diff --git a/tests/mocha/connection_checker_test.js b/tests/mocha/connection_checker_test.js index 908adf8fb..09797d6a7 100644 --- a/tests/mocha/connection_checker_test.js +++ b/tests/mocha/connection_checker_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.connectionChecker'); - import {ConnectionType} from '../../build/src/core/connection_type.js'; import { sharedTestSetup, diff --git a/tests/mocha/connection_db_test.js b/tests/mocha/connection_db_test.js index 7f3219fa2..9cf579f1b 100644 --- a/tests/mocha/connection_db_test.js +++ b/tests/mocha/connection_db_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.connectionDb'); - import {ConnectionType} from '../../build/src/core/connection_type.js'; import { sharedTestSetup, diff --git a/tests/mocha/connection_test.js b/tests/mocha/connection_test.js index 0646458b8..afba4948c 100644 --- a/tests/mocha/connection_test.js +++ b/tests/mocha/connection_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.connection'); - import { createGenUidStubWithReturns, sharedTestSetup, diff --git a/tests/mocha/contextmenu_items_test.js b/tests/mocha/contextmenu_items_test.js index a9d1a5009..4596513c6 100644 --- a/tests/mocha/contextmenu_items_test.js +++ b/tests/mocha/contextmenu_items_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.contextMenuItem'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/cursor_test.js b/tests/mocha/cursor_test.js index c435a1e5e..c7b3a76af 100644 --- a/tests/mocha/cursor_test.js +++ b/tests/mocha/cursor_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.cursor'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/dropdowndiv_test.js b/tests/mocha/dropdowndiv_test.js index a2e08e4d1..22066dda4 100644 --- a/tests/mocha/dropdowndiv_test.js +++ b/tests/mocha/dropdowndiv_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.dropdown'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/event_block_change_test.js b/tests/mocha/event_block_change_test.js index 398238527..4f4728cc3 100644 --- a/tests/mocha/event_block_change_test.js +++ b/tests/mocha/event_block_change_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.eventBlockChange'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/event_block_create_test.js b/tests/mocha/event_block_create_test.js index 1469df4bb..b17b277e7 100644 --- a/tests/mocha/event_block_create_test.js +++ b/tests/mocha/event_block_create_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.eventBlockCreate'); - import {assertEventFired} from './test_helpers/events.js'; import * as eventUtils from '../../build/src/core/events/utils.js'; import { diff --git a/tests/mocha/event_block_delete_test.js b/tests/mocha/event_block_delete_test.js index 806ecad4b..1aa70c4d1 100644 --- a/tests/mocha/event_block_delete_test.js +++ b/tests/mocha/event_block_delete_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.eventBlockDelete'); - import {defineRowBlock} from './test_helpers/block_definitions.js'; import { sharedTestSetup, diff --git a/tests/mocha/event_block_drag_test.js b/tests/mocha/event_block_drag_test.js index 176666f6f..8a5399c8b 100644 --- a/tests/mocha/event_block_drag_test.js +++ b/tests/mocha/event_block_drag_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.eventBlockDrag'); - import {defineRowBlock} from './test_helpers/block_definitions.js'; import { sharedTestSetup, diff --git a/tests/mocha/event_block_field_intermediate_change_test.js b/tests/mocha/event_block_field_intermediate_change_test.js index 6990eda19..e8a71effb 100644 --- a/tests/mocha/event_block_field_intermediate_change_test.js +++ b/tests/mocha/event_block_field_intermediate_change_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.eventBlockFieldIntermediateChange'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/event_block_move_test.js b/tests/mocha/event_block_move_test.js index b647ee173..2b4102de6 100644 --- a/tests/mocha/event_block_move_test.js +++ b/tests/mocha/event_block_move_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.eventBlockMove'); - import {defineRowBlock} from './test_helpers/block_definitions.js'; import { sharedTestSetup, diff --git a/tests/mocha/event_bubble_open_test.js b/tests/mocha/event_bubble_open_test.js index 910030b9d..54e48aa9c 100644 --- a/tests/mocha/event_bubble_open_test.js +++ b/tests/mocha/event_bubble_open_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.eventBubbleOpen'); - import {defineMutatorBlocks} from './test_helpers/block_definitions.js'; import { sharedTestSetup, diff --git a/tests/mocha/event_click_test.js b/tests/mocha/event_click_test.js index 47ee96edf..ec998b62d 100644 --- a/tests/mocha/event_click_test.js +++ b/tests/mocha/event_click_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.eventClick'); - import {defineRowBlock} from './test_helpers/block_definitions.js'; import { sharedTestSetup, diff --git a/tests/mocha/event_comment_change_test.js b/tests/mocha/event_comment_change_test.js index fd9827ac6..7c68d0858 100644 --- a/tests/mocha/event_comment_change_test.js +++ b/tests/mocha/event_comment_change_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.eventCommentChange'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/event_comment_create_test.js b/tests/mocha/event_comment_create_test.js index 31ebd2e94..d140eff85 100644 --- a/tests/mocha/event_comment_create_test.js +++ b/tests/mocha/event_comment_create_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.eventCommentCreate'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/event_comment_delete_test.js b/tests/mocha/event_comment_delete_test.js index ae9c016b6..fc4b7701f 100644 --- a/tests/mocha/event_comment_delete_test.js +++ b/tests/mocha/event_comment_delete_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.eventCommentDelete'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/event_comment_move_test.js b/tests/mocha/event_comment_move_test.js index d192053f0..a0b0b5eab 100644 --- a/tests/mocha/event_comment_move_test.js +++ b/tests/mocha/event_comment_move_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.eventCommentMove'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/event_marker_move_test.js b/tests/mocha/event_marker_move_test.js index df8fa544a..26238dc43 100644 --- a/tests/mocha/event_marker_move_test.js +++ b/tests/mocha/event_marker_move_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.eventMarkerMove'); - import {defineRowBlock} from './test_helpers/block_definitions.js'; import { sharedTestSetup, diff --git a/tests/mocha/event_selected_test.js b/tests/mocha/event_selected_test.js index 83a64a566..3c69889f2 100644 --- a/tests/mocha/event_selected_test.js +++ b/tests/mocha/event_selected_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.eventSelected'); - import {defineRowBlock} from './test_helpers/block_definitions.js'; import { sharedTestSetup, diff --git a/tests/mocha/event_test.js b/tests/mocha/event_test.js index 1fd7addb1..e59cb4911 100644 --- a/tests/mocha/event_test.js +++ b/tests/mocha/event_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.event'); - import * as Blockly from '../../build/src/core/blockly.js'; import {ASTNode} from '../../build/src/core/keyboard_nav/ast_node.js'; import { diff --git a/tests/mocha/event_theme_change_test.js b/tests/mocha/event_theme_change_test.js index 1e3fa2c88..155e373a3 100644 --- a/tests/mocha/event_theme_change_test.js +++ b/tests/mocha/event_theme_change_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.eventThemeChange'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/event_toolbox_item_select_test.js b/tests/mocha/event_toolbox_item_select_test.js index 32b085781..82f8e4863 100644 --- a/tests/mocha/event_toolbox_item_select_test.js +++ b/tests/mocha/event_toolbox_item_select_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.eventToolboxItemSelect'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/event_trashcan_open_test.js b/tests/mocha/event_trashcan_open_test.js index c85dbd3d1..84c2abd9c 100644 --- a/tests/mocha/event_trashcan_open_test.js +++ b/tests/mocha/event_trashcan_open_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.eventTrashcanOpen'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/event_var_create_test.js b/tests/mocha/event_var_create_test.js index 433d5d4ae..003cd11b5 100644 --- a/tests/mocha/event_var_create_test.js +++ b/tests/mocha/event_var_create_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.eventVarCreate'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/event_var_delete_test.js b/tests/mocha/event_var_delete_test.js index 2619a8db0..7bad8eb7b 100644 --- a/tests/mocha/event_var_delete_test.js +++ b/tests/mocha/event_var_delete_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.eventVarDelete'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/event_var_rename_test.js b/tests/mocha/event_var_rename_test.js index 8f9d63d88..0c8fb80cd 100644 --- a/tests/mocha/event_var_rename_test.js +++ b/tests/mocha/event_var_rename_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.eventVarRename'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/event_viewport_test.js b/tests/mocha/event_viewport_test.js index 275d6854b..7913e7bf5 100644 --- a/tests/mocha/event_viewport_test.js +++ b/tests/mocha/event_viewport_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.eventViewportChange'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/extensions_test.js b/tests/mocha/extensions_test.js index f918b935c..8eb37e75d 100644 --- a/tests/mocha/extensions_test.js +++ b/tests/mocha/extensions_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.extensions'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/field_angle_test.js b/tests/mocha/field_angle_test.js index 6ab130842..62afd8d27 100644 --- a/tests/mocha/field_angle_test.js +++ b/tests/mocha/field_angle_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.fieldAngle'); - import * as Blockly from '../../build/src/core/blockly.js'; import { assertFieldValue, diff --git a/tests/mocha/field_checkbox_test.js b/tests/mocha/field_checkbox_test.js index 5e971cd0c..4f9503d9c 100644 --- a/tests/mocha/field_checkbox_test.js +++ b/tests/mocha/field_checkbox_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.fieldCheckbox'); - import * as Blockly from '../../build/src/core/blockly.js'; import { assertFieldValue, diff --git a/tests/mocha/field_colour_test.js b/tests/mocha/field_colour_test.js index 97aba7d95..fcc5041bd 100644 --- a/tests/mocha/field_colour_test.js +++ b/tests/mocha/field_colour_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.fieldColour'); - import * as Blockly from '../../build/src/core/blockly.js'; import { assertFieldValue, diff --git a/tests/mocha/field_dropdown_test.js b/tests/mocha/field_dropdown_test.js index 26820230e..616211287 100644 --- a/tests/mocha/field_dropdown_test.js +++ b/tests/mocha/field_dropdown_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.fieldDropdown'); - import * as Blockly from '../../build/src/core/blockly.js'; import { assertFieldValue, diff --git a/tests/mocha/field_image_test.js b/tests/mocha/field_image_test.js index 6911d8679..ec8ad2227 100644 --- a/tests/mocha/field_image_test.js +++ b/tests/mocha/field_image_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.fieldImage'); - import * as Blockly from '../../build/src/core/blockly.js'; import { assertFieldValue, diff --git a/tests/mocha/field_label_serializable_test.js b/tests/mocha/field_label_serializable_test.js index 61c6d72c7..37052f046 100644 --- a/tests/mocha/field_label_serializable_test.js +++ b/tests/mocha/field_label_serializable_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.fieldLabelSerialization'); - import * as Blockly from '../../build/src/core/blockly.js'; import { assertFieldValue, diff --git a/tests/mocha/field_label_test.js b/tests/mocha/field_label_test.js index a378334a2..368e7fd3c 100644 --- a/tests/mocha/field_label_test.js +++ b/tests/mocha/field_label_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.fieldLabel'); - import * as Blockly from '../../build/src/core/blockly.js'; import { assertFieldValue, diff --git a/tests/mocha/field_multilineinput_test.js b/tests/mocha/field_multilineinput_test.js index de2a8189f..abdf68237 100644 --- a/tests/mocha/field_multilineinput_test.js +++ b/tests/mocha/field_multilineinput_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.fieldMultiline'); - import * as Blockly from '../../build/src/core/blockly.js'; import { assertFieldValue, diff --git a/tests/mocha/field_number_test.js b/tests/mocha/field_number_test.js index 3b03a5135..4dcc930da 100644 --- a/tests/mocha/field_number_test.js +++ b/tests/mocha/field_number_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.fieldNumber'); - import * as Blockly from '../../build/src/core/blockly.js'; import { assertFieldValue, diff --git a/tests/mocha/field_registry_test.js b/tests/mocha/field_registry_test.js index 41c320c57..f8e4bb9b4 100644 --- a/tests/mocha/field_registry_test.js +++ b/tests/mocha/field_registry_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.fieldRegistry'); - import * as Blockly from '../../build/src/core/blockly.js'; import {createDeprecationWarningStub} from './test_helpers/warnings.js'; import { diff --git a/tests/mocha/field_test.js b/tests/mocha/field_test.js index c8e73e29d..7265a1bb4 100644 --- a/tests/mocha/field_test.js +++ b/tests/mocha/field_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.fieldTest'); - import * as Blockly from '../../build/src/core/blockly.js'; import { addBlockTypeToCleanup, diff --git a/tests/mocha/field_textinput_test.js b/tests/mocha/field_textinput_test.js index 27d950789..5a8a82479 100644 --- a/tests/mocha/field_textinput_test.js +++ b/tests/mocha/field_textinput_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.fieldTextInput'); - import * as Blockly from '../../build/src/core/blockly.js'; import { assertFieldValue, diff --git a/tests/mocha/field_variable_test.js b/tests/mocha/field_variable_test.js index 011c44dbc..0815303c6 100644 --- a/tests/mocha/field_variable_test.js +++ b/tests/mocha/field_variable_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.fieldVariable'); - import * as Blockly from '../../build/src/core/blockly.js'; import { assertFieldValue, diff --git a/tests/mocha/flyout_test.js b/tests/mocha/flyout_test.js index 3c38d2552..f2fe79e38 100644 --- a/tests/mocha/flyout_test.js +++ b/tests/mocha/flyout_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.flyout'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/generator_test.js b/tests/mocha/generator_test.js index 7d1415874..eea386432 100644 --- a/tests/mocha/generator_test.js +++ b/tests/mocha/generator_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.generator'); - import * as Blockly from '../../build/src/core/blockly.js'; import {DartGenerator} from '../../build/src/generators/dart/dart_generator.js'; import {JavascriptGenerator} from '../../build/src/generators/javascript/javascript_generator.js'; diff --git a/tests/mocha/gesture_test.js b/tests/mocha/gesture_test.js index 01885427b..0572fed5b 100644 --- a/tests/mocha/gesture_test.js +++ b/tests/mocha/gesture_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.gesture'); - import {assertEventFired, assertEventNotFired} from './test_helpers/events.js'; import {defineBasicBlockWithField} from './test_helpers/block_definitions.js'; import {dispatchPointerEvent} from './test_helpers/user_input.js'; diff --git a/tests/mocha/icon_test.js b/tests/mocha/icon_test.js index 4c3d20492..4ff27997f 100644 --- a/tests/mocha/icon_test.js +++ b/tests/mocha/icon_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.icon'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/index.html b/tests/mocha/index.html index de11f6a94..f94eabfa1 100644 --- a/tests/mocha/index.html +++ b/tests/mocha/index.html @@ -29,106 +29,123 @@ ui: 'tdd', failZero: true, }); - - var BLOCKLY_BOOTSTRAP_OPTIONS = { - loadCompressed: false, - depsFiles: ['build/deps.js', 'build/deps.mocha.js'], - requires: [ - // Test modules. - 'Blockly.test.astNode', - 'Blockly.test.blockJson', - 'Blockly.test.blocks', - 'Blockly.test.clipboard', - 'Blockly.test.comments', - 'Blockly.test.commentDeserialization', - 'Blockly.test.connectionChecker', - 'Blockly.test.connectionDb', - 'Blockly.test.connection', - 'Blockly.test.contextMenuItem', - 'Blockly.test.cursor', - 'Blockly.test.dropdown', - 'Blockly.test.event', - 'Blockly.test.eventBlockChange', - 'Blockly.test.eventBlockCreate', - 'Blockly.test.eventBlockDelete', - 'Blockly.test.eventBlockDrag', - 'Blockly.test.eventBlockFieldIntermediateChange', - 'Blockly.test.eventBlockMove', - 'Blockly.test.eventBubbleOpen', - 'Blockly.test.eventClick', - 'Blockly.test.eventCommentChange', - 'Blockly.test.eventCommentCreate', - 'Blockly.test.eventCommentDelete', - 'Blockly.test.eventCommentMove', - 'Blockly.test.eventMarkerMove', - 'Blockly.test.eventSelected', - 'Blockly.test.eventThemeChange', - 'Blockly.test.eventToolboxItemSelect', - 'Blockly.test.eventTrashcanOpen', - 'Blockly.test.eventVarCreate', - 'Blockly.test.eventVarDelete', - 'Blockly.test.eventVarRename', - 'Blockly.test.eventViewportChange', - 'Blockly.test.extensions', - 'Blockly.test.fieldAngle', - 'Blockly.test.fieldCheckbox', - 'Blockly.test.fieldColour', - 'Blockly.test.fieldDropdown', - 'Blockly.test.fieldImage', - 'Blockly.test.fieldLabelSerialization', - 'Blockly.test.fieldLabel', - 'Blockly.test.fieldMultiline', - 'Blockly.test.fieldNumber', - 'Blockly.test.fieldRegistry', - 'Blockly.test.fieldTest', - 'Blockly.test.fieldTextInput', - 'Blockly.test.fieldVariable', - 'Blockly.test.flyout', - 'Blockly.test.generator', - 'Blockly.test.gesture', - 'Blockly.test.icon', - 'Blockly.test.input', - 'Blockly.test.insertionMarker', - 'Blockly.test.insertionMarkerManager', - 'Blockly.test.jsoDeserialization', - 'Blockly.test.jsoSerialization', - 'Blockly.test.json', - 'Blockly.test.keydown', - 'Blockly.test.lists', - 'Blockly.test.logicTernary', - 'Blockly.test.metrics', - 'Blockly.test.mutator', - 'Blockly.test.names', - 'Blockly.test.procedureMap', - 'Blockly.test.procedures', - 'Blockly.test.registry', - 'Blockly.test.renderManagement', - 'Blockly.test.serialization', - 'Blockly.test.shortcutRegistry', - 'Blockly.test.touch', - 'Blockly.test.theme', - 'Blockly.test.toolbox', - 'Blockly.test.tooltip', - 'Blockly.test.trashcan', - 'Blockly.test.utils', - 'Blockly.test.variableMap', - 'Blockly.test.variableModel', - 'Blockly.test.variables', - 'Blockly.test.widgetDiv', - 'Blockly.test.workspaceComment', - 'Blockly.test.workspaceSvg', - 'Blockly.test.workspace', - 'Blockly.test.xml', - 'Blockly.test.zoomControls', - ], - scripts: [ - 'build/msg/en.js', - 'tests/playgrounds/screenshot.js', - 'node_modules/@blockly/dev-tools/dist/index.js', - ], - }; - + +
@@ -202,21 +219,5 @@ style="display: none"> - - diff --git a/tests/mocha/input_test.js b/tests/mocha/input_test.js index 0d7abe6bd..c4ecd7a39 100644 --- a/tests/mocha/input_test.js +++ b/tests/mocha/input_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.input'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/insertion_marker_manager_test.js b/tests/mocha/insertion_marker_manager_test.js index 1eeb8cac8..26996fa95 100644 --- a/tests/mocha/insertion_marker_manager_test.js +++ b/tests/mocha/insertion_marker_manager_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.insertionMarkerManager'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/insertion_marker_test.js b/tests/mocha/insertion_marker_test.js index b63452fae..c0b870845 100644 --- a/tests/mocha/insertion_marker_test.js +++ b/tests/mocha/insertion_marker_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.insertionMarker'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/jso_deserialization_test.js b/tests/mocha/jso_deserialization_test.js index cadcc1374..fa6590cb7 100644 --- a/tests/mocha/jso_deserialization_test.js +++ b/tests/mocha/jso_deserialization_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.jsoDeserialization'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/jso_serialization_test.js b/tests/mocha/jso_serialization_test.js index b8b28b170..500bb2011 100644 --- a/tests/mocha/jso_serialization_test.js +++ b/tests/mocha/jso_serialization_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.jsoSerialization'); - import * as Blockly from '../../build/src/core/blockly.js'; import { createGenUidStubWithReturns, diff --git a/tests/mocha/json_test.js b/tests/mocha/json_test.js index d8a139eed..b5896e5fa 100644 --- a/tests/mocha/json_test.js +++ b/tests/mocha/json_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.json'); - import { addMessageToCleanup, sharedTestSetup, diff --git a/tests/mocha/keydown_test.js b/tests/mocha/keydown_test.js index f0f94310d..0483d72c1 100644 --- a/tests/mocha/keydown_test.js +++ b/tests/mocha/keydown_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.keydown'); - import * as Blockly from '../../build/src/core/blockly.js'; import {createKeyDownEvent} from './test_helpers/user_input.js'; import {defineStackBlock} from './test_helpers/block_definitions.js'; diff --git a/tests/mocha/metrics_test.js b/tests/mocha/metrics_test.js index 7c551435f..83fa605c6 100644 --- a/tests/mocha/metrics_test.js +++ b/tests/mocha/metrics_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.metrics'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/mutator_test.js b/tests/mocha/mutator_test.js index 9a1c61698..609dc03a2 100644 --- a/tests/mocha/mutator_test.js +++ b/tests/mocha/mutator_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.mutator'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/names_test.js b/tests/mocha/names_test.js index 093e4e132..6cb4213df 100644 --- a/tests/mocha/names_test.js +++ b/tests/mocha/names_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.names'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/procedure_map_test.js b/tests/mocha/procedure_map_test.js index 2c739cc06..67d62b6ee 100644 --- a/tests/mocha/procedure_map_test.js +++ b/tests/mocha/procedure_map_test.js @@ -15,8 +15,6 @@ import { } from './test_helpers/events.js'; import {MockProcedureModel} from './test_helpers/procedures.js'; -goog.declareModuleId('Blockly.test.procedureMap'); - suite('Procedure Map', function () { setup(function () { sharedTestSetup.call(this); diff --git a/tests/mocha/registry_test.js b/tests/mocha/registry_test.js index ca7d3fca6..fd37c6e69 100644 --- a/tests/mocha/registry_test.js +++ b/tests/mocha/registry_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.registry'); - import {assertWarnings} from './test_helpers/warnings.js'; import { sharedTestSetup, diff --git a/tests/mocha/render_management_test.js b/tests/mocha/render_management_test.js index 1b880ec2c..240a9dd15 100644 --- a/tests/mocha/render_management_test.js +++ b/tests/mocha/render_management_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.renderManagement'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/serializer_test.js b/tests/mocha/serializer_test.js index 10cf210ba..bd9a47344 100644 --- a/tests/mocha/serializer_test.js +++ b/tests/mocha/serializer_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.serialization'); - import * as Blockly from '../../build/src/core/blockly.js'; import { TestCase, diff --git a/tests/mocha/shortcut_registry_test.js b/tests/mocha/shortcut_registry_test.js index 5c1cd7dcd..0f48bc2ab 100644 --- a/tests/mocha/shortcut_registry_test.js +++ b/tests/mocha/shortcut_registry_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.shortcutRegistry'); - import {createKeyDownEvent} from './test_helpers/user_input.js'; import { sharedTestSetup, diff --git a/tests/mocha/test_helpers/block_definitions.js b/tests/mocha/test_helpers/block_definitions.js index f7e3d4cad..26507b29c 100644 --- a/tests/mocha/test_helpers/block_definitions.js +++ b/tests/mocha/test_helpers/block_definitions.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.helpers.blockDefinitions'); - export function defineEmptyBlock(name = 'empty_block') { Blockly.defineBlocksWithJsonArray([ { diff --git a/tests/mocha/test_helpers/code_generation.js b/tests/mocha/test_helpers/code_generation.js index 072964a07..b65fb1e78 100644 --- a/tests/mocha/test_helpers/code_generation.js +++ b/tests/mocha/test_helpers/code_generation.js @@ -5,8 +5,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.helpers.codeGeneration'); - import {runTestSuites} from './common.js'; /** diff --git a/tests/mocha/test_helpers/common.js b/tests/mocha/test_helpers/common.js index c8dd325d6..3d79576dc 100644 --- a/tests/mocha/test_helpers/common.js +++ b/tests/mocha/test_helpers/common.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.helpers.common'); - /** * Test case configuration. * @record diff --git a/tests/mocha/test_helpers/events.js b/tests/mocha/test_helpers/events.js index ff0b5fb3c..5998ed94e 100644 --- a/tests/mocha/test_helpers/events.js +++ b/tests/mocha/test_helpers/events.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.helpers.events'); - /** * Creates spy for workspace fireChangeListener * @param {!Blockly.Workspace} workspace The workspace to spy fireChangeListener diff --git a/tests/mocha/test_helpers/fields.js b/tests/mocha/test_helpers/fields.js index 468a29bda..11b6e98ef 100644 --- a/tests/mocha/test_helpers/fields.js +++ b/tests/mocha/test_helpers/fields.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.helpers.fields'); - import {runTestCases, TestCase} from './common.js'; /** diff --git a/tests/mocha/test_helpers/procedures.js b/tests/mocha/test_helpers/procedures.js index 73f220eeb..e4ddc0e3f 100644 --- a/tests/mocha/test_helpers/procedures.js +++ b/tests/mocha/test_helpers/procedures.js @@ -3,7 +3,6 @@ * Copyright 2020 Google LLC * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.helpers.procedures'); import {ConnectionType} from '../../../build/src/core/connection_type.js'; import {VariableModel} from '../../../build/src/core/variable_model.js'; diff --git a/tests/mocha/test_helpers/serialization.js b/tests/mocha/test_helpers/serialization.js index 766992ab8..6b3be7ae2 100644 --- a/tests/mocha/test_helpers/serialization.js +++ b/tests/mocha/test_helpers/serialization.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.helpers.serialization'); - import {runTestCases} from './common.js'; /** @@ -112,25 +110,7 @@ export const runSerializationTestSuite = (testCases) => { }); suite('xml round-trip', function () { setup(function () { - // The genUid is undergoing change as part of the 2021Q3 - // goog.module migration: - // - // - It is being moved from Blockly.utils to - // Blockly.utils.idGenerator (which itself is being renamed - // from IdGenerator). - // - For compatibility with changes to the module system (from - // goog.provide to goog.module and in future to ES modules), - // .genUid is now a wrapper around .TEST_ONLY.genUid, which - // can be safely stubbed by sinon or other similar - // frameworks in a way that will continue to work. - if (Blockly.utils.idGenerator && Blockly.utils.idGenerator.TEST_ONLY) { - sinon - .stub(Blockly.utils.idGenerator.TEST_ONLY, 'genUid') - .returns('1'); - } else { - // Fall back to stubbing original version on Blockly.utils. - sinon.stub(Blockly.utils, 'genUid').returns('1'); - } + sinon.stub(Blockly.utils.idGenerator.TEST_ONLY, 'genUid').returns('1'); }); teardown(function () { diff --git a/tests/mocha/test_helpers/setup_teardown.js b/tests/mocha/test_helpers/setup_teardown.js index dc2dfaa09..2fc08cb69 100644 --- a/tests/mocha/test_helpers/setup_teardown.js +++ b/tests/mocha/test_helpers/setup_teardown.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.helpers.setupTeardown'); - import * as eventUtils from '../../../build/src/core/events/utils.js'; /** diff --git a/tests/mocha/test_helpers/toolbox_definitions.js b/tests/mocha/test_helpers/toolbox_definitions.js index 1a163831b..2f767ed60 100644 --- a/tests/mocha/test_helpers/toolbox_definitions.js +++ b/tests/mocha/test_helpers/toolbox_definitions.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.helpers.toolboxDefinitions'); - /** * Get JSON for a toolbox that contains categories. * @return {Blockly.utils.toolbox.ToolboxJson} The array holding information diff --git a/tests/mocha/test_helpers/user_input.js b/tests/mocha/test_helpers/user_input.js index 1405f25a2..6606a6652 100644 --- a/tests/mocha/test_helpers/user_input.js +++ b/tests/mocha/test_helpers/user_input.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.helpers.userInput'); - import {KeyCodes} from '../../../build/src/core/utils/keycodes.js'; /** diff --git a/tests/mocha/test_helpers/variables.js b/tests/mocha/test_helpers/variables.js index d1bc5eaa3..0890d58a8 100644 --- a/tests/mocha/test_helpers/variables.js +++ b/tests/mocha/test_helpers/variables.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.helpers.variables'); - /** * Check if a variable with the given values exists. * @param {Blockly.Workspace|Blockly.VariableMap} container The workspace or diff --git a/tests/mocha/test_helpers/warnings.js b/tests/mocha/test_helpers/warnings.js index e82486864..d7752e90c 100644 --- a/tests/mocha/test_helpers/warnings.js +++ b/tests/mocha/test_helpers/warnings.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.helpers.warnings'); - /** * Captures the strings sent to console.warn() when calling a function. * Copies from core. diff --git a/tests/mocha/test_helpers/workspace.js b/tests/mocha/test_helpers/workspace.js index bce02ee34..7654feba2 100644 --- a/tests/mocha/test_helpers/workspace.js +++ b/tests/mocha/test_helpers/workspace.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.helpers.workspace'); - import {assertVariableValues} from './variables.js'; import {assertWarnings} from './warnings.js'; import * as eventUtils from '../../../build/src/core/events/utils.js'; diff --git a/tests/mocha/theme_test.js b/tests/mocha/theme_test.js index b63c6f99f..bd9091a37 100644 --- a/tests/mocha/theme_test.js +++ b/tests/mocha/theme_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.theme'); - import {assertEventFired} from './test_helpers/events.js'; import * as eventUtils from '../../build/src/core/events/utils.js'; import { diff --git a/tests/mocha/toolbox_test.js b/tests/mocha/toolbox_test.js index 1f76e4cdf..01670a298 100644 --- a/tests/mocha/toolbox_test.js +++ b/tests/mocha/toolbox_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.toolbox'); - import {defineStackBlock} from './test_helpers/block_definitions.js'; import { sharedTestSetup, diff --git a/tests/mocha/tooltip_test.js b/tests/mocha/tooltip_test.js index d3b59acc7..9488697ab 100644 --- a/tests/mocha/tooltip_test.js +++ b/tests/mocha/tooltip_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.tooltip'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/touch_test.js b/tests/mocha/touch_test.js index 4b45d8a5f..94894b4eb 100644 --- a/tests/mocha/touch_test.js +++ b/tests/mocha/touch_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.touch'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/trashcan_test.js b/tests/mocha/trashcan_test.js index 3faee3793..fd622c26e 100644 --- a/tests/mocha/trashcan_test.js +++ b/tests/mocha/trashcan_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.trashcan'); - import {assertEventFired, assertEventNotFired} from './test_helpers/events.js'; import { sharedTestSetup, diff --git a/tests/mocha/utils_test.js b/tests/mocha/utils_test.js index 0d2b96a60..e87936585 100644 --- a/tests/mocha/utils_test.js +++ b/tests/mocha/utils_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.utils'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/variable_map_test.js b/tests/mocha/variable_map_test.js index 21e9af8fe..bb93c92d6 100644 --- a/tests/mocha/variable_map_test.js +++ b/tests/mocha/variable_map_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.variableMap'); - import {assertVariableValues} from './test_helpers/variables.js'; import { createGenUidStubWithReturns, diff --git a/tests/mocha/variable_model_test.js b/tests/mocha/variable_model_test.js index d328c388c..9888d6121 100644 --- a/tests/mocha/variable_model_test.js +++ b/tests/mocha/variable_model_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.variableModel'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/widget_div_test.js b/tests/mocha/widget_div_test.js index 354696ea6..5415347ad 100644 --- a/tests/mocha/widget_div_test.js +++ b/tests/mocha/widget_div_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.widgetDiv'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/workspace_comment_test.js b/tests/mocha/workspace_comment_test.js index e8a336052..a1b0e38b5 100644 --- a/tests/mocha/workspace_comment_test.js +++ b/tests/mocha/workspace_comment_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.workspaceComment'); - import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/workspace_svg_test.js b/tests/mocha/workspace_svg_test.js index 9fe076904..cea58cdf9 100644 --- a/tests/mocha/workspace_svg_test.js +++ b/tests/mocha/workspace_svg_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.workspaceSvg'); - import { assertEventFired, assertEventNotFired, diff --git a/tests/mocha/workspace_test.js b/tests/mocha/workspace_test.js index 90d27242e..58829a77a 100644 --- a/tests/mocha/workspace_test.js +++ b/tests/mocha/workspace_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.workspace'); - import {assertVariableValues} from './test_helpers/variables.js'; import { sharedTestSetup, diff --git a/tests/mocha/xml_test.js b/tests/mocha/xml_test.js index 8fecbcf69..385b0f736 100644 --- a/tests/mocha/xml_test.js +++ b/tests/mocha/xml_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.xml'); - import { addBlockTypeToCleanup, createGenUidStubWithReturns, diff --git a/tests/mocha/zoom_controls_test.js b/tests/mocha/zoom_controls_test.js index ce66d3f99..5129c16c5 100644 --- a/tests/mocha/zoom_controls_test.js +++ b/tests/mocha/zoom_controls_test.js @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.declareModuleId('Blockly.test.zoomControls'); - import {assertEventFired, assertEventNotFired} from './test_helpers/events.js'; import * as eventUtils from '../../build/src/core/events/utils.js'; import {