Skip to content

Commit

Permalink
Chore: Test fixes for CascadingConfigArrayFactory (#17)
Browse files Browse the repository at this point in the history
* Chore: Fix ConfigArrayFactory tests

* Make more tests pass

* Chore: Fix CascadingConfigArrayFactory tests

* Fix more tests

* sync with main branch

* More test fixes

* cleanup tests

* Enable testing all files

* Hopefully last test fixes

* Single out failing CI test

* Add debugging

* Add debugging

* Revert

* Add missing fixture files

* Fix npm test command

* Update tests/lib/cascading-config-array-factory.js

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>

* Remove teardowns completely

* Update package.json

Co-authored-by: Brandon Mills <btmills@users.noreply.github.com>

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
Co-authored-by: Brandon Mills <btmills@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 17, 2020
1 parent 4440df8 commit f30bb49
Show file tree
Hide file tree
Showing 192 changed files with 3,801 additions and 160 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ bower_components
build/Release

# Dependency directories
node_modules/
/node_modules/
jspm_packages/

# TypeScript v1 declaration files
Expand Down
2 changes: 1 addition & 1 deletion lib/config-array/ignore-pattern.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
const assert = require("assert");
const path = require("path");
const ignore = require("ignore");
const debug = require("debug")("eslint:ignore-pattern");
const debug = require("debug")("eslintrc:ignore-pattern");

/** @typedef {ReturnType<import("ignore").default>} Ignore */

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"scripts": {
"lint": "eslint .",
"test": "mocha -R progress -c tests/lib/shared tests/lib/config-array tests/lib/shared tests/lib/config-array-factory.js",
"test": "mocha -R progress -c 'tests/lib/**/*.js'",
"generate-release": "eslint-generate-release",
"generate-alpharelease": "eslint-generate-prerelease alpha",
"generate-betarelease": "eslint-generate-prerelease beta",
Expand Down
2 changes: 2 additions & 0 deletions tests/fixtures/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Prevent tests from going above this directory
root: true
12 changes: 12 additions & 0 deletions tests/fixtures/config-extends/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "./subdir/.eslintrc",

"rules": {
"quotes": [2, "double"],
"valid-jsdoc": 0
},

"env": {
"browser": false
}
}
14 changes: 14 additions & 0 deletions tests/fixtures/config-extends/array/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": [
".eslintrc1",
".eslintrc2"
],

"rules": {
"no-empty": 1
},

"env": {
"browser": false
}
}
12 changes: 12 additions & 0 deletions tests/fixtures/config-extends/array/.eslintrc1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"rules": {
"comma-dangle": 1,
"no-console": 2,
"no-empty": 2
},

"env": {
"browser": true,
"node": true
}
}
9 changes: 9 additions & 0 deletions tests/fixtures/config-extends/array/.eslintrc2
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"rules": {
"comma-dangle": 2
},

"env": {
"es6": true
}
}
11 changes: 11 additions & 0 deletions tests/fixtures/config-extends/deep.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"rules": {
"yoda": 2
},

"env": {
"browser": true
},

"extends": "./subdir/subsubdir/deeper.json"
}
3 changes: 3 additions & 0 deletions tests/fixtures/config-extends/error.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "./non-existant.json"
}
12 changes: 12 additions & 0 deletions tests/fixtures/config-extends/js/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "./foo.js",

"rules": {
"quotes": [2, "double"],
"valid-jsdoc": 0
},

"env": {
"browser": false
}
}
7 changes: 7 additions & 0 deletions tests/fixtures/config-extends/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "test",
"version": "0.1.1",
"eslintConfig": {
"extends": "./subdir/.eslintrc"
}
}
12 changes: 12 additions & 0 deletions tests/fixtures/config-extends/package/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "eslint-config-foo",

"rules": {
"quotes": [2, "double"],
"valid-jsdoc": 0
},

"env": {
"browser": false
}
}
12 changes: 12 additions & 0 deletions tests/fixtures/config-extends/package2/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "foo",

"rules": {
"quotes": [2, "double"],
"valid-jsdoc": 0
},

"env": {
"browser": false
}
}
1 change: 1 addition & 0 deletions tests/fixtures/config-extends/package2/subdir/foo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var a = 1;
12 changes: 12 additions & 0 deletions tests/fixtures/config-extends/package3/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "foo/bar",

"rules": {
"quotes": [2, "double"],
"valid-jsdoc": 0
},

"env": {
"browser": false
}
}
12 changes: 12 additions & 0 deletions tests/fixtures/config-extends/package4/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "bar-eslint-config-foo",

"rules": {
"quotes": [2, "double"],
"valid-jsdoc": 0
},

"env": {
"browser": false
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "a"
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions tests/fixtures/config-extends/scoped-package/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "@scope/eslint-config-foo",

"rules": {
"quotes": [2, "double"],
"valid-jsdoc": 0
},

"env": {
"browser": false
}
}
12 changes: 12 additions & 0 deletions tests/fixtures/config-extends/scoped-package2/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "@scope/foo",

"rules": {
"quotes": [2, "double"],
"valid-jsdoc": 0
},

"env": {
"browser": false
}
}
12 changes: 12 additions & 0 deletions tests/fixtures/config-extends/scoped-package3/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "@scope/foo/bar",

"rules": {
"quotes": [2, "double"],
"valid-jsdoc": 0
},

"env": {
"browser": false
}
}
1 change: 1 addition & 0 deletions tests/fixtures/config-extends/scoped-package3/foo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var a = 1;
12 changes: 12 additions & 0 deletions tests/fixtures/config-extends/scoped-package4/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "@scope/eslint-config",

"rules": {
"quotes": [2, "double"],
"valid-jsdoc": 0
},

"env": {
"browser": false
}
}
12 changes: 12 additions & 0 deletions tests/fixtures/config-extends/scoped-package5/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "@scope/",

"rules": {
"quotes": [2, "double"],
"valid-jsdoc": 0
},

"env": {
"browser": false
}
}
12 changes: 12 additions & 0 deletions tests/fixtures/config-extends/scoped-package6/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "@scope",

"rules": {
"quotes": [2, "double"],
"valid-jsdoc": 0
},

"env": {
"browser": false
}
}
12 changes: 12 additions & 0 deletions tests/fixtures/config-extends/scoped-package7/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "@scope/eslint-configfoo",

"rules": {
"quotes": [2, "double"],
"valid-jsdoc": 0
},

"env": {
"browser": false
}
}
12 changes: 12 additions & 0 deletions tests/fixtures/config-extends/scoped-package8/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "@scope/bar-eslint-config-foo",

"rules": {
"quotes": [2, "double"],
"valid-jsdoc": 0
},

"env": {
"browser": false
}
}
12 changes: 12 additions & 0 deletions tests/fixtures/config-extends/scoped-package9/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "@scope/eslint-config/foo",

"rules": {
"quotes": [2, "double"],
"valid-jsdoc": 0
},

"env": {
"browser": false
}
}
10 changes: 10 additions & 0 deletions tests/fixtures/config-extends/subdir/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"rules": {
"quotes": [1, "single"],
"yoda": 2
},

"env": {
"browser": true
}
}
11 changes: 11 additions & 0 deletions tests/fixtures/config-extends/subdir/subsubdir/deeper.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"rules": {
"semi": 2
},

"env": {
"browser": false
},

"extends": "./subsubsubdir/deepest.json"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"rules": {
"semi": 1,
"valid-jsdoc": 0
},

"env": {
"browser": true
}
}
5 changes: 5 additions & 0 deletions tests/fixtures/config-file/bom/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"rules": {
"semi": "error"
}
}
2 changes: 2 additions & 0 deletions tests/fixtures/config-file/bom/.eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
rules:
semi: error
10 changes: 10 additions & 0 deletions tests/fixtures/config-file/bom/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"private": true,
"name": "eslint-test",
"version": "0.0.0",
"eslintConfig": {
"rules": {
"semi": "error"
}
}
}
6 changes: 6 additions & 0 deletions tests/fixtures/config-file/broken-package-json/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"eslintConfig": {
"env": {
"es6": true
}
}
5 changes: 5 additions & 0 deletions tests/fixtures/config-file/cjs/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
rules: {
semi: [2, "always"]
}
};
1 change: 1 addition & 0 deletions tests/fixtures/config-file/ecma-features/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ecmaFeatures: {}
3 changes: 3 additions & 0 deletions tests/fixtures/config-file/extends-chain-2/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "a"
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f30bb49

Please sign in to comment.