Skip to content

Commit

Permalink
Build: Add wrapper around ESLint RuleTester
Browse files Browse the repository at this point in the history
  • Loading branch information
Casey Visco committed Aug 13, 2016
1 parent 5d4b5c8 commit 9bead61
Show file tree
Hide file tree
Showing 22 changed files with 50 additions and 84 deletions.
6 changes: 2 additions & 4 deletions tests/lib/rules/amd-function-arity.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

"use strict";

const RuleTester = require("eslint").RuleTester;
const testRule = require("../../rule-tester");
const fixtures = require("../../fixtures");
const rule = require("../../../lib/rules/amd-function-arity");

Expand Down Expand Up @@ -37,9 +37,7 @@ function makeTooFewParamsError(funcName, expected, actual) {
return { message: message };
}

const ruleTester = new RuleTester();

ruleTester.run("amd-function-arity", rule, {
testRule("amd-function-arity", rule, {

valid: [
// Dependency count and parameter counts equal-- always valid
Expand Down
6 changes: 2 additions & 4 deletions tests/lib/rules/enforce-define.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

"use strict";

const RuleTester = require("eslint").RuleTester;
const testRule = require("../../rule-tester");
const fixtures = require("../../fixtures");
const rule = require("../../../lib/rules/enforce-define");

Expand All @@ -14,9 +14,7 @@ const ERROR = {
type: "Program"
};

const ruleTester = new RuleTester();

ruleTester.run("enforce-define", rule, {
testRule("enforce-define", rule, {

valid: [

Expand Down
6 changes: 2 additions & 4 deletions tests/lib/rules/no-amd-define.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

"use strict";

const RuleTester = require("eslint").RuleTester;
const testRule = require("../../rule-tester");
const fixtures = require("../../fixtures");
const rule = require("../../../lib/rules/no-amd-define");

Expand All @@ -14,9 +14,7 @@ const ERROR = {
type: "CallExpression"
};

const ruleTester = new RuleTester();

ruleTester.run("no-amd-define", rule, {
testRule("no-amd-define", rule, {

valid: [
fixtures.OBJECT_DEFINE,
Expand Down
6 changes: 2 additions & 4 deletions tests/lib/rules/no-assign-exports.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

"use strict";

const RuleTester = require("eslint").RuleTester;
const testRule = require("../../rule-tester");
const fixtures = require("../../fixtures");
const rule = require("../../../lib/rules/no-assign-exports");

Expand All @@ -14,9 +14,7 @@ const ERROR = {
type: "AssignmentExpression"
};

const ruleTester = new RuleTester();

ruleTester.run("no-assign-exports", rule, {
testRule("no-assign-exports", rule, {

valid: [
fixtures.CJS_WITH_EXPORTS,
Expand Down
6 changes: 2 additions & 4 deletions tests/lib/rules/no-assign-require.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@

"use strict";

const RuleTester = require("eslint").RuleTester;
const testRule = require("../../rule-tester");
const fixtures = require("../../fixtures");
const rule = require("../../../lib/rules/no-assign-require");

const MESSAGE = "Invalid assignment to `require`.";

const ruleTester = new RuleTester();

ruleTester.run("no-assign-require", rule, {
testRule("no-assign-require", rule, {

valid: [
fixtures.ASSIGN_TO_FOO_REQUIRE
Expand Down
6 changes: 2 additions & 4 deletions tests/lib/rules/no-commonjs-exports.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

"use strict";

const RuleTester = require("eslint").RuleTester;
const testRule = require("../../rule-tester");
const fixtures = require("../../fixtures");
const rule = require("../../../lib/rules/no-commonjs-exports");

Expand All @@ -14,9 +14,7 @@ const ERROR = {
type: "AssignmentExpression"
};

const ruleTester = new RuleTester();

ruleTester.run("no-commonjs-exports", rule, {
testRule("no-commonjs-exports", rule, {

valid: [
fixtures.OBJECT_DEFINE,
Expand Down
6 changes: 2 additions & 4 deletions tests/lib/rules/no-commonjs-module-exports.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

"use strict";

const RuleTester = require("eslint").RuleTester;
const testRule = require("../../rule-tester");
const fixtures = require("../../fixtures");
const rule = require("../../../lib/rules/no-commonjs-module-exports");

Expand All @@ -14,9 +14,7 @@ const ERROR = {
type: "AssignmentExpression"
};

const ruleTester = new RuleTester();

ruleTester.run("no-commonjs-module-exports", rule, {
testRule("no-commonjs-module-exports", rule, {

valid: [
fixtures.OBJECT_DEFINE,
Expand Down
6 changes: 2 additions & 4 deletions tests/lib/rules/no-commonjs-return.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

"use strict";

const RuleTester = require("eslint").RuleTester;
const testRule = require("../../rule-tester");
const fixtures = require("../../fixtures");
const rule = require("../../../lib/rules/no-commonjs-return");

Expand All @@ -14,9 +14,7 @@ const ERROR = {
type: "ReturnStatement"
};

const ruleTester = new RuleTester();

ruleTester.run("no-commonjs-return", rule, {
testRule("no-commonjs-return", rule, {

valid: [
fixtures.OBJECT_DEFINE,
Expand Down
6 changes: 2 additions & 4 deletions tests/lib/rules/no-commonjs-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

"use strict";

const RuleTester = require("eslint").RuleTester;
const testRule = require("../../rule-tester");
const fixtures = require("../../fixtures");
const rule = require("../../../lib/rules/no-commonjs-wrapper");

Expand All @@ -14,9 +14,7 @@ const ERROR = {
type: "CallExpression"
};

const ruleTester = new RuleTester();

ruleTester.run("no-commonjs-wrapper", rule, {
testRule("no-commonjs-wrapper", rule, {

valid: [
fixtures.OBJECT_DEFINE,
Expand Down
6 changes: 2 additions & 4 deletions tests/lib/rules/no-conditional-require.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

"use strict";

const RuleTester = require("eslint").RuleTester;
const testRule = require("../../rule-tester");
const fixtures = require("../../fixtures");
const rule = require("../../../lib/rules/no-conditional-require");

Expand All @@ -14,9 +14,7 @@ const ERROR = {
type: "CallExpression"
};

const ruleTester = new RuleTester();

ruleTester.run("no-conditional-require", rule, {
testRule("no-conditional-require", rule, {

valid: [
fixtures.AMD_REQUIRE,
Expand Down
6 changes: 2 additions & 4 deletions tests/lib/rules/no-dynamic-require.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

"use strict";

const RuleTester = require("eslint").RuleTester;
const testRule = require("../../rule-tester");
const fixtures = require("../../fixtures");
const rule = require("../../../lib/rules/no-dynamic-require");

Expand All @@ -14,9 +14,7 @@ const ERROR = {
type: "CallExpression"
};

const ruleTester = new RuleTester();

ruleTester.run("no-dynamic-require", rule, {
testRule("no-dynamic-require", rule, {

valid: [
fixtures.AMD_REQUIRE,
Expand Down
6 changes: 2 additions & 4 deletions tests/lib/rules/no-function-define.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

"use strict";

const RuleTester = require("eslint").RuleTester;
const testRule = require("../../rule-tester");
const fixtures = require("../../fixtures");
const rule = require("../../../lib/rules/no-function-define");

Expand All @@ -14,9 +14,7 @@ const ERROR = {
type: "CallExpression"
};

const ruleTester = new RuleTester();

ruleTester.run("no-function-define", rule, {
testRule("no-function-define", rule, {

valid: [
fixtures.OBJECT_DEFINE,
Expand Down
6 changes: 2 additions & 4 deletions tests/lib/rules/no-invalid-define.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

"use strict";

const RuleTester = require("eslint").RuleTester;
const testRule = require("../../rule-tester");
const fixtures = require("../../fixtures");
const rule = require("../../../lib/rules/no-invalid-define");

Expand All @@ -14,9 +14,7 @@ const ERROR = {
type: "CallExpression"
};

const ruleTester = new RuleTester();

ruleTester.run("no-invalid-define", rule, {
testRule("no-invalid-define", rule, {

valid: [
fixtures.OBJECT_DEFINE,
Expand Down
6 changes: 2 additions & 4 deletions tests/lib/rules/no-invalid-require.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

"use strict";

const RuleTester = require("eslint").RuleTester;
const testRule = require("../../rule-tester");
const fixtures = require("../../fixtures");
const rule = require("../../../lib/rules/no-invalid-require");

Expand All @@ -14,9 +14,7 @@ const ERROR = {
type: "CallExpression"
};

const ruleTester = new RuleTester();

ruleTester.run("no-invalid-require", rule, {
testRule("no-invalid-require", rule, {

valid: [
fixtures.AMD_REQUIRE,
Expand Down
6 changes: 2 additions & 4 deletions tests/lib/rules/no-js-extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

"use strict";

const RuleTester = require("eslint").RuleTester;
const testRule = require("../../rule-tester");
const fixtures = require("../../fixtures");
const rule = require("../../../lib/rules/no-js-extension");

Expand All @@ -14,9 +14,7 @@ const ERROR = {
type: "Literal"
};

const ruleTester = new RuleTester();

ruleTester.run("no-js-extension", rule, {
testRule("no-js-extension", rule, {

valid: [
fixtures.BAD_REQUIRE_EMPTY,
Expand Down
6 changes: 2 additions & 4 deletions tests/lib/rules/no-multiple-define.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@

"use strict";

const RuleTester = require("eslint").RuleTester;
const testRule = require("../../rule-tester");
const fixtures = require("../../fixtures");
const rule = require("../../../lib/rules/no-multiple-define");

const ruleTester = new RuleTester();

ruleTester.run("no-multiple-define", rule, {
testRule("no-multiple-define", rule, {

valid: [
fixtures.OBJECT_DEFINE,
Expand Down
6 changes: 2 additions & 4 deletions tests/lib/rules/no-named-define.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

"use strict";

const RuleTester = require("eslint").RuleTester;
const testRule = require("../../rule-tester");
const fixtures = require("../../fixtures");
const rule = require("../../../lib/rules/no-named-define");

Expand All @@ -14,9 +14,7 @@ const ERROR = {
type: "CallExpression"
};

const ruleTester = new RuleTester();

ruleTester.run("no-named-define", rule, {
testRule("no-named-define", rule, {

valid: [
fixtures.OBJECT_DEFINE,
Expand Down
6 changes: 2 additions & 4 deletions tests/lib/rules/no-object-define.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

"use strict";

const RuleTester = require("eslint").RuleTester;
const testRule = require("../../rule-tester");
const fixtures = require("../../fixtures");
const rule = require("../../../lib/rules/no-object-define");

Expand All @@ -14,9 +14,7 @@ const ERROR = {
type: "CallExpression"
};

const ruleTester = new RuleTester();

ruleTester.run("no-object-define", rule, {
testRule("no-object-define", rule, {

valid: [
fixtures.FUNCTION_DEFINE,
Expand Down
6 changes: 2 additions & 4 deletions tests/lib/rules/no-require-tourl.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@

"use strict";

const RuleTester = require("eslint").RuleTester;
const testRule = require("../../rule-tester");
const util = require("util");
const fixtures = require("../../fixtures");
const rule = require("../../../lib/rules/no-require-tourl");

const MESSAGE = "Use of `require.%s` is not allowed.";

const ruleTester = new RuleTester();

ruleTester.run("no-require-tourl", rule, {
testRule("no-require-tourl", rule, {

valid: [
fixtures.AMD_REQUIRE_RELATIVE,
Expand Down
6 changes: 2 additions & 4 deletions tests/lib/rules/one-dependency-per-line.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

"use strict";

const RuleTester = require("eslint").RuleTester;
const testRule = require("../../rule-tester");
const fixtures = require("../../fixtures");
const rule = require("../../../lib/rules/one-dependency-per-line");

Expand All @@ -29,9 +29,7 @@ const NEVER_NAMES_ERROR = {
type: "CallExpression"
};

const ruleTester = new RuleTester();

ruleTester.run("one-dependency-per-line", rule, {
testRule("one-dependency-per-line", rule, {

valid: [

Expand Down
Loading

0 comments on commit 9bead61

Please sign in to comment.