Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tslint-jasmine-rules

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tslint-jasmine-rules - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

dist/callExpressionWalker.js

19

dist/noDisabledTestsRule.js

@@ -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"]
}
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc