mirror of
https://github.com/google/blockly.git
synced 2025-12-16 06:10:12 +01:00
refactor(tests): Migrate generator tests to import shims; delete bootstrap.js (#7414)
* refactor(tests): Use shims instead of bootstrap to load Blockly
- Modify tests/generators/index.html to import the test shims
instead of using bootstrap.js to load Blockly.
- Modify test/generators/webdriver.js to have it wait for the
workspace to exist before calling loadSelected(). There was
previously a race which index.html had been winning, but
now webdriver.js is winning (and the tests failing because
there is no workspace yet when start() is called.
* chore(tests): Delete bootstrap.js etc.
- Delete bootstrap.js, bootstrap_helper.js, and bootstrap_done.mjs.
- Remove remaining references to bootstrap.js
* refactor(build): Remove deps npm script
buildDeps is now only needed by buildCompiled, not ever for
runnning in uncompressed mode, so:
- Remove the deps gulp task (and the deps npm script.
- Have the minify task run buildJavaScript and buildDeps directly.
Additionally, the buildAdvanceCompilationTest target hasn't
needed deps.js for some time (if ever), so skip having it run
buildDeps entirely.
* refactor(build): Repatriate DEPS_FILE to build_tasks.js
Since this is no longer used anywhere else it doesn't need to
live in common.js.
* fix(scripts): Remove vestigial references to deps.mocha.js
* docs(tests): Add additional explanatory note
This commit is contained in:
committed by
GitHub
parent
7e9d1eb3ba
commit
be809d9d98
@@ -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, TSC_OUTPUT_DIR, TYPINGS_BUILD_DIR} = require('./config');
|
||||
const {BUILD_DIR, RELEASE_DIR, TSC_OUTPUT_DIR, TYPINGS_BUILD_DIR} = require('./config');
|
||||
const {getPackageJson} = require('./helper_tasks');
|
||||
|
||||
const {posixPath, quote} = require('../helpers');
|
||||
@@ -43,6 +43,11 @@ const PYTHON = process.platform === 'win32' ? 'python' : 'python3';
|
||||
*/
|
||||
const COMPILED_SUFFIX = '_compressed';
|
||||
|
||||
/**
|
||||
* Dependencies file (used by buildCompiled for chunking.
|
||||
*/
|
||||
const DEPS_FILE = path.join(BUILD_DIR, 'deps.js');
|
||||
|
||||
/**
|
||||
* Name of an object to be used as a shared "global" namespace by
|
||||
* chunks generated by the Closure Compiler with the
|
||||
@@ -302,8 +307,9 @@ 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.
|
||||
* This task updates DEPS_FILE (deps.js), used by
|
||||
* closure-calculate-chunks when determining how to organise .js
|
||||
* source files into chunks.
|
||||
*
|
||||
* Prerequisite: buildJavaScript.
|
||||
*/
|
||||
@@ -354,7 +360,6 @@ error message above, try running:
|
||||
reject(error);
|
||||
} else {
|
||||
log(stderr);
|
||||
// Anything not about mocha goes in DEPS_FILE.
|
||||
fs.writeFileSync(DEPS_FILE, stdout);
|
||||
resolve();
|
||||
}
|
||||
@@ -710,7 +715,7 @@ ${Object.keys(exports).map((name) => ` ${name},`).join('\n')}
|
||||
* This task builds Blockly core, blocks and generators together and uses
|
||||
* Closure Compiler's ADVANCED_COMPILATION mode.
|
||||
*
|
||||
* Prerequisite: buildDeps.
|
||||
* Prerequisite: buildJavaScript.
|
||||
*/
|
||||
function buildAdvancedCompilationTest() {
|
||||
// If main_compressed.js exists (from a previous run) delete it so that
|
||||
@@ -761,14 +766,13 @@ function cleanBuildDir() {
|
||||
exports.cleanBuildDir = cleanBuildDir;
|
||||
exports.langfiles = buildLangfiles; // Build build/msg/*.js from msg/json/*.
|
||||
exports.tsc = buildJavaScript;
|
||||
exports.deps = gulp.series(exports.tsc, buildDeps);
|
||||
exports.minify = gulp.series(exports.deps, buildCompiled, buildShims);
|
||||
exports.minify = gulp.series(exports.tsc, buildDeps, buildCompiled, buildShims);
|
||||
exports.build = gulp.parallel(exports.minify, exports.langfiles);
|
||||
|
||||
// Manually-invokable targets, with prerequisites where required.
|
||||
exports.messages = generateMessages; // Generate msg/json/en.json et al.
|
||||
exports.buildAdvancedCompilationTest =
|
||||
gulp.series(exports.deps, buildAdvancedCompilationTest);
|
||||
gulp.series(exports.tsc, buildAdvancedCompilationTest);
|
||||
|
||||
// Targets intended only for invocation by scripts; may omit prerequisites.
|
||||
exports.onlyBuildAdvancedCompilationTest = buildAdvancedCompilationTest;
|
||||
|
||||
@@ -19,15 +19,10 @@ const path = require('path');
|
||||
// - tests/scripts/compile_typings.sh
|
||||
// - tests/scripts/check_metadata.sh
|
||||
// - tests/scripts/update_metadata.sh
|
||||
// - tests/bootstrap.js (for location of deps.js)
|
||||
// - tests/mocha/index.html (for location of deps.mocha.js)
|
||||
|
||||
// Directory to write compiled output to.
|
||||
exports.BUILD_DIR = 'build';
|
||||
|
||||
// Dependencies file (used by bootstrap.js in uncompiled mode):
|
||||
exports.DEPS_FILE = path.join(exports.BUILD_DIR, 'deps.js');
|
||||
|
||||
// Directory to write typings output to.
|
||||
exports.TYPINGS_BUILD_DIR = path.join(exports.BUILD_DIR, 'declarations');
|
||||
|
||||
|
||||
@@ -54,7 +54,6 @@ goog.addDependency = function(relPath, provides, _requires, opt_loadFlags) {
|
||||
|
||||
// Load deps files relative to this script's location.
|
||||
require(path.resolve(__dirname, '../../build/deps.js'));
|
||||
require(path.resolve(__dirname, '../../build/deps.mocha.js'));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Process files mentioned on the command line.
|
||||
|
||||
Reference in New Issue
Block a user