mirror of
https://github.com/google/blockly.git
synced 2026-01-09 01:50:11 +01:00
* feat(build): Make build tasks invoke their prerequisites
- Divide gulp targets into three kinds: main sequence,
manually invokable, and script-only. The first two categories
automatically invoke their prerequisites.
- Give (most of) the affected gulp targets shorter and more memorable
names that could become their npm script names in future.
* feat(build): Make package tasks invoke their prerequisites
Have the package task invoke the cleanBuildDir (as well as
cleanPackageDir) and build tasks. Remove the checkBuildDir
task as it is now redundant since a fresh build is done every
time.
* feat(build): Make git tasks invoke their prerequisites
* feat(build): Make cleanup, license [sic] tasks invoke their prerequisites
Turns out they don't have any, so this commit just classifies
their gulp targets according to the established scheme.
* feat(build): Make appengine tasks invoke their prerequisites
In this case prepareDeployDir will eventually depend on package
but does not for now.
* feat(build): Have npm scripts run npm ci first where applicable
Have any npm script that have external effects (e.g. publishing an
npm package, pushing a new version to appengine, or updating GitHub
Pages) start by running npm ci to ensure that all dependencies are
up-to-date with respect to package-lock.json.
(This is done by npm and not a gulp script because gulp itself
might need updating. So might npm, but that is less likely to
make any difference to what gets published/pushed.)
* chore(build): have tests use package target
Have the tests just run the package target (with debug flags)
since that runs the the build target automatically.
* feat(tests): Write Closure Compiler output directly to dist/
Since they are already UMD-wrapped, have Closure Compiler write
output chunks directly to RELEASE_DIR, i.e. dist/.
* chore(tests): Use freshly-build files in compressed mode.
Use the freshly-built build/*_compresssed.js files when bootstrapping
in compressed mode, rather than using the checked-in files in the
repository root.
This helps ensure that compressed and uncompressed mode will be
testing (as closely as possible) the same code.
Obsoletes #6218 (though the issues discussed there have not actually
yet been addressed in this branch).
* chore(build): Write intermediate langfiles to build/msg
Write the results of create_messages.py to build/msg instead of
build/msg/js.
* fix(build): Use build/msg/en.js instead of msg/messages.js in tests
This has no direct effect but fixes a long-standing misdesign
where we are testing against the input to, rather than the output
of, the language file processing pipeline.
* feat(demos): Use freshly-built files
Use the freshly-built dist/*_compresssed.js and build/msg/* files
rather than using the checked-in files in the repository root.
This helps ensure that these demos are using the most recent
version of Blockly (even in the develop branch).
* fix(build): Update appengine deployment to include built files
Modify the prepareDemos task as follows:
- Use the git index instead of HEAD, so that most local changes
will be applied (without copying whatever .gitignored cruft
might be in the local directory).
- Run clean and build and then copy build/msg and
dist/*_compressed.js* to the deploy directory.
This fixes the problem created by the previous commit, wherein the
demos relied on built files that were not being deployed to
appengine.
* fix(build): Update GitHub Pages deployment to include built files
Modify the updateGithubPages task to run clean and build and
then git add build/msg dist/*_compressed.js*, so that they will
be included in the deployed pages.
This fixes the problem created by the previous^2 commit,
wherein the demos relied on built files that were not being
deployed to GitHub Pages.
* chore(build): Remove build products from repository
Remove *_compressed.js* and msg/js/* from the blockly repository.
Also remove the now-obsolete checkinBuilt gulp task.
* chore(build): Apply relevant changes to test_tasks.js
Apply changes made to run_all_tests.sh and check_metadata.sh to
the corresponding parts of their JS replacements in
test_tasks.js.
* chore(build): Make updates suggested in PR #6475
- Remove `clean:builddir` and `clean:releasedir` - `clean`
is sufficient.
- Remove duplicate `require` from `appengine_tasks.js`.
* feat(build): Use shorter npm script names
Since scripts that run build tasks now automatically run their
prerequisite tasks, the previous naming scheme of task `build`
running all the `build:subtask`s no longe really makes very
much sense.
Additionally, following a chat discussion, there seems to be a
rough consensus to use "messages" to refer to the .json input
files, and "langfiles" to the generated .js output files.
Consequently, simplify npm script names by renaming as follows:
- "generate:langfiles" -> "messages"
- "build:langfiles" -> "langfiles"
- "build:js" -> "tsc"
- "build:deps" -> "deps"
- "build:compiled" -> "minify"
- "build:compressed": delete this synonym for "build:compiled",
("minify" was chosen as agnostic to Closure Compiler vs. WebPack.)
* chores(build): Add deprecation notice for old scripts
To reduce potential confusion/frustration, restore the previous
npm scripts but have them display a deprecation notice instead
(note that npm prints the script contents before running it, so
echo is not needed).
* docs(build): Add comments distinguishing 'messages' from 'langfiles'
201 lines
6.8 KiB
HTML
201 lines
6.8 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Mocha Tests for Blockly</title>
|
|
|
|
<link href="../../node_modules/mocha/mocha.css" rel="stylesheet" />
|
|
</head>
|
|
<style>
|
|
#blocklyDiv {
|
|
height: 1000px;
|
|
position: fixed;
|
|
visibility: hidden;
|
|
width: 1000px;
|
|
}
|
|
</style>
|
|
<body>
|
|
<div id="mocha"></div>
|
|
<div id="failureCount" style="display:none" tests_failed="unset"></div>
|
|
<div id="failureMessages" style="display:none"></div>
|
|
<!-- Load mocha et al. before bootstrapping so that we can safely
|
|
goog.require() the test modules that make calls to (e.g.)
|
|
suite() at the top level. -->
|
|
<script src="../../node_modules/chai/chai.js"></script>
|
|
<script src="../../node_modules/mocha/mocha.js"></script>
|
|
<script src="../../node_modules/sinon/pkg/sinon.js"></script>
|
|
<script>
|
|
mocha.setup({
|
|
ui: 'tdd',
|
|
failZero: true,
|
|
});
|
|
|
|
var BLOCKLY_BOOTSTRAP_OPTIONS = {
|
|
loadCompressed: false,
|
|
depsFiles: ['build/deps.js', 'build/deps.mocha.js'],
|
|
requires: [
|
|
// Blockly modules needed by tests.
|
|
'Blockly',
|
|
'Blockly.libraryBlocks',
|
|
'Blockly.Dart',
|
|
'Blockly.Dart.texts',
|
|
'Blockly.JavaScript',
|
|
'Blockly.JavaScript.texts',
|
|
'Blockly.Lua',
|
|
'Blockly.Lua.texts',
|
|
'Blockly.PHP',
|
|
'Blockly.PHP.texts',
|
|
'Blockly.Python',
|
|
'Blockly.Python.texts',
|
|
|
|
// Test modules.
|
|
'Blockly.test.astNode',
|
|
'Blockly.test.blockChangeEvent',
|
|
'Blockly.test.blockDeleteEvent',
|
|
'Blockly.test.blockCreateEvent',
|
|
'Blockly.test.blockJson',
|
|
'Blockly.test.blocks',
|
|
'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.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.input',
|
|
'Blockly.test.insertionMarker',
|
|
'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.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',
|
|
],
|
|
additionalScripts: [
|
|
'build/msg/en.js',
|
|
'tests/playgrounds/screenshot.js',
|
|
'node_modules/@blockly/dev-tools/dist/index.js',
|
|
],
|
|
}
|
|
</script>
|
|
<script src="../bootstrap.js"></script>
|
|
|
|
<div id="blocklyDiv"></div>
|
|
|
|
<xml xmlns="https://developers.google.com/blockly/xml" id="toolbox-simple" style="display: none">
|
|
<block type="logic_compare">
|
|
<field name="OP">NEQ</field>
|
|
<value name="A">
|
|
<shadow type="math_number">
|
|
<field name="NUM">1</field>
|
|
</shadow>
|
|
</value>
|
|
<value name="B">
|
|
<block type="math_number">
|
|
<field name="NUM">2</field>
|
|
</block>
|
|
</value>
|
|
</block>
|
|
<sep gap="20"></sep>
|
|
<button text="insert" callbackkey="insertConnectionRows"></button>
|
|
<label text="tooltips"></label>
|
|
</xml>
|
|
|
|
<xml xmlns="https://developers.google.com/blockly/xml" id="toolbox-categories" style="display: none">
|
|
<category name="First" css-container="something">
|
|
<block type="basic_block">
|
|
<field name="TEXT">FirstCategory-FirstBlock</field>
|
|
</block>
|
|
<block type="basic_block">
|
|
<field name="TEXT">FirstCategory-SecondBlock</field>
|
|
</block>
|
|
</category>
|
|
<category name="Second">
|
|
<block type="basic_block">
|
|
<field name="TEXT">SecondCategory-FirstBlock</field>
|
|
</block>
|
|
</category>
|
|
</xml>
|
|
|
|
<xml xmlns="https://developers.google.com/blockly/xml" id="toolbox-test" style="display: none">
|
|
<category name="First" expanded="true" categorystyle="logic_category">
|
|
<sep gap="-1"></sep>
|
|
<button text="insert" callbackkey="insertConnectionRows"></button>
|
|
<block type="stack_block"></block>
|
|
<block type="stack_block"></block>
|
|
</category>
|
|
<category name="Second">
|
|
<block type="stack_block"></block>
|
|
</category>
|
|
<sep toolboxitemid="separator" gap="-1"></sep>
|
|
<category name="Variables" custom="VARIABLE"></category>
|
|
<category name="NestedCategory" >
|
|
<category toolboxitemid="nestedCategory" name="NestedItemOne"></category>
|
|
</category>
|
|
<category name="lastItem"></category>
|
|
</xml>
|
|
|
|
<xml xmlns="https://developers.google.com/blockly/xml" id="gesture-test-toolbox" style="display: none">
|
|
<block type="test_field_block"></block>
|
|
</xml>
|
|
|
|
<script type=module>
|
|
// Wait for Blockly to finish loading before running tests.
|
|
import '../bootstrap_done.mjs';
|
|
|
|
let runner = mocha.run(function(failures) {
|
|
var failureDiv = document.getElementById('failureCount');
|
|
failureDiv.setAttribute('tests_failed', failures);
|
|
});
|
|
runner.on('fail', function(test, err) {
|
|
const msg = document.createElement('p');
|
|
msg.textContent = `"${test.fullTitle()}" failed: ${err.message}`;
|
|
const div = document.getElementById('failureMessages');
|
|
div.appendChild(msg);
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|