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 | 229 +++++++++--------- 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, 122 insertions(+), 358 deletions(-) diff --git a/scripts/gulpfiles/build_tasks.js b/scripts/gulpfiles/build_tasks.js index d6cc38b7c66..0d751775002 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 674432ddef8..02a0499c46b 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 a9111926190..a9f0de0d33c 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 cd4337ef03f..e89c68e7c1d 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 7308ce6075d..2cf50fea02f 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 e4875225ac0..07510513b07 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 9a1e3be4849..2afa51f7aaf 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 5163e715d3e..6173179cd0c 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 75afa9d56a8..caee68aeca7 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 f6cf10a2551..f134b1d7795 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 c7398bbe0e0..494c584e787 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 fa3190d956f..6f19aa7f057 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 908adf8fb70..09797d6a772 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 7f3219fa2c9..9cf579f1b1d 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 0646458b8b6..afba4948cff 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 a9d1a500968..4596513c68c 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 c435a1e5ec0..c7b3a76afcc 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 a2e08e4d129..22066dda4e0 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 39823852741..4f4728cc32c 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 1469df4bbff..b17b277e79e 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 806ecad4b9e..1aa70c4d1ab 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 176666f6f7b..8a5399c8bde 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 6990eda19ba..e8a71effbdc 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 b647ee17355..2b4102de6a0 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 910030b9d49..54e48aa9cff 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 47ee96edf07..ec998b62de4 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 fd9827ac6c2..7c68d0858b1 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 31ebd2e9410..d140eff8526 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 ae9c016b698..fc4b7701fa3 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 d192053f00c..a0b0b5eabf3 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 df8fa544a07..26238dc43db 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 83a64a56619..3c69889f2b1 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 1fd7addb12a..e59cb4911a1 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 1e3fa2c884b..155e373a3f9 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 32b0857811d..82f8e4863b2 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 c85dbd3d1d0..84c2abd9c56 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 433d5d4ae5f..003cd11b5a2 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 2619a8db05c..7bad8eb7b73 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 8f9d63d88c3..0c8fb80cdad 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 275d6854bfc..7913e7bf507 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 f918b935cf3..8eb37e75df7 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 6ab13084289..62afd8d2761 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 5e971cd0cdf..4f9503d9c5b 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 97aba7d9595..fcc5041bdae 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 26820230ee4..6162112876c 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 6911d867924..ec8ad222712 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 61c6d72c720..37052f046cf 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 a378334a22d..368e7fd3cf7 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 de2a8189f37..abdf6823722 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 3b03a51351a..4dcc930da5f 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 41c320c574b..f8e4bb9b4cd 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 c8e73e29d89..7265a1bb4cd 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 27d95078931..5a8a8247978 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 011c44dbce5..0815303c655 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 3c38d2552b2..f2fe79e3851 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 7d14158749c..eea386432a9 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 01885427bbb..0572fed5b94 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 4c3d204928d..4ff27997fe8 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 de11f6a94f1..f94eabfa14e 100644 --- a/tests/mocha/index.html +++ b/tests/mocha/index.html @@ -29,106 +29,123 @@ ui: 'tdd', failZero: true, }); + + + -
@@ -202,21 +219,5 @@ style="display: none"> - - diff --git a/tests/mocha/input_test.js b/tests/mocha/input_test.js index 0d7abe6bd36..c4ecd7a3905 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 1eeb8cac8d3..26996fa95d0 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 b63452faee4..c0b8708451d 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 cadcc13742e..fa6590cb7dd 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 b8b28b170b7..500bb20113c 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 d8a139eedc3..b5896e5faf4 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 f0f94310d26..0483d72c13e 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 7c551435f10..83fa605c6fa 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 9a1c6169819..609dc03a28d 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 093e4e132f4..6cb4213df6b 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 2c739cc0602..67d62b6eeec 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 ca7d3fca6d6..fd37c6e6963 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 1b880ec2c27..240a9dd156e 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 10cf210ba66..bd9a4734417 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 5c1cd7dcdb2..0f48bc2abe8 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 f7e3d4cad78..26507b29cb8 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 072964a0739..b65fb1e78f4 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 c8dd325d62b..3d79576dc0c 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 ff0b5fb3c48..5998ed94eeb 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 468a29bda3e..11b6e98efea 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 73f220eeb1e..e4ddc0e3f1c 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 766992ab8b2..6b3be7ae2f1 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 dc2dfaa09ca..2fc08cb6943 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 1a163831beb..2f767ed60b7 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 1405f25a2ba..6606a665248 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 d1bc5eaa373..0890d58a8f5 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 e8248686404..d7752e90c2f 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 bce02ee34f8..7654feba29d 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 b63c6f99fbb..bd9091a37b5 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 1f76e4cdfc2..01670a298b1 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 d3b59acc703..9488697ab52 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 4b45d8a5ffd..94894b4eb01 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 3faee3793df..fd622c26e6e 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 0d2b96a6010..e87936585ae 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 21e9af8fe16..bb93c92d60d 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 d328c388c41..9888d61210c 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 354696ea6e3..5415347adef 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 e8a3360525a..a1b0e38b575 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 9fe07690486..cea58cdf920 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 90d27242e00..58829a77aae 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 8fecbcf692c..385b0f73665 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 ce66d3f994a..5129c16c5a1 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 {