Hello block builders,
We recently became aware of a bug in Blockly that has existed for some time but which only came to our attention due to an update to one of our dependencies.
If:
- you use the @blockly/dev-scripts package to test your Blockly project (which is particularly likely if you are developing a plugin), and
- your project has more than one test/*.mocha.js test script, and
- you have updated your project to use Blockly v9.2.0
then you may encounter a bug which manifests as the following error (or one very similar to it):
TypeError: Failed to execute 'serializeToString' on 'XMLSerializer': parameter 1 is not of type 'Node'.
at Object.exports.convert (webpack-internal:///./node_modules/jsdom/lib/jsdom/living/generated/Node.js:25:9)
at XMLSerializer.serializeToString (webpack-internal:///./node_modules/jsdom/lib/jsdom/living/generated/XMLSerializer.js:111:23)
at domToText$$module$build$src$core$utils$xml (webpack-internal:///./node_modules/blockly/blockly_compressed.js:74:333)
- using Blockly v9.2.0, and
- using it in node.js, where it uses the jsdom package to polyfill needed DOM XML functions, and
- loading multiple copies of the blockly/core package (or bockly, which depends on it)
The latter is normally impossible unless you have multiple copies of blockly in separate directories within your project, or you create multiple webpack bundles containing blockly+jsdom and then load them into the same node.js runtime (as dev-scripts does).
If you are using Blockly in a browser this bug will not affect you.
Apologies for any inconvenience,
Christopher Allen
P.S.: If you
do encounter this bug other than via
@blockly/dev-scripts we'd love to hear more about what you were doing that caused it to manifest. Please
add a comment to the issue to let us know!