Skip to content
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

Feature request: better error reporting when mocha can't find tests (getting started) #2194

Closed
richburdon opened this issue Apr 8, 2016 · 4 comments

Comments

@richburdon
Copy link

The getting started tutorial on the home page looks pretty simple, but if you put the test in a different directory than "test" it's suddenly not very friendly:

/usr/local/lib/node_modules/mocha/lib/utils.js:628
throw new Error("cannot resolve path (or pattern) '" + path + "'");
^

Error: cannot resolve path (or pattern) 'test'
at Object.lookupFiles (/usr/local/lib/node_modules/mocha/lib/utils.js:628:15)
at /usr/local/lib/node_modules/mocha/bin/_mocha:326:30
at Array.forEach (native)
at Object. (/usr/local/lib/node_modules/mocha/bin/_mocha:325:6)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Function.Module.runMain (module.js:447:10)
at startup (node.js:142:18)
at node.js:939:3

@govind999
Copy link

I am also getting the same error, any update on this?

@gurdiga
Copy link

gurdiga commented Aug 18, 2016

Purely theoretically speaking, this doesn’t look like an exception, and we could handle it gracefully — I’m guessing just print an explanatory message to STDERR, and exit Node with non-zero status. 🤔

What do you guys think? 🤓

@jsynowiec
Copy link

jsynowiec commented Aug 20, 2016

If several globs are provided (for e.g. with braced sections), mocha shouldn't exit with non-zero code or throw an error util all paths are checked for tests. Currently if I run mocha with a glob like {client,server}/*[sS]pec.js even if there are tests present in the second directory, mocha throws an error.

@Munter
Copy link
Member

Munter commented Aug 21, 2016

How about this take on it? #2450

Munter added a commit that referenced this issue Sep 17, 2016
boneskull pushed a commit that referenced this issue Sep 18, 2016
* Report non-matching patterns to STDERR and exit with non-zero status if no files are matched at all. Fixes #2194

* Code review changes
sgilroy pushed a commit to TwineHealth/mocha that referenced this issue Feb 27, 2019
…2450)

* Report non-matching patterns to STDERR and exit with non-zero status if no files are matched at all. Fixes mochajs#2194

* Code review changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants