From e11b5834e5e4e8fe991be32afb08eafa7c8adffd Mon Sep 17 00:00:00 2001 From: Christopher Allen Date: Tue, 8 Mar 2022 23:20:19 +0000 Subject: [PATCH] fix(tests): Enable `--debug` for `test:compile:advanced`; fix some errors (and demote the rest to warnings) (#5983) * refactor(tests): Migrate tests/compile/main.js to goog.module * feat(tests): Enable --debug for test:compile:advanced; demote errors * Enable the --debug flag when running the buildAdvancedCompilationTest gulp task. * Remove partialAlias diagnostic group from `JSC_ERROR`, demoting JSC_PARTIAL_NAMESPACE to warning. Reverts "Revert 'fix(tests): Enable --debug for test:compile:advanced; fix some errors (#5959)'". --- package.json | 2 +- scripts/gulpfiles/build_tasks.js | 2 +- tests/compile/main.js | 30 ++++++++++++++++++++++-------- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 88cc6c0efa3..149e38a61bf 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "test": "tests/run_all_tests.sh", "test:generators": "tests/scripts/run_generators.sh", "test:mocha:interactive": "http-server ./ -o /tests/mocha/index.html -c-1", - "test:compile:advanced": "gulp buildAdvancedCompilationTest", + "test:compile:advanced": "gulp buildAdvancedCompilationTest --debug", "typings": "gulp typings", "updateGithubPages": "gulp gitUpdateGithubPages" }, diff --git a/scripts/gulpfiles/build_tasks.js b/scripts/gulpfiles/build_tasks.js index b95cb7c5289..b0dd9af2b8a 100644 --- a/scripts/gulpfiles/build_tasks.js +++ b/scripts/gulpfiles/build_tasks.js @@ -209,7 +209,7 @@ var JSCOMP_ERROR = [ 'moduleLoad', 'msgDescriptions', 'nonStandardJsDocs', - 'partialAlias', + // 'partialAlias', // Don't want this to be an error yet; only warning. // 'polymer', // Not applicable. // 'reportUnknownTypes', // VERY verbose. // 'strictCheckTypes', // Use --strict to enable. diff --git a/tests/compile/main.js b/tests/compile/main.js index 586f4ce3648..b5d20a770cd 100644 --- a/tests/compile/main.js +++ b/tests/compile/main.js @@ -4,19 +4,33 @@ * SPDX-License-Identifier: Apache-2.0 */ -goog.provide('Main'); +goog.module('Main'); + // Core // Either require 'Blockly.requires', or just the components you use: -goog.require('Blockly'); +/* eslint-disable-next-line no-unused-vars */ +const {BlocklyOptions} = goog.requireType('Blockly.BlocklyOptions'); +const {inject} = goog.require('Blockly.inject'); +/** @suppress {extraRequire} */ goog.require('Blockly.geras.Renderer'); +/** @suppress {extraRequire} */ goog.require('Blockly.VerticalFlyout'); // Blocks -goog.require('Blockly.libraryBlocks'); +/** @suppress {extraRequire} */ +goog.require('Blockly.libraryBlocks.logic'); +/** @suppress {extraRequire} */ +goog.require('Blockly.libraryBlocks.loops'); +/** @suppress {extraRequire} */ +goog.require('Blockly.libraryBlocks.math'); +/** @suppress {extraRequire} */ +goog.require('Blockly.libraryBlocks.texts'); +/** @suppress {extraRequire} */ goog.require('Blockly.libraryBlocks.testBlocks'); -Main.init = function() { - Blockly.inject('blocklyDiv', { - 'toolbox': document.getElementById('toolbox') - }); + +function init() { + inject('blocklyDiv', /** @type {BlocklyOptions} */ ({ + 'toolbox': document.getElementById('toolbox') + })); }; -window.addEventListener('load', Main.init); +window.addEventListener('load', init);