diff --git a/tools/js/package.json b/tools/js/package.json index bb42651ed..cb176e01d 100644 --- a/tools/js/package.json +++ b/tools/js/package.json @@ -14,7 +14,7 @@ "ajv": "^6.5.4", "glob": "^10.2.6", "mocha": "^10.2.0", - "protodef-validator": "^1.2.2", + "protodef-validator": "^1.5.0", "standard": "^17.1.2" }, "devDependencies": { diff --git a/tools/js/test/test.js b/tools/js/test/test.js index d9a3a8bae..9b57ae421 100644 --- a/tools/js/test/test.js +++ b/tools/js/test/test.js @@ -11,6 +11,13 @@ const Validator = require('protodef-validator') Error.stackTraceLimit = 0 +// The suite used to take ~3min, almost all of it in protodef-validator < 1.5.0 (quadratic +// dataType validation) and Ajv's O(n^2) uniqueItems. Fail if it ever gets that slow again. +after('the test suite stays fast', function () { + const ms = performance.now() // measured from process start + assert.ok(ms < 40 * 1000, `the test suite took ${Math.round(ms)}ms, expected < 40s`) +}) + const data = ['attributes', 'biomes', 'commands', 'instruments', 'items', 'materials', 'blocks', 'blockCollisionShapes', 'recipes', 'windows', 'entities', 'protocol', 'version', 'effects', 'enchantments', 'language', 'foods', 'particles', 'blockLoot', 'entityLoot', 'mapIcons', 'tints', 'blockMappings', 'sounds', 'blockStates'] require('./version_iterator')(function (p, versionString) {