-
-
Notifications
You must be signed in to change notification settings - Fork 10
Migrate patterns.js tests
#20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
ff4b4fc
Migrate the fixtures
pralkarz 5773b3b
Migrate some tests
pralkarz 1bd8f0a
Modify a test case to match the new behavior
pralkarz 3e5ac86
Change the behavior to indicate failure when there are no patterns
pralkarz 411660e
Change the behavior to indicate failure when there are no patterns
pralkarz e6ed52c
Merge 'origin/patterns-tests' into 'patterns-tests'
pralkarz 9bcd6ef
Update `tiny-readdir-glob` to `^1.23.0`
pralkarz 6456fd5
Check the remaining tests
pralkarz fb7470b
Update `specialist`
pralkarz 8dd2619
Add newlines
pralkarz 4d458d8
Handle leading `./` in both positive and negative glob patterns
pralkarz e630bf4
Clean up the test case names
pralkarz 3717b9d
Merge 'upstream/main' into 'patterns-tests'
pralkarz 6ef119e
Add the missing fixture
pralkarz 5862c3c
Skip handling leading dot-slashes for now
pralkarz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,65 @@ | ||
| 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", | ||
| }); | ||
| }); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.