tslint-jasmine-rules
Advanced tools
Comparing version 1.4.0 to 1.5.0
@@ -14,2 +14,3 @@ "use strict"; | ||
var Lint = require("tslint"); | ||
var callExpressionWalker_1 = require("./callExpressionWalker"); | ||
var Rule = (function (_super) { | ||
@@ -21,23 +22,9 @@ __extends(Rule, _super); | ||
Rule.prototype.apply = function (sourceFile) { | ||
return this.applyWithWalker(new NoDisabledTestsWalker(sourceFile, this.getOptions())); | ||
return this.applyWithWalker(new callExpressionWalker_1.CallExpressionWalker(sourceFile, this.getOptions(), Rule.REGEX, Rule.FAILURE_STRING)); | ||
}; | ||
Rule.FAILURE_STRING = "Disabled test (xit or xdescribe)"; | ||
Rule.PROHIBITED = ["xdescribe", "xit"]; | ||
Rule.REGEX = new RegExp("^(" + Rule.PROHIBITED.join("|") + ")$"); | ||
return Rule; | ||
}(Lint.Rules.AbstractRule)); | ||
exports.Rule = Rule; | ||
var regex = new RegExp("^(" + Rule.PROHIBITED.join("|") + ")$"); | ||
var NoDisabledTestsWalker = (function (_super) { | ||
__extends(NoDisabledTestsWalker, _super); | ||
function NoDisabledTestsWalker() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
NoDisabledTestsWalker.prototype.visitCallExpression = function (node) { | ||
var match = node.expression.getText().match(regex); | ||
if (match) { | ||
this.addFailureAt(node.getStart(), match[0].length, Rule.FAILURE_STRING); | ||
} | ||
_super.prototype.visitCallExpression.call(this, node); | ||
}; | ||
return NoDisabledTestsWalker; | ||
}(Lint.RuleWalker)); |
@@ -14,2 +14,3 @@ "use strict"; | ||
var Lint = require("tslint"); | ||
var callExpressionWalker_1 = require("./callExpressionWalker"); | ||
var Rule = (function (_super) { | ||
@@ -21,23 +22,9 @@ __extends(Rule, _super); | ||
Rule.prototype.apply = function (sourceFile) { | ||
return this.applyWithWalker(new NoFocusedTestsWalker(sourceFile, this.getOptions())); | ||
return this.applyWithWalker(new callExpressionWalker_1.CallExpressionWalker(sourceFile, this.getOptions(), Rule.REGEX, Rule.FAILURE_STRING)); | ||
}; | ||
Rule.FAILURE_STRING = "Focused test (fit or fdescribe)"; | ||
Rule.PROHIBITED = ["fdescribe", "fit"]; | ||
Rule.REGEX = new RegExp("^(" + Rule.PROHIBITED.join("|") + ")$"); | ||
return Rule; | ||
}(Lint.Rules.AbstractRule)); | ||
exports.Rule = Rule; | ||
var regex = new RegExp("^(" + Rule.PROHIBITED.join("|") + ")$"); | ||
var NoFocusedTestsWalker = (function (_super) { | ||
__extends(NoFocusedTestsWalker, _super); | ||
function NoFocusedTestsWalker() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
NoFocusedTestsWalker.prototype.visitCallExpression = function (node) { | ||
var match = node.expression.getText().match(regex); | ||
if (match) { | ||
this.addFailureAt(node.getStart(), match[0].length, Rule.FAILURE_STRING); | ||
} | ||
_super.prototype.visitCallExpression.call(this, node); | ||
}; | ||
return NoFocusedTestsWalker; | ||
}(Lint.RuleWalker)); |
{ | ||
"name": "tslint-jasmine-rules", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "tslint rules for jasmine", | ||
@@ -8,3 +8,3 @@ "main": "dist/index.js", | ||
"release": "rimraf dist && tsc && npm t && npm run lint", | ||
"test": "rimraf dist && tsc && tslint --test test", | ||
"test": "rimraf dist && tsc && tslint --test test/**/*", | ||
"tsc": "tsc", | ||
@@ -11,0 +11,0 @@ "cp": "cp", |
@@ -29,1 +29,12 @@ # tslint-jasmine-rules | ||
``` | ||
## Fixable | ||
The rules `no-focused-tests` and `no-disabled-tests` can have a parameter `fixable` to fix them: | ||
```json | ||
{ | ||
"no-focused-tests": [true, "fixable"], | ||
"no-disabled-tests": [true, "fixable"] | ||
} | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10582
8
176
39