bpmnlint
Advanced tools
Comparing version 7.7.0 to 7.8.0
@@ -9,2 +9,7 @@ # Changelog | ||
## 7.8.0 | ||
* `FEAT`: be able to configure rules ([#82](https://github.com/bpmn-io/bpmnlint/pull/82)) | ||
* `FEAT`: be able to configure rules when testing ([#83](https://github.com/bpmn-io/bpmnlint/pull/83)) | ||
## 7.7.0 | ||
@@ -11,0 +16,0 @@ |
@@ -80,3 +80,3 @@ const testRule = require('./test-rule'); | ||
Linter.prototype.resolveRule = function(name) { | ||
Linter.prototype.resolveRule = function(name, config) { | ||
@@ -102,3 +102,3 @@ const { | ||
const rule = this.cachedRules[id] = ruleFactory(); | ||
const rule = this.cachedRules[id] = ruleFactory(config); | ||
@@ -168,6 +168,7 @@ return rule; | ||
const { | ||
name | ||
name, | ||
config | ||
} = definition; | ||
return this.resolveRule(name).then(function(rule) { | ||
return this.resolveRule(name, config).then(function(rule) { | ||
return { | ||
@@ -174,0 +175,0 @@ ...definition, |
@@ -17,7 +17,8 @@ /* global it, describe, beforeEach */ | ||
function verify(ruleName, rule, testCases) { | ||
const linterConfig = { | ||
rules: { [ruleName]: 2 } | ||
}; | ||
function createLinterConfig(config = {}) { | ||
return { | ||
rules: { [ruleName]: [ 2, config ] } | ||
}; | ||
} | ||
@@ -37,3 +38,3 @@ describe(`rules/${ruleName}`, function() { | ||
testCases.valid.forEach(({ moddleElement, name, it: _it }, idx) => ( | ||
testCases.valid.forEach(({ config = {}, it: _it, moddleElement, name }, idx) => ( | ||
@@ -44,3 +45,3 @@ (_it || it)(getTitle(idx, name), function() { | ||
.then(moddleRoot => { | ||
return linter.lint(moddleRoot.root, linterConfig); | ||
return linter.lint(moddleRoot.root, createLinterConfig(config)); | ||
}) | ||
@@ -60,3 +61,3 @@ .then(lintResults => { | ||
testCases.invalid.forEach(({ moddleElement, name, report, it: _it }, idx) => ( | ||
testCases.invalid.forEach(({ config = {}, it: _it, moddleElement, name, report }, idx) => ( | ||
@@ -85,3 +86,3 @@ (_it || it)(getTitle(idx, name), function() { | ||
.then(moddleRoot => { | ||
return linter.lint(moddleRoot.root, linterConfig); | ||
return linter.lint(moddleRoot.root, createLinterConfig(config)); | ||
}) | ||
@@ -106,9 +107,2 @@ .then(lintResults => { | ||
module.exports = { | ||
expectEqual, | ||
verify, | ||
getTitle, | ||
replacer | ||
}; | ||
function replacer(_, value) { | ||
@@ -142,2 +136,9 @@ if (!value) { | ||
return value; | ||
} | ||
} | ||
module.exports = { | ||
expectEqual, | ||
verify, | ||
getTitle, | ||
replacer | ||
}; |
{ | ||
"name": "bpmnlint", | ||
"description": "Validate your BPMN diagrams based on configurable lint rules", | ||
"version": "7.7.0", | ||
"version": "7.8.0", | ||
"main": "lib/index.js", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
56707
1652