-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Fix message if no files found #3650
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
db722d0
error and exit, dont warn
craigtaub 96c3b15
return after error dont exit yet
craigtaub c4651cb
remove superflous message
craigtaub 54bfedd
update glob tests
craigtaub 964f363
update message
craigtaub afc429e
use errors only if no tests found
craigtaub 475d81c
dont use error symbol.
craigtaub 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
Next
Next commit
error and exit, dont warn
- Loading branch information
commit db722d0c6df02914e946254b2393a71d1c8a932c
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,26 +28,21 @@ describe('globbing', function() { | |
expect( | ||
results.stderr, | ||
'to contain', | ||
'cannot find any files matching pattern "./*-none.js"' | ||
'✖ Cannot find any files matching pattern "./*-none.js"' | ||
); | ||
}, | ||
done | ||
); | ||
}); | ||
|
||
it('should handle both matching and non-matching patterns in the same command', function(done) { | ||
testGlob.shouldSucceed( | ||
testGlob.shouldFail( | ||
'./*.js ./*-none.js', | ||
function(results) { | ||
expect( | ||
results.stdout, | ||
'to contain', | ||
'["end",{"suites":1,"tests":1,"passes":1,"pending":0,"failures":0,' | ||
); | ||
expect( | ||
results.stderr, | ||
'to contain', | ||
'cannot find any files matching pattern' | ||
'✖ Cannot find any files matching pattern' | ||
); | ||
}, | ||
done | ||
|
@@ -77,26 +72,21 @@ describe('globbing', function() { | |
expect( | ||
results.stderr, | ||
'to contain', | ||
'cannot find any files matching pattern' | ||
'✖ Cannot find any files matching pattern "./*-none.js"' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same |
||
); | ||
}, | ||
done | ||
); | ||
}); | ||
|
||
it('should handle both matching and non-matching patterns in the same command', function(done) { | ||
testGlob.shouldSucceed( | ||
testGlob.shouldFail( | ||
'"./*.js" "./*-none.js"', | ||
function(results) { | ||
expect( | ||
results.stdout, | ||
'to contain', | ||
'["end",{"suites":1,"tests":1,"passes":1,"pending":0,"failures":0,' | ||
); | ||
expect( | ||
results.stderr, | ||
'to contain', | ||
'cannot find any files matching pattern' | ||
'✖ Cannot find any files matching pattern' | ||
); | ||
}, | ||
done | ||
|
@@ -125,26 +115,21 @@ describe('globbing', function() { | |
expect( | ||
results.stderr, | ||
'to contain', | ||
'cannot find any files matching pattern' | ||
'✖ Cannot find any files matching pattern "./**/*-none.js"' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same |
||
); | ||
}, | ||
done | ||
); | ||
}); | ||
|
||
it('should handle both matching and non-matching patterns in the same command', function(done) { | ||
testGlob.shouldSucceed( | ||
testGlob.shouldFail( | ||
'"./**/*.js" "./**/*-none.js"', | ||
function(results) { | ||
expect( | ||
results.stdout, | ||
'to contain', | ||
'["end",{"suites":2,"tests":2,"passes":2,"pending":0,"failures":0,' | ||
); | ||
expect( | ||
results.stderr, | ||
'to contain', | ||
'cannot find any files matching pattern' | ||
'✖ Cannot find any files matching pattern' | ||
); | ||
}, | ||
done | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you pull in the symbol from
log-symbols
? this may fail on windowsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or just leave it and the pattern out...
'Cannot find any files matching pattern'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like idea including symbol as could erroneously fall into warning block if just pattern matching the message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Continuing with that thought, confusing to use the same message as both error and warning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I actually think listing the errors is better, from the users perspective it's more helpful and easier to see the mistake that way. I've used it myself during his pr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if user gives 20 globs and none exist, one message per is somehow more informative than just saying "none found"? I disagree.
For warnings, fine -- but not when none exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @craigtaub stated, it was useful information, so if some subset of the paths are not found, it seems reasonable to list them (but not if all of them are not found).
FWIW, a user can avoid this problem altogether by using shell expansion, but that's not portable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a subset don't exist, those would be warnings -- stated I had no problem with that.
Just the
files.length === 0
error case.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok i think its clear you both feel the single error message is better than multiple error messages. For debugging purposes I found the multiple one better, the initial idea of using an error was to indicate nothing did run, but perhaps its not clear enough.