Implement glob ignores (#272)

* Add Glob wrapper type with better serialization

* Introduce PathIgnoreRule struct

* Implement equality for Glob type

* Add PathIgnoreRule to InstanceContext

* Implement glob ignores in directory middleware

* Fix up filters

* Use Iterator::all instead of loop

* Add project-level configuration for glob ignores

* Add test project for glob ignores

* Wire up project file and snapshots to make glob ignores work

* Better codepaths for adding ignore rules with empty iterators

* Add test for globs inherited from parent projects

* Add test details, support glob ignores in nested projects

* Add feature flag for globs

* Switch to use ExactSizeIterator instead of size_hint

* Remove glob visitor
This commit is contained in:
Lucien Greathouse
2020-01-08 17:58:37 -08:00
committed by GitHub
parent ae811aafd0
commit e261e7a2c7
30 changed files with 310 additions and 11 deletions

View File

@@ -0,0 +1,2 @@
# ignore_glob_inner
Tests that glob ignores defined *inside* nested projects apply to those projects, but not anywhere else.

View File

@@ -0,0 +1,14 @@
{
"name": "ignore_glob_inner",
"tree": {
"$className": "Folder",
"src": {
"$path": "src"
},
"subproject": {
"$path": "subproject"
}
}
}

View File

@@ -0,0 +1 @@
-- This file should be included.

View File

@@ -0,0 +1,9 @@
{
"name": "subproject",
"tree": {
"$path": "src"
},
"globIgnorePaths": [
"**/*.spec.lua"
]
}

View File

@@ -0,0 +1 @@
-- This file should be included.

View File

@@ -0,0 +1 @@
-- This file should not be included.

View File

@@ -0,0 +1,2 @@
# ignore_glob_nested
Tests that glob ignores defined in the root project also apply to nested projects.

View File

@@ -0,0 +1,9 @@
{
"name": "ignore_glob_nested",
"tree": {
"$path": "subproject"
},
"globIgnorePaths": [
"**/*.spec.lua"
]
}

View File

@@ -0,0 +1,6 @@
{
"name": "subproject",
"tree": {
"$path": "src"
}
}

View File

@@ -0,0 +1 @@
-- This file must not be present.

View File

@@ -0,0 +1 @@
-- This file must be present.

View File

@@ -0,0 +1,2 @@
# ignore_glob_spec
Tests that glob ignores work for the original use case: ignoring files in the same project that end in `.spec.lua`.

View File

@@ -0,0 +1,9 @@
{
"name": "ignore_glob_spec",
"tree": {
"$path": "src"
},
"globIgnorePaths": [
"**/*.spec.lua"
]
}

View File

@@ -0,0 +1 @@
-- this file should be present

View File

@@ -0,0 +1 @@
-- this file should not be present