-
-
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
Cannot find module 'tap', but tap isn't listed as a dependency #3092
Comments
try this:
you can figure out which dep depends on tap with that command |
Unless you didn't |
I also experienced this, and even though I couldn't find tap as a requirement anywhere, |
It's something I run into as well. I think that 's because you run a test from your node_modules. |
@nchevobbe You're right, that was it - thanks! |
thank you @nchevobbe! It made no sense until you came along :) |
@nchevobbe thanks brother you saved a day 😄 |
thanks Nicolas .. perfect solution |
It worked for me thanks |
thank you @nchevobbe |
For anyone who finds this like I did... TLDR: Overly aggressive My
which will find al My solution was to filter out
|
@nchevobbe just like magic it works! |
All your tests (e.g., "*.spec.js" and "*.test.js") should be in your "test" directory (or some subdirectory within). The Assuming this, the cmdline for recent versions of Mocha would be: # Using Babel 6...
$ NODE_ENV=test mocha --require babel-core/register 'test/**/*.js'
# Using Babel 7...
$ NODE_ENV=test mocha --require @babel/register 'test/**/*.js' |
One downside of that strategy is that it’s harder to visually verify that all files are tested at a glance. Putting test files right next to the files under test makes that easier. |
Meh, I don't find it difficult to have an editor window with two tabs showing both code and corresponding test in different directories. I usually organize mine like this: | -- myproj
|-- /lib
{source code}
|-- /test
|-- /unit
|-- /fixtures
|-- /e2e
|-- /fixtures But it's a rather trivial cmdline change to incorporate your style... $ NODE_ENV=test mocha --require @babel/register 'lib/**/*.spec.js' 'test/**/*.js' |
Description
On mocha 4.0.1 writing tests for backend node code. Upon running
npm run test
error is thrown saying 'tap' module can't be found. Upon checking dependencies, TAP isn't listedThe text was updated successfully, but these errors were encountered: