You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When none files match the pattern test/**/*.test.js, call mocha with --opts will throw Error: cannot resolve path (or pattern) 'test/**/*.test.js'. The pattern for glob is ok, even though its return files.length = 0. So I think this case should not be considered as an error.
The code in mocha is:
files = glob.sync(path);
if (!files.length) {
throw new Error("cannot resolve path (or pattern) '" + path + "'");
}
The text was updated successfully, but these errors were encountered:
@kiliwalk Thanks for the suggestion. Can you explain why this is problematic? It seems like reasonable behavior to me, and is exhibited by other test runners (if you would consider the mocha executable to be a "test runner").
I'm now creating a toolset to use mocha to test. When I tested it with none-match case, the throw error made me confused. I thought maybe my pattern was wrong format till I found the code.
I agree that throw error is reasonable as you said, but how about to change the error description? Like Cannot find any files to match the pattern + path, or something like this?
When none files match the pattern
test/**/*.test.js
, call mocha with--opts
will throwError: cannot resolve path (or pattern) 'test/**/*.test.js'
. The pattern for glob is ok, even though its return files.length = 0. So I think this case should not be considered as an error.The code in mocha is:
The text was updated successfully, but these errors were encountered: