-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
23965f2
commit bf7b8c9
Showing
16 changed files
with
208 additions
and
10 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
test/__fixtures__/patterns-special-characters/dots/[...with-square-brackets-and-dots].js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
foo( | ||
|
||
|
||
) |
4 changes: 4 additions & 0 deletions
4
test/__fixtures__/patterns-special-characters/square-brackets/[with-square-brackets].js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
foo( | ||
|
||
|
||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
'use strict'; |
1 change: 1 addition & 0 deletions
1
test/__fixtures__/patterns/directory/nested-directory/nested-directory-file.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
'use strict'; |
Empty file.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
'use strict'; |
1 change: 1 addition & 0 deletions
1
test/__fixtures__/patterns/other-directory/nested-directory/nested-directory-file.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
'use strict'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
'use strict'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
'use strict'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`exits with an informative message when there are no patterns provided (stderr) 1`] = ` | ||
" | ||
Expected at least one target file/dir/glob. | ||
" | ||
`; | ||
|
||
exports[`exits with an informative message when there are no patterns provided (stdout) 1`] = `""`; | ||
|
||
exports[`exits with an informative message when there are no patterns provided (write) 1`] = `[]`; | ||
|
||
exports[`multiple patterns (stderr) 1`] = `""`; | ||
|
||
exports[`multiple patterns (stdout) 1`] = ` | ||
"directory/file.js | ||
directory/nested-directory/nested-directory-file.js | ||
other-directory/file.js | ||
other-directory/nested-directory/nested-directory-file.js" | ||
`; | ||
|
||
exports[`multiple patterns (write) 1`] = `[]`; | ||
|
||
exports[`multiple patterns with a negated pattern (stderr) 1`] = `""`; | ||
|
||
exports[`multiple patterns with a negated pattern (stdout) 1`] = ` | ||
"directory/file.js | ||
other-directory/file.js | ||
other-regular-modules.js | ||
regular-module.js" | ||
`; | ||
|
||
exports[`multiple patterns with a negated pattern (write) 1`] = `[]`; | ||
|
||
exports[`multiple patterns with a negated pattern and leading \`./\`, ignores node_modules by default (stderr) 1`] = `""`; | ||
|
||
exports[`multiple patterns with a negated pattern and leading \`./\`, ignores node_modules by default (stdout) 1`] = ` | ||
"other-directory/file.js | ||
other-directory/nested-directory/nested-directory-file.js | ||
other-regular-modules.js | ||
regular-module.js" | ||
`; | ||
|
||
exports[`multiple patterns with a negated pattern and leading \`./\`, ignores node_modules by default (write) 1`] = `[]`; | ||
|
||
exports[`multiple patterns with a negated pattern, doesn't ignore node_modules with the --with-node-modules flag (stderr) 1`] = `""`; | ||
|
||
exports[`multiple patterns with a negated pattern, doesn't ignore node_modules with the --with-node-modules flag (stdout) 1`] = ` | ||
"node_modules/node-module.js | ||
other-directory/file.js | ||
other-directory/nested-directory/nested-directory-file.js | ||
other-regular-modules.js | ||
regular-module.js" | ||
`; | ||
|
||
exports[`multiple patterns with a negated pattern, doesn't ignore node_modules with the --with-node-modules flag (write) 1`] = `[]`; | ||
|
||
exports[`multiple patterns with a negated pattern, ignores node_modules by default (stderr) 1`] = `""`; | ||
|
||
exports[`multiple patterns with a negated pattern, ignores node_modules by default (stdout) 1`] = ` | ||
"other-directory/file.js | ||
other-directory/nested-directory/nested-directory-file.js | ||
other-regular-modules.js | ||
regular-module.js" | ||
`; | ||
|
||
exports[`multiple patterns with a negated pattern, ignores node_modules by default (write) 1`] = `[]`; | ||
|
||
exports[`multiple patterns with an extra non-existent pattern (stderr) 1`] = `""`; | ||
|
||
exports[`multiple patterns with an extra non-existent pattern (stdout) 1`] = ` | ||
"directory/file.js | ||
directory/nested-directory/nested-directory-file.js" | ||
`; | ||
|
||
exports[`multiple patterns with an extra non-existent pattern (write) 1`] = `[]`; | ||
|
||
exports[`multiple patterns, throws an error and exits with a non-zero code when there are no matches (stderr) 1`] = `"[error] No files matching the given patterns were found."`; | ||
|
||
exports[`multiple patterns, throws an error and exits with a non-zero code when there are no matches (stdout) 1`] = `""`; | ||
|
||
exports[`multiple patterns, throws an error and exits with a non-zero code when there are no matches (write) 1`] = `[]`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import { runCli } from "../utils"; | ||
|
||
describe("multiple patterns", () => { | ||
runCli("patterns", [ | ||
"directory/**/*.js", | ||
"other-directory/**/*.js", | ||
"-l,", | ||
]).test({ | ||
status: 1, | ||
}); | ||
}); | ||
|
||
describe("multiple patterns with an extra non-existent pattern", () => { | ||
runCli("patterns", [ | ||
"directory/**/*.js", | ||
"non-existent.js", | ||
"-l", | ||
]).test({ | ||
status: 1, | ||
}); | ||
}); | ||
|
||
describe("multiple patterns with a negated pattern", () => { | ||
runCli("patterns", [ | ||
"**/*.js", | ||
"!**/nested-directory/**", | ||
"-l", | ||
]).test({ | ||
status: 1, | ||
}); | ||
}); | ||
|
||
describe("multiple patterns with a negated pattern, ignores node_modules by default", () => { | ||
runCli("patterns", [ | ||
"**/*.js", | ||
"!directory/**", | ||
"-l", | ||
]).test({ | ||
status: 1, | ||
}); | ||
}); | ||
|
||
// TODO: Handle leading `./` and `../` in patterns. | ||
describe.skip("multiple patterns with a negated pattern and leading `./`, ignores node_modules by default", () => { | ||
runCli("patterns", [ | ||
"./**/*.js", | ||
"!./directory/**", | ||
"-l", | ||
]).test({ | ||
status: 1, | ||
}); | ||
}); | ||
|
||
describe("multiple patterns with a negated pattern, doesn't ignore node_modules with the --with-node-modules flag", () => { | ||
runCli("patterns", [ | ||
"**/*.js", | ||
"!directory/**", | ||
"-l", | ||
"--with-node-modules", | ||
]).test({ | ||
status: 1, | ||
}); | ||
}); | ||
|
||
describe("exits with an informative message when there are no patterns provided", () => { | ||
runCli("patterns").test({ | ||
status: 1, | ||
}); | ||
}); | ||
|
||
describe("multiple patterns, throws an error and exits with a non-zero code when there are no matches", () => { | ||
runCli("patterns", [ | ||
"non-existent.js", | ||
"other-non-existent.js", | ||
"-l", | ||
]).test({ | ||
status: 1, | ||
}); | ||
}); | ||
|
||
describe("file names with special characters", () => { | ||
runCli("patterns-special-characters/square-brackets", [ | ||
"[with-square-brackets].js", | ||
"-l", | ||
]).test({ | ||
status: 1, | ||
write: [], | ||
stderr: "", | ||
stdout: "[with-square-brackets].js", | ||
}); | ||
|
||
runCli("patterns-special-characters/dots", [ | ||
"[...with-square-brackets-and-dots].js", | ||
"-l", | ||
]).test({ | ||
status: 1, | ||
write: [], | ||
stderr: "", | ||
stdout: "[...with-square-brackets-and-dots].js", | ||
}); | ||
}); |