From 4c8206e7f9a601d863e32cb256ddd82db6c24bc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Konopski?= Date: Mon, 18 Nov 2024 14:49:22 +0100 Subject: [PATCH] feat: support task listeners related to https://github.com/camunda/camunda-modeler/issues/4590 --- CHANGELOG.md | 4 ++ lib/compiled-config.js | 78 +++++++++++++----------- lib/utils/error-messages.js | 8 +++ lib/utils/properties-panel.js | 10 +++ package-lock.json | 76 ++++++++++++----------- package.json | 8 +-- test/spec/utils/error-messages.spec.js | 53 ++++++++++++++++ test/spec/utils/properties-panel.spec.js | 37 +++++++++++ 8 files changed, 200 insertions(+), 74 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1bf2958..c6d9102 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ All notable changes to [@camunda/linting](https://github.com/camunda/linting) ar ___Note:__ Yet to be released changes appear here._ +* `FEAT`: support for task listeners ([#123](https://github.com/camunda/linting/pull/123)) +* `DEPS`: update to `bpmnlint-plugin-camunda-compat@2.28.0` +* `DEPS`: update to `zeebe-bpmn-moddle@1.7.0` + ## 3.28.0 * `FEAT`: add `zeebe-user-task` rule ([camunda/bpmnlint-plugin-camunda-compat#179](https://github.com/camunda/bpmnlint-plugin-camunda-compat/pull/179)) diff --git a/lib/compiled-config.js b/lib/compiled-config.js index e2d9caa..91f9bcc 100644 --- a/lib/compiled-config.js +++ b/lib/compiled-config.js @@ -58,6 +58,7 @@ const rules = { "camunda-compat/no-propagate-all-parent-variables": "error", "camunda-compat/no-signal-event-sub-process": "error", "camunda-compat/no-task-schedule": "error", + "camunda-compat/no-task-listeners": "error", "camunda-compat/no-template": "error", "camunda-compat/no-version-tag": "error", "camunda-compat/no-zeebe-properties": "error", @@ -68,6 +69,7 @@ const rules = { "camunda-compat/signal-reference": "error", "camunda-compat/start-event-form": "error", "camunda-compat/subscription": "error", + "camunda-compat/task-listener": "error", "camunda-compat/task-schedule": "error", "camunda-compat/timer": "error", "camunda-compat/user-task-definition": "warn", @@ -206,70 +208,78 @@ import rule_28 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-task- cache['bpmnlint-plugin-camunda-compat/no-task-schedule'] = rule_28; -import rule_29 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-template'; +import rule_29 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-task-listeners'; -cache['bpmnlint-plugin-camunda-compat/no-template'] = rule_29; +cache['bpmnlint-plugin-camunda-compat/no-task-listeners'] = rule_29; -import rule_30 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-version-tag'; +import rule_30 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-template'; -cache['bpmnlint-plugin-camunda-compat/no-version-tag'] = rule_30; +cache['bpmnlint-plugin-camunda-compat/no-template'] = rule_30; -import rule_31 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-zeebe-properties'; +import rule_31 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-version-tag'; -cache['bpmnlint-plugin-camunda-compat/no-zeebe-properties'] = rule_31; +cache['bpmnlint-plugin-camunda-compat/no-version-tag'] = rule_31; -import rule_32 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-zeebe-user-task'; +import rule_32 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-zeebe-properties'; -cache['bpmnlint-plugin-camunda-compat/no-zeebe-user-task'] = rule_32; +cache['bpmnlint-plugin-camunda-compat/no-zeebe-properties'] = rule_32; -import rule_33 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/priority-definition'; +import rule_33 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-zeebe-user-task'; -cache['bpmnlint-plugin-camunda-compat/priority-definition'] = rule_33; +cache['bpmnlint-plugin-camunda-compat/no-zeebe-user-task'] = rule_33; -import rule_34 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/secrets'; +import rule_34 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/priority-definition'; -cache['bpmnlint-plugin-camunda-compat/secrets'] = rule_34; +cache['bpmnlint-plugin-camunda-compat/priority-definition'] = rule_34; -import rule_35 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/sequence-flow-condition'; +import rule_35 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/secrets'; -cache['bpmnlint-plugin-camunda-compat/sequence-flow-condition'] = rule_35; +cache['bpmnlint-plugin-camunda-compat/secrets'] = rule_35; -import rule_36 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/signal-reference'; +import rule_36 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/sequence-flow-condition'; -cache['bpmnlint-plugin-camunda-compat/signal-reference'] = rule_36; +cache['bpmnlint-plugin-camunda-compat/sequence-flow-condition'] = rule_36; -import rule_37 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/start-event-form'; +import rule_37 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/signal-reference'; -cache['bpmnlint-plugin-camunda-compat/start-event-form'] = rule_37; +cache['bpmnlint-plugin-camunda-compat/signal-reference'] = rule_37; -import rule_38 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/subscription'; +import rule_38 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/start-event-form'; -cache['bpmnlint-plugin-camunda-compat/subscription'] = rule_38; +cache['bpmnlint-plugin-camunda-compat/start-event-form'] = rule_38; -import rule_39 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/task-schedule'; +import rule_39 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/subscription'; -cache['bpmnlint-plugin-camunda-compat/task-schedule'] = rule_39; +cache['bpmnlint-plugin-camunda-compat/subscription'] = rule_39; -import rule_40 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/timer'; +import rule_40 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/task-listener'; -cache['bpmnlint-plugin-camunda-compat/timer'] = rule_40; +cache['bpmnlint-plugin-camunda-compat/task-listener'] = rule_40; -import rule_41 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/user-task-definition'; +import rule_41 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/task-schedule'; -cache['bpmnlint-plugin-camunda-compat/user-task-definition'] = rule_41; +cache['bpmnlint-plugin-camunda-compat/task-schedule'] = rule_41; -import rule_42 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/user-task-form'; +import rule_42 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/timer'; -cache['bpmnlint-plugin-camunda-compat/user-task-form'] = rule_42; +cache['bpmnlint-plugin-camunda-compat/timer'] = rule_42; -import rule_43 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/version-tag'; +import rule_43 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/user-task-definition'; -cache['bpmnlint-plugin-camunda-compat/version-tag'] = rule_43; +cache['bpmnlint-plugin-camunda-compat/user-task-definition'] = rule_43; -import rule_44 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/wait-for-completion'; +import rule_44 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/user-task-form'; -cache['bpmnlint-plugin-camunda-compat/wait-for-completion'] = rule_44; +cache['bpmnlint-plugin-camunda-compat/user-task-form'] = rule_44; -import rule_45 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/zeebe-user-task'; +import rule_45 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/version-tag'; -cache['bpmnlint-plugin-camunda-compat/zeebe-user-task'] = rule_45; \ No newline at end of file +cache['bpmnlint-plugin-camunda-compat/version-tag'] = rule_45; + +import rule_46 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/wait-for-completion'; + +cache['bpmnlint-plugin-camunda-compat/wait-for-completion'] = rule_46; + +import rule_47 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/zeebe-user-task'; + +cache['bpmnlint-plugin-camunda-compat/zeebe-user-task'] = rule_47; \ No newline at end of file diff --git a/lib/utils/error-messages.js b/lib/utils/error-messages.js index 9c072f0..bab30e6 100644 --- a/lib/utils/error-messages.js +++ b/lib/utils/error-messages.js @@ -336,6 +336,10 @@ function getExtensionElementNotAllowedErrorMessage(report, executionPlatform, ex return getSupportedMessage(`${ getIndefiniteArticle(typeString) } <${ typeString }> with `, executionPlatform, executionPlatformVersion, allowedVersion); } + if (is(extensionElement, 'zeebe:TaskListeners')) { + return getSupportedMessage(`${ getIndefiniteArticle(typeString) } <${ typeString }> with `, executionPlatform, executionPlatformVersion, allowedVersion); + } + if (is(node, 'bpmn:Process') && is(extensionElement, 'zeebe:VersionTag')) { return getSupportedMessage(`${ getIndefiniteArticle(typeString) } <${ typeString }> with `, executionPlatform, executionPlatformVersion, allowedVersion); } @@ -536,6 +540,10 @@ function getPropertyRequiredErrorMessage(report, executionPlatform, executionPla return 'An must have a defined '; } + if (is(node, 'zeebe:TaskListener') && requiredProperty === 'type') { + return 'A must have a defined '; + } + if (requiredProperty === 'errorRef') { if (parentNode && is(parentNode, 'bpmn:CatchEvent')) { diff --git a/lib/utils/properties-panel.js b/lib/utils/properties-panel.js index f51c93b..a7decdf 100644 --- a/lib/utils/properties-panel.js +++ b/lib/utils/properties-panel.js @@ -340,6 +340,12 @@ export function getEntryIds(report) { }); } + if (isPropertyError(data, 'type', 'zeebe:TaskListener')) { + const index = path[ path.length - 2 ]; + + return [ `${id}-taskListener-${index}-listenerType` ]; + } + if (isPropertyError(data, 'bindingType')) { return [ 'bindingType' ]; } @@ -581,6 +587,10 @@ export function getErrorMessage(id, report) { } } + if (/^.+-taskListener-[0-9]+-listenerType$/.test(id)) { + return 'Must be defined.'; + } + if (id === 'bindingType') { return getNotSupportedMessage('', allowedVersion); } diff --git a/package-lock.json b/package-lock.json index e6f930c..57bb4ec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@bpmn-io/diagram-js-ui": "^0.2.3", "bpmn-moddle": "^9.0.1", "bpmnlint": "^10.3.1", - "bpmnlint-plugin-camunda-compat": "^2.27.0", + "bpmnlint-plugin-camunda-compat": "^2.28.0", "bpmnlint-utils": "^1.0.2", "camunda-bpmn-moddle": "^7.0.1", "clsx": "^2.0.0", @@ -20,13 +20,13 @@ "min-dom": "^5.1.1", "modeler-moddle": "^0.2.0", "semver-compare": "^1.0.0", - "zeebe-bpmn-moddle": "^1.6.0" + "zeebe-bpmn-moddle": "^1.7.0" }, "devDependencies": { "bpmn-js": "^17.11.1", "bpmn-js-element-templates": "^2.2.1", - "bpmn-js-properties-panel": "^5.24.0", - "camunda-bpmn-js-behaviors": "^1.6.1", + "bpmn-js-properties-panel": "^5.27.0", + "camunda-bpmn-js-behaviors": "^1.7.1", "chai": "^4.5.0", "cross-env": "^7.0.3", "eslint": "^8.57.1", @@ -1557,12 +1557,13 @@ } }, "node_modules/bpmn-js-properties-panel": { - "version": "5.24.0", - "resolved": "https://registry.npmjs.org/bpmn-js-properties-panel/-/bpmn-js-properties-panel-5.24.0.tgz", - "integrity": "sha512-OPowufOEa6SVDzdtikgP5zfjFLIKvlkJbtx4mJewdFjmZnqR1pYwoLElqHPd3V7KEM5b71b3iia8lapZoXlRFw==", + "version": "5.27.0", + "resolved": "https://registry.npmjs.org/bpmn-js-properties-panel/-/bpmn-js-properties-panel-5.27.0.tgz", + "integrity": "sha512-A7S6dswPZitcu5tyhOshAXf6EC3J+690v48TRptWTNO3wkrihlDlDvIw2eL8+B4D/UK2rCLadjcgCOhoLHEuNA==", "dev": true, + "license": "MIT", "dependencies": { - "@bpmn-io/extract-process-variables": "^0.9.0", + "@bpmn-io/extract-process-variables": "^1.0.0", "array-move": "^4.0.0", "ids": "^1.0.5", "min-dash": "^4.2.1", @@ -1579,10 +1580,11 @@ } }, "node_modules/bpmn-js-properties-panel/node_modules/@bpmn-io/extract-process-variables": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/@bpmn-io/extract-process-variables/-/extract-process-variables-0.9.0.tgz", - "integrity": "sha512-32h64pyToe8ss6+jAsRiFFpOTOm+QS+3vqRvzhRjkXbT8Qie7X/uYYrp980eBSgW/otAUrsMmlU10IBZ7dpfGQ==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@bpmn-io/extract-process-variables/-/extract-process-variables-1.0.0.tgz", + "integrity": "sha512-4EpxKwsV1h1ttlFywo8Af+JBhGzmmv63C8x2Fu5traH8z/4VJbPa2AncIU2GFHj7LYeZlygEDYWPB0QRYoQWKg==", "dev": true, + "license": "MIT", "dependencies": { "min-dash": "^4.0.0" } @@ -1710,9 +1712,9 @@ } }, "node_modules/bpmnlint-plugin-camunda-compat": { - "version": "2.27.0", - "resolved": "https://registry.npmjs.org/bpmnlint-plugin-camunda-compat/-/bpmnlint-plugin-camunda-compat-2.27.0.tgz", - "integrity": "sha512-6nf+rSwIoPxfF0kD2001YBo6kXhfYOTQGVyBKbhMsXZFu4IL6ixqlqSbPj1dmbMcH2g2zeRSnm3vRnY3s7I+rA==", + "version": "2.28.0", + "resolved": "https://registry.npmjs.org/bpmnlint-plugin-camunda-compat/-/bpmnlint-plugin-camunda-compat-2.28.0.tgz", + "integrity": "sha512-NAdJZuOnopHrmuGf3+QAMLmAOLcBPxjTI+YCP2YXeAQ0A/3OD1Ek3NhcYfy3im19OA9TRVECzLsH97D32NzANA==", "license": "MIT", "dependencies": { "@bpmn-io/feel-lint": "^1.2.0", @@ -1917,10 +1919,11 @@ } }, "node_modules/camunda-bpmn-js-behaviors": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/camunda-bpmn-js-behaviors/-/camunda-bpmn-js-behaviors-1.6.1.tgz", - "integrity": "sha512-nvfFmL2wrCi5IApt4NcYcpRHJx4nPS8AHSUq9ckyq9FiDeIwASafsvaEYY0r+FeobqUY1deYNYsKjhSYd4N0kQ==", + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/camunda-bpmn-js-behaviors/-/camunda-bpmn-js-behaviors-1.7.1.tgz", + "integrity": "sha512-hWgMbkwsuzDV274w/XZ6wF6vby9+RaJj7n175NTusfumZtQoMJMDm5/zw/gjeEkf+/3nkZ18TMid5FIe/H6Vhg==", "dev": true, + "license": "MIT", "dependencies": { "ids": "^1.0.0", "min-dash": "^4.0.0" @@ -7284,9 +7287,10 @@ } }, "node_modules/zeebe-bpmn-moddle": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/zeebe-bpmn-moddle/-/zeebe-bpmn-moddle-1.6.0.tgz", - "integrity": "sha512-vjPeJoLQs7UkC5m27K0CyZkQMEAI8GsISU6TcfD2n/SzqkhJ6tubvcIabLRAhreaiuHY26MjtSVXw1LRVgd7Iw==" + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/zeebe-bpmn-moddle/-/zeebe-bpmn-moddle-1.7.0.tgz", + "integrity": "sha512-eZ6OXSt0c4n9V/oN/46gTlwDIS3GhWQLt9jbM5uS/YryB4yN8wdrrKrtw+TpyNy0SSKWXNDHyC83nCA2blPO3Q==", + "license": "MIT" }, "node_modules/zod": { "version": "3.23.8", @@ -8596,12 +8600,12 @@ } }, "bpmn-js-properties-panel": { - "version": "5.24.0", - "resolved": "https://registry.npmjs.org/bpmn-js-properties-panel/-/bpmn-js-properties-panel-5.24.0.tgz", - "integrity": "sha512-OPowufOEa6SVDzdtikgP5zfjFLIKvlkJbtx4mJewdFjmZnqR1pYwoLElqHPd3V7KEM5b71b3iia8lapZoXlRFw==", + "version": "5.27.0", + "resolved": "https://registry.npmjs.org/bpmn-js-properties-panel/-/bpmn-js-properties-panel-5.27.0.tgz", + "integrity": "sha512-A7S6dswPZitcu5tyhOshAXf6EC3J+690v48TRptWTNO3wkrihlDlDvIw2eL8+B4D/UK2rCLadjcgCOhoLHEuNA==", "dev": true, "requires": { - "@bpmn-io/extract-process-variables": "^0.9.0", + "@bpmn-io/extract-process-variables": "^1.0.0", "array-move": "^4.0.0", "ids": "^1.0.5", "min-dash": "^4.2.1", @@ -8609,9 +8613,9 @@ }, "dependencies": { "@bpmn-io/extract-process-variables": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/@bpmn-io/extract-process-variables/-/extract-process-variables-0.9.0.tgz", - "integrity": "sha512-32h64pyToe8ss6+jAsRiFFpOTOm+QS+3vqRvzhRjkXbT8Qie7X/uYYrp980eBSgW/otAUrsMmlU10IBZ7dpfGQ==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@bpmn-io/extract-process-variables/-/extract-process-variables-1.0.0.tgz", + "integrity": "sha512-4EpxKwsV1h1ttlFywo8Af+JBhGzmmv63C8x2Fu5traH8z/4VJbPa2AncIU2GFHj7LYeZlygEDYWPB0QRYoQWKg==", "dev": true, "requires": { "min-dash": "^4.0.0" @@ -8699,9 +8703,9 @@ } }, "bpmnlint-plugin-camunda-compat": { - "version": "2.27.0", - "resolved": "https://registry.npmjs.org/bpmnlint-plugin-camunda-compat/-/bpmnlint-plugin-camunda-compat-2.27.0.tgz", - "integrity": "sha512-6nf+rSwIoPxfF0kD2001YBo6kXhfYOTQGVyBKbhMsXZFu4IL6ixqlqSbPj1dmbMcH2g2zeRSnm3vRnY3s7I+rA==", + "version": "2.28.0", + "resolved": "https://registry.npmjs.org/bpmnlint-plugin-camunda-compat/-/bpmnlint-plugin-camunda-compat-2.28.0.tgz", + "integrity": "sha512-NAdJZuOnopHrmuGf3+QAMLmAOLcBPxjTI+YCP2YXeAQ0A/3OD1Ek3NhcYfy3im19OA9TRVECzLsH97D32NzANA==", "requires": { "@bpmn-io/feel-lint": "^1.2.0", "@bpmn-io/moddle-utils": "^0.2.1", @@ -8806,9 +8810,9 @@ "dev": true }, "camunda-bpmn-js-behaviors": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/camunda-bpmn-js-behaviors/-/camunda-bpmn-js-behaviors-1.6.1.tgz", - "integrity": "sha512-nvfFmL2wrCi5IApt4NcYcpRHJx4nPS8AHSUq9ckyq9FiDeIwASafsvaEYY0r+FeobqUY1deYNYsKjhSYd4N0kQ==", + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/camunda-bpmn-js-behaviors/-/camunda-bpmn-js-behaviors-1.7.1.tgz", + "integrity": "sha512-hWgMbkwsuzDV274w/XZ6wF6vby9+RaJj7n175NTusfumZtQoMJMDm5/zw/gjeEkf+/3nkZ18TMid5FIe/H6Vhg==", "dev": true, "requires": { "ids": "^1.0.0", @@ -12739,9 +12743,9 @@ "dev": true }, "zeebe-bpmn-moddle": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/zeebe-bpmn-moddle/-/zeebe-bpmn-moddle-1.6.0.tgz", - "integrity": "sha512-vjPeJoLQs7UkC5m27K0CyZkQMEAI8GsISU6TcfD2n/SzqkhJ6tubvcIabLRAhreaiuHY26MjtSVXw1LRVgd7Iw==" + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/zeebe-bpmn-moddle/-/zeebe-bpmn-moddle-1.7.0.tgz", + "integrity": "sha512-eZ6OXSt0c4n9V/oN/46gTlwDIS3GhWQLt9jbM5uS/YryB4yN8wdrrKrtw+TpyNy0SSKWXNDHyC83nCA2blPO3Q==" }, "zod": { "version": "3.23.8", diff --git a/package.json b/package.json index df13526..c034e71 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "@bpmn-io/diagram-js-ui": "^0.2.3", "bpmn-moddle": "^9.0.1", "bpmnlint": "^10.3.1", - "bpmnlint-plugin-camunda-compat": "^2.27.0", + "bpmnlint-plugin-camunda-compat": "^2.28.0", "bpmnlint-utils": "^1.0.2", "camunda-bpmn-moddle": "^7.0.1", "clsx": "^2.0.0", @@ -40,13 +40,13 @@ "min-dom": "^5.1.1", "modeler-moddle": "^0.2.0", "semver-compare": "^1.0.0", - "zeebe-bpmn-moddle": "^1.6.0" + "zeebe-bpmn-moddle": "^1.7.0" }, "devDependencies": { "bpmn-js": "^17.11.1", "bpmn-js-element-templates": "^2.2.1", - "bpmn-js-properties-panel": "^5.24.0", - "camunda-bpmn-js-behaviors": "^1.6.1", + "bpmn-js-properties-panel": "^5.27.0", + "camunda-bpmn-js-behaviors": "^1.7.1", "chai": "^4.5.0", "cross-env": "^7.0.3", "eslint": "^8.57.1", diff --git a/test/spec/utils/error-messages.spec.js b/test/spec/utils/error-messages.spec.js index af64a22..1e13e8a 100644 --- a/test/spec/utils/error-messages.spec.js +++ b/test/spec/utils/error-messages.spec.js @@ -502,6 +502,31 @@ describe('utils/error-messages', function() { }); + it('should adjust (zeebe:TaskListeners)', async function() { + + // given + const executionPlatformVersion = '8.2'; + + const node = createElement('bpmn:UserTask', { + extensionElements: createElement('bpmn:ExtensionElements', { + values: [ + createElement('zeebe:TaskListeners') + ] + }) + }); + + const { default: rule } = await import('bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-task-listeners'); + + const report = await getLintError(node, rule, { version: executionPlatformVersion }); + + // when + const errorMessage = getErrorMessage(report, 'Camunda Cloud', executionPlatformVersion); + + // then + expect(errorMessage).to.equal('A with is only supported by Camunda 8.7 or newer'); + }); + + it('should adjust (zeebe:VersionTag)', async function() { // given @@ -1652,6 +1677,34 @@ describe('utils/error-messages', function() { }); + it('should adjust (task listener type)', async function() { + + // given + const node = createElement('bpmn:UserTask', { + extensionElements: createElement('bpmn:ExtensionElements', { + values: [ + createElement('zeebe:TaskListeners', { + listeners: [ + createElement('zeebe:TaskListener', { eventType: 'start', type: '' }), + ] + }), + createElement('zeebe:UserTask') + ] + }) + }); + + const { default: rule } = await import('bpmnlint-plugin-camunda-compat/rules/camunda-cloud/task-listener'); + + const report = await getLintError(node, rule); + + // when + const errorMessage = getErrorMessage(report); + + // then + expect(errorMessage).to.equal('A must have a defined '); + }); + + describe('version tag', function() { it('should adjust (business rule task)', async function() { diff --git a/test/spec/utils/properties-panel.spec.js b/test/spec/utils/properties-panel.spec.js index f8c4721..077f914 100644 --- a/test/spec/utils/properties-panel.spec.js +++ b/test/spec/utils/properties-panel.spec.js @@ -2087,6 +2087,43 @@ describe('utils/properties-panel', function() { }); + describe('Task listeners', async function() { + + it('should mark type as required', async function() { + + // given + const node = createElement('bpmn:UserTask', { + id: 'UserTask_1', + extensionElements: createElement('bpmn:ExtensionElements', { + values: [ + createElement('zeebe:TaskListeners', { + listeners: [ + createElement('zeebe:TaskListener', { + eventType: 'start' + }) + ] + }), + createElement('zeebe:UserTask') + ] + }) + }); + + const { default: rule } = await import('bpmnlint-plugin-camunda-compat/rules/camunda-cloud/task-listener'); + + const report = await getLintError(node, rule); + + // when + const entryIds = getEntryIds(report); + + // then + expect(entryIds).to.eql([ 'UserTask_1-taskListener-0-listenerType' ]); + + expectErrorMessage(entryIds[ 0 ], 'Must be defined.', report); + }); + + }); + + describe('Binding', function() { it('business rule task', async function() {