eslint-plugin-lab
Advanced tools
Comparing version 0.0.3 to 0.1.0
/** | ||
* @fileoverview Disallow .only for experiments and describes | ||
* @fileoverview Disallow .only for experiments, describes, tests, and it | ||
* @author David Rankin | ||
@@ -14,3 +14,3 @@ */ | ||
docs: { | ||
description: "Disallow .only for experiments and describes", | ||
description: "Disallow .only for experiments, describes, tests and it", | ||
category: "Fill me in", | ||
@@ -32,3 +32,3 @@ recommended: false | ||
function ifExperimentReport(name, node) { | ||
if(name == 'experiment' || name === 'describe') { | ||
if(name == 'experiment' || name === 'describe'|| name === 'test'|| name === 'it' ) { | ||
context.report(node, `${name} should not be marked as only`); | ||
@@ -51,3 +51,3 @@ } | ||
if (node.object.name) { | ||
// covers the experiment.only() case | ||
// covers experiment.only(), describe.only(), test.only() and it.only() cases | ||
return ifExperimentReport(node.object.name, node); | ||
@@ -57,3 +57,3 @@ } | ||
if (node.object.object && node.object.object.name === 'lab' && node.object.property) { | ||
// covers the lab.experiment.only() case | ||
// covers lab.experiment.only(), lab.describe.only(), lab.test.only() and lab.it.only() cases | ||
return ifExperimentReport(node.object.property.name, node); | ||
@@ -60,0 +60,0 @@ } |
{ | ||
"name": "eslint-plugin-lab", | ||
"version": "0.0.3", | ||
"version": "0.1.0", | ||
"description": "Linting rules for lab testing framework", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
/** | ||
* @fileoverview Disallow .only for experiments and describes | ||
* @fileoverview Disallow .only for experiments, describes, tests, and it | ||
* @author no-only-experiments | ||
@@ -25,5 +25,18 @@ */ | ||
'lab.experiment("valid", function() {})', | ||
'lab.test("valid", function() {})', | ||
'lab.describe("valid", function() {})', | ||
'lab.it("valid", function() {})', | ||
'lab.experiment', | ||
'lab.test', | ||
'lab.describe', | ||
'lab.it', | ||
'experiment("valid", function() {})', | ||
'only("some other func")' | ||
'test("valid", function() {})', | ||
'describe("valid", function() {})', | ||
'it("valid", function() {})', | ||
'only("some other func")', | ||
'experiment', | ||
'test', | ||
'describe', | ||
'it' | ||
], | ||
@@ -40,2 +53,9 @@ | ||
{ | ||
code: "lab.experiment.only", | ||
errors: [{ | ||
message: "experiment should not be marked as only", | ||
type: "MemberExpression" | ||
}] | ||
}, | ||
{ | ||
code: "experiment.only('describe something', function() { });", | ||
@@ -48,2 +68,9 @@ errors: [{ | ||
{ | ||
code: "experiment.only", | ||
errors: [{ | ||
message: "experiment should not be marked as only", | ||
type: "MemberExpression" | ||
}] | ||
}, | ||
{ | ||
code: "lab.describe.only('describe something', function() { });", | ||
@@ -56,2 +83,9 @@ errors: [{ | ||
{ | ||
code: "lab.describe.only", | ||
errors: [{ | ||
message: "describe should not be marked as only", | ||
type: "MemberExpression" | ||
}] | ||
}, | ||
{ | ||
code: "describe.only('describe something', function() { });", | ||
@@ -62,4 +96,67 @@ errors: [{ | ||
}] | ||
}, | ||
{ | ||
code: "describe.only", | ||
errors: [{ | ||
message: "describe should not be marked as only", | ||
type: "MemberExpression" | ||
}] | ||
}, | ||
{ | ||
code: "lab.test.only('describe something', function() { });", | ||
errors: [{ | ||
message: "test should not be marked as only", | ||
type: "MemberExpression" | ||
}] | ||
}, | ||
{ | ||
code: "lab.test.only", | ||
errors: [{ | ||
message: "test should not be marked as only", | ||
type: "MemberExpression" | ||
}] | ||
}, | ||
{ | ||
code: "test.only('describe something', function() { });", | ||
errors: [{ | ||
message: "test should not be marked as only", | ||
type: "MemberExpression" | ||
}] | ||
}, | ||
{ | ||
code: "test.only", | ||
errors: [{ | ||
message: "test should not be marked as only", | ||
type: "MemberExpression" | ||
}] | ||
}, | ||
{ | ||
code: "lab.it.only('describe something', function() { });", | ||
errors: [{ | ||
message: "it should not be marked as only", | ||
type: "MemberExpression" | ||
}] | ||
}, | ||
{ | ||
code: "lab.it.only", | ||
errors: [{ | ||
message: "it should not be marked as only", | ||
type: "MemberExpression" | ||
}] | ||
}, | ||
{ | ||
code: "it.only('describe something', function() { });", | ||
errors: [{ | ||
message: "it should not be marked as only", | ||
type: "MemberExpression" | ||
}] | ||
}, | ||
{ | ||
code: "it.only", | ||
errors: [{ | ||
message: "it should not be marked as only", | ||
type: "MemberExpression" | ||
}] | ||
} | ||
] | ||
}); |
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
10345
225
7