Skip to content

Commit

Permalink
Update: Refactor ESLintTester to fix dependency hell (fixes eslint#602)
Browse files Browse the repository at this point in the history
  • Loading branch information
nzakas committed May 21, 2014
1 parent d07665b commit 5110f36
Show file tree
Hide file tree
Showing 123 changed files with 361 additions and 162 deletions.
10 changes: 0 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,3 @@ node_js:
- "0.10"

script: "npm test && npm run perf"

before_install:
- npm link
- cd ..
- git clone git://github.com/eslint/eslint-tester.git
- cd eslint-tester
- npm link
- npm link eslint
- cd ../eslint
- npm link eslint-tester
31 changes: 0 additions & 31 deletions docs/developer-guide/development-environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,37 +22,6 @@ The global `eslint` will now point to the files in your development repository i

If you ever update from the central repository and there are errors, it might be because you are missing some dependencies. If that happens, just run `npm link` again to get the latest dependencies.

### Installing ESLintTester

[ESLintTester](https://github.com/eslint/eslint-tester) is an integration testing tool for ESLint. It is required for local development of ESLint, so you'll need to clone ESLintTester along with ESLint and do some magic linking. Here are the commands:

# Check out ESLint
git clone git://github.com/eslint/eslint.git

# Check out ESLintTester
git clone git://github.com/eslint/eslint-tester.git

# Link ESLint
cd eslint
npm link

# Link ESLintTester
cd ../eslint-tester
npm link

# Link ESLint into ESLintTester
npm link eslint

# Link ESLintTester into ESLint
cd ../eslint
npm link eslint-tester

That ensures ESLint is using your locally installed ESLintTester instead of the one from the public npm registry.

You'll end up needing to do this if you are making changes to ESLint core together with a rule that is using those changes.

**Note:** We recognize that this is a bit messy and problematic, and we are looking at improving this setup in the future.

## Build Scripts

ESLint has several build scripts that help with various parts of development.
Expand Down
4 changes: 3 additions & 1 deletion docs/developer-guide/working-with-rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,14 @@ The basic pattern for a rule unit test file is:
// Requirements
//------------------------------------------------------------------------------

var eslintTester = require("eslint-tester");
var eslint = require("../../../lib/eslint"),
ESLintTester = require("eslint-tester");

//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------

var eslintTester = new ESLintTester(eslint);
eslintTester.addRuleTest("lib/rules/block-scoped-var", {

// Examples of code that should not trigger the rule
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"browserify": "~3.20.0",
"mocha-phantomjs": "~3.3.1",
"phantomjs": "~1.9.2-6",
"eslint-tester": "latest",
"eslint-tester": "^0.1.0",
"brfs": "0.0.9",
"through": "~2.3.4",
"beefy": "~1.0.0",
Expand Down
4 changes: 3 additions & 1 deletion tests/lib/rules/block-scoped-var.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
// Requirements
//------------------------------------------------------------------------------

var eslintTester = require("eslint-tester");
var eslint = require("../../../lib/eslint"),
ESLintTester = require("eslint-tester");

//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------

var eslintTester = new ESLintTester(eslint);
eslintTester.addRuleTest("lib/rules/block-scoped-var", {
valid: [
"function f() { var a, b; { a = true; } b = a; }",
Expand Down
4 changes: 3 additions & 1 deletion tests/lib/rules/brace-style.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
// Requirements
//------------------------------------------------------------------------------

var eslintTester = require("eslint-tester");
var eslint = require("../../../lib/eslint"),
ESLintTester = require("eslint-tester");
var OPEN_MESSAGE = "Opening curly brace does not appear on the same line as controlling statement.",
BODY_MESSAGE = "Statement inside of curly braces should be on next line.",
CLOSE_MESSAGE = "Closing curly brace does not appear on the same line as the subsequent block.",
Expand All @@ -17,6 +18,7 @@ var OPEN_MESSAGE = "Opening curly brace does not appear on the same line as cont
// Tests
//------------------------------------------------------------------------------

var eslintTester = new ESLintTester(eslint);
eslintTester.addRuleTest("lib/rules/brace-style", {
valid: [
"function foo () { \nreturn; \n}",
Expand Down
4 changes: 3 additions & 1 deletion tests/lib/rules/camelcase.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
// Requirements
//------------------------------------------------------------------------------

var eslintTester = require("eslint-tester");
var eslint = require("../../../lib/eslint"),
ESLintTester = require("eslint-tester");

//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------

var eslintTester = new ESLintTester(eslint);
eslintTester.addRuleTest("lib/rules/camelcase", {
valid: [
"firstName = \"Nicholas\"",
Expand Down
4 changes: 3 additions & 1 deletion tests/lib/rules/complexity.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
// Requirements
//------------------------------------------------------------------------------

var eslintTester = require("eslint-tester");
var eslint = require("../../../lib/eslint"),
ESLintTester = require("eslint-tester");

//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------


var eslintTester = new ESLintTester(eslint);
eslintTester.addRuleTest("lib/rules/complexity", {
valid: [
{ code: "function a(x) {}", args: [1,1] },
Expand Down
4 changes: 3 additions & 1 deletion tests/lib/rules/consistent-return.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
var eslintTester = require("eslint-tester");
var eslint = require("../../../lib/eslint"),
ESLintTester = require("eslint-tester");

//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------

var eslintTester = new ESLintTester(eslint);
eslintTester.addRuleTest("lib/rules/consistent-return", {

valid: [
Expand Down
4 changes: 3 additions & 1 deletion tests/lib/rules/consistent-this.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
var eslintTester = require("eslint-tester");
var eslint = require("../../../lib/eslint"),
ESLintTester = require("eslint-tester");

//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------

var eslintTester = new ESLintTester(eslint);
eslintTester.addRuleTest("lib/rules/consistent-this", {
valid: [
{ code: "var foo = 42, self = this", args: [1, "self"] },
Expand Down
4 changes: 3 additions & 1 deletion tests/lib/rules/curly.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
// Requirements
//------------------------------------------------------------------------------

var eslintTester = require("eslint-tester");
var eslint = require("../../../lib/eslint"),
ESLintTester = require("eslint-tester");

//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------

var eslintTester = new ESLintTester(eslint);
eslintTester.addRuleTest("lib/rules/curly", {
valid: [
"if (foo) { bar() }",
Expand Down
4 changes: 3 additions & 1 deletion tests/lib/rules/default-case.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
// Requirements
//------------------------------------------------------------------------------

var eslintTester = require("eslint-tester");
var eslint = require("../../../lib/eslint"),
ESLintTester = require("eslint-tester");

//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------

var eslintTester = new ESLintTester(eslint);
eslintTester.addRuleTest("lib/rules/default-case", {

valid: [
Expand Down
4 changes: 3 additions & 1 deletion tests/lib/rules/dot-notation.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
// Requirements
//------------------------------------------------------------------------------

var eslintTester = require("eslint-tester");
var eslint = require("../../../lib/eslint"),
ESLintTester = require("eslint-tester");

//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------

var eslintTester = new ESLintTester(eslint);
eslintTester.addRuleTest("lib/rules/dot-notation", {
valid: [
"a.b;",
Expand Down
4 changes: 3 additions & 1 deletion tests/lib/rules/eqeqeq.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
// Requirements
//------------------------------------------------------------------------------

var eslintTester = require("eslint-tester");
var eslint = require("../../../lib/eslint"),
ESLintTester = require("eslint-tester");

//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------

var eslintTester = new ESLintTester(eslint);
eslintTester.addRuleTest("lib/rules/eqeqeq", {
valid: [
"a === b",
Expand Down
4 changes: 3 additions & 1 deletion tests/lib/rules/func-names.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
// Requirements
//------------------------------------------------------------------------------

var eslintTester = require("eslint-tester");
var eslint = require("../../../lib/eslint"),
ESLintTester = require("eslint-tester");

//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------

var eslintTester = new ESLintTester(eslint);
eslintTester.addRuleTest("lib/rules/func-names", {
valid: [
"Foo.prototype.bar = function bar(){};",
Expand Down
4 changes: 3 additions & 1 deletion tests/lib/rules/func-style.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
// Requirements
//------------------------------------------------------------------------------

var eslintTester = require("eslint-tester");
var eslint = require("../../../lib/eslint"),
ESLintTester = require("eslint-tester");

//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------

var eslintTester = new ESLintTester(eslint);
eslintTester.addRuleTest("lib/rules/func-style", {
valid: [
{
Expand Down
4 changes: 3 additions & 1 deletion tests/lib/rules/guard-for-in.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
// Requirements
//------------------------------------------------------------------------------

var eslintTester = require("eslint-tester");
var eslint = require("../../../lib/eslint"),
ESLintTester = require("eslint-tester");

//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------

var eslintTester = new ESLintTester(eslint);
eslintTester.addRuleTest("lib/rules/guard-for-in", {
valid: [
"for (var x in o) {}",
Expand Down
4 changes: 3 additions & 1 deletion tests/lib/rules/handle-callback-err.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
// Requirements
//------------------------------------------------------------------------------

var eslintTester = require("eslint-tester");
var eslint = require("../../../lib/eslint"),
ESLintTester = require("eslint-tester");

//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------

var eslintTester = new ESLintTester(eslint);
eslintTester.addRuleTest("lib/rules/handle-callback-err", {
valid: [
"function test(error) {}",
Expand Down
4 changes: 3 additions & 1 deletion tests/lib/rules/max-depth.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
// Requirements
//------------------------------------------------------------------------------

var eslintTester = require("eslint-tester");
var eslint = require("../../../lib/eslint"),
ESLintTester = require("eslint-tester");

//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------

var eslintTester = new ESLintTester(eslint);
eslintTester.addRuleTest("lib/rules/max-depth", {
valid: [
{ code: "function foo() { if (true) { if (false) { if (true) { } } } }", args: [1, 3] },
Expand Down
4 changes: 3 additions & 1 deletion tests/lib/rules/max-len.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
var eslintTester = require("eslint-tester");
var eslint = require("../../../lib/eslint"),
ESLintTester = require("eslint-tester");

//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------

var eslintTester = new ESLintTester(eslint);
eslintTester.addRuleTest("lib/rules/max-len", {
valid: [
{
Expand Down
4 changes: 3 additions & 1 deletion tests/lib/rules/max-nested-callbacks.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
// Requirements
//------------------------------------------------------------------------------

var eslintTester = require("eslint-tester");
var eslint = require("../../../lib/eslint"),
ESLintTester = require("eslint-tester");

//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------

var eslintTester = new ESLintTester(eslint);
eslintTester.addRuleTest("lib/rules/max-nested-callbacks", {
valid: [
{ code: "foo(function () { bar(thing, function (data) {}); });", args: [1, 3] },
Expand Down
4 changes: 3 additions & 1 deletion tests/lib/rules/max-params.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
// Requirements
//------------------------------------------------------------------------------

var eslintTester = require("eslint-tester");
var eslint = require("../../../lib/eslint"),
ESLintTester = require("eslint-tester");

//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------

var eslintTester = new ESLintTester(eslint);
eslintTester.addRuleTest("lib/rules/max-params", {
valid: [
"function test(d, e, f) {}",
Expand Down
4 changes: 3 additions & 1 deletion tests/lib/rules/max-statements.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
// Requirements
//------------------------------------------------------------------------------

var eslintTester = require("eslint-tester");
var eslint = require("../../../lib/eslint"),
ESLintTester = require("eslint-tester");

//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------

var eslintTester = new ESLintTester(eslint);
eslintTester.addRuleTest("lib/rules/max-statements", {
valid: [
{ code: "var foo = { thing: function() { var bar = 1; var baz = 2; } }", args: [1, 2] },
Expand Down
4 changes: 3 additions & 1 deletion tests/lib/rules/new-cap.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
// Requirements
//------------------------------------------------------------------------------

var eslintTester = require("eslint-tester");
var eslint = require("../../../lib/eslint"),
ESLintTester = require("eslint-tester");

//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------

var eslintTester = new ESLintTester(eslint);
eslintTester.addRuleTest("lib/rules/new-cap", {
valid: [
"var x = new Constructor();",
Expand Down
Loading

0 comments on commit 5110f36

Please sign in to comment.