From 3d7262fed21fe08f5cb342dd9b6257acc109bbdc Mon Sep 17 00:00:00 2001 From: Christopher Allen Date: Fri, 3 Dec 2021 18:14:19 +0000 Subject: [PATCH] fix(tests): Fix & reenable the advanced compilation test (#5781) * fix(test): Fix advanced compilation test - Fix loading of blocks in `tests/compile/main.js` caused by recent `goog.module`-ification work. - Fix problem caused by ADVANCED_OPTIMISATIONS renaming the Msg property on the fake Blockly object created by the translation-loading hack in `blockly.js`. * chore(build): Reenable advanced compilation test Fixes #5602. --- core/blockly.js | 2 +- tests/compile/main.js | 12 ++---------- tests/compile/test_blocks.js | 2 +- tests/run_all_tests.sh | 4 ++-- 4 files changed, 6 insertions(+), 14 deletions(-) diff --git a/core/blockly.js b/core/blockly.js index 811279c57..9c344d7e0 100644 --- a/core/blockly.js +++ b/core/blockly.js @@ -742,7 +742,7 @@ exports.zelos = zelos; // Blockly.Msg module - so make sure it is, but only if there is not // yet a Blockly global variable. if (!('Blockly' in globalThis)) { - globalThis['Blockly'] = {Msg}; + globalThis['Blockly'] = {'Msg': Msg}; } // Temporary hack to copy accessor properties from exports to the diff --git a/tests/compile/main.js b/tests/compile/main.js index 58b5be016..f7ab99e7a 100644 --- a/tests/compile/main.js +++ b/tests/compile/main.js @@ -11,16 +11,8 @@ goog.require('Blockly'); goog.require('Blockly.geras.Renderer'); goog.require('Blockly.VerticalFlyout'); // Blocks -goog.require('Blockly.Constants.Logic'); -goog.require('Blockly.Constants.Loops'); -goog.require('Blockly.Constants.Math'); -goog.require('Blockly.Constants.TestBlocks'); -goog.require('Blockly.Constants.Text'); -goog.require('Blockly.Constants.Lists'); -goog.require('Blockly.Constants.Colour'); -goog.require('Blockly.Constants.Variables'); -goog.require('Blockly.Constants.VariablesDynamic'); -goog.require('Blockly.blocks.procedures'); +goog.require('Blockly.blocks.all'); +goog.require('Blockly.blocks.testBlocks'); Main.init = function() { Blockly.inject('blocklyDiv', { diff --git a/tests/compile/test_blocks.js b/tests/compile/test_blocks.js index 3be623f18..9cf7efd68 100644 --- a/tests/compile/test_blocks.js +++ b/tests/compile/test_blocks.js @@ -9,7 +9,7 @@ */ 'use strict'; -goog.provide('Blockly.Constants.TestBlocks'); +goog.provide('Blockly.blocks.testBlocks'); goog.require('Blockly'); diff --git a/tests/run_all_tests.sh b/tests/run_all_tests.sh index c754d60aa..71d5dfabd 100755 --- a/tests/run_all_tests.sh +++ b/tests/run_all_tests.sh @@ -76,8 +76,8 @@ run_test_command "package" "npm run package" # Run Node tests. run_test_command "node" "./node_modules/.bin/mocha tests/node --config tests/node/.mocharc.js" -# # Attempt advanced compilation of a Blockly app. -# run_test_command "advanced_compile" "npm run test:compile:advanced" +# Attempt advanced compilation of a Blockly app. +run_test_command "advanced_compile" "npm run test:compile:advanced" # End of tests.