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

Failure to find module using example app #55

Closed
joejag opened this issue Nov 24, 2014 · 2 comments
Closed

Failure to find module using example app #55

joejag opened this issue Nov 24, 2014 · 2 comments

Comments

@joejag
Copy link

joejag commented Nov 24, 2014

I'm using the current version (9545169) of this repo to test using Karma with Browserify.

When I run the example app with "npm test" I get a failure to find a module. I originally received the same error in my personal project and thought I'd try the example app to make sure my environment was sane.

Here is the output


> [email protected] test /Users/joe/dev/play/karma-browserify/example
> node_modules/karma/bin/karma start

DEBUG [plugin]: Loading karma-* from /Users/joe/dev/play/karma-browserify/example/node_modules
DEBUG [plugin]: Loading plugin /Users/joe/dev/play/karma-browserify/example/node_modules/karma-browserify.
DEBUG [plugin]: Loading plugin /Users/joe/dev/play/karma-browserify/example/node_modules/karma-chrome-launcher.
DEBUG [plugin]: Loading plugin /Users/joe/dev/play/karma-browserify/example/node_modules/karma-jasmine.
DEBUG [plugin]: Loading plugin /Users/joe/dev/play/karma-browserify/example/node_modules/karma-phantomjs-launcher.
DEBUG [framework.browserify]: created browserify bundle: /var/folders/99/490t3s6x7r573sb3d1grb1_c0000gn/T/652a5c663eb0ac2b3e30ad5c86d7ccbaefc6819f.browserify
DEBUG [framework.browserify]: add bundle to config.files at position 3
WARN [karma]: Port 9876 in use
INFO [karma]: Karma v0.12.25 server started at http://localhost:9877/
INFO [launcher]:  Starting browser PhantomJS
DEBUG [temp-dir]: Creating temp dir at /var/folders/99/490t3s6x7r573sb3d1grb1_c0000gn/T/karma-21387361
DEBUG [launcher]: /Users/joe/dev/play/karma-browserify/example/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/bin/phantomjs /var/folders/99/490t3s6x7r573sb3d1grb1_c0000gn/T/karma-21387361/capture.js
DEBUG [framework.browserify]: building bundle
DEBUG [framework.browserify]: adding lib/a.js to bundle
DEBUG [framework.browserify]: adding test/bSpec.js to bundle
DEBUG [framework.browserify]: adding test/externalSpec.js to bundle
DEBUG [framework.browserify]: adding test/failingSpec.js to bundle
DEBUG [framework.browserify]: bundling
INFO [framework.browserify]: 5424 bytes written (0.34 seconds)
INFO [framework.browserify]: bundle built
DEBUG [watcher]: Resolved files:
    /Users/joe/dev/play/karma-browserify/example/node_modules/karma-jasmine/lib/jasmine.js
    /Users/joe/dev/play/karma-browserify/example/node_modules/karma-jasmine/lib/adapter.js
    /Users/joe/dev/play/karma-browserify/example/vendor/external.js
    /var/folders/99/490t3s6x7r573sb3d1grb1_c0000gn/T/652a5c663eb0ac2b3e30ad5c86d7ccbaefc6819f.browserify
    /Users/joe/dev/play/karma-browserify/example/lib/a.js
    /Users/joe/dev/play/karma-browserify/example/test/bSpec.js
    /Users/joe/dev/play/karma-browserify/example/test/externalSpec.js
    /Users/joe/dev/play/karma-browserify/example/test/failingSpec.js
DEBUG [web-server]: serving: /Users/joe/dev/play/karma-browserify/example/node_modules/karma/static/client.html
DEBUG [web-server]: serving: /Users/joe/dev/play/karma-browserify/example/node_modules/karma/static/karma.js
DEBUG [web-server]: upgrade /socket.io/1/websocket/pNUrWMbdmDhKqkdp570o
DEBUG [karma]: A browser has connected on socket pNUrWMbdmDhKqkdp570o
INFO [PhantomJS 1.9.8 (Mac OS X)]: Connected on socket pNUrWMbdmDhKqkdp570o with id 21387361
DEBUG [launcher]: PhantomJS (id 21387361) captured in 2.112 secs
DEBUG [web-server]: serving: /Users/joe/dev/play/karma-browserify/example/node_modules/karma/static/context.html
DEBUG [web-server]: serving (cached): /Users/joe/dev/play/karma-browserify/example/node_modules/karma-jasmine/lib/jasmine.js
DEBUG [web-server]: serving (cached): /Users/joe/dev/play/karma-browserify/example/node_modules/karma-jasmine/lib/adapter.js
DEBUG [web-server]: serving (cached): /Users/joe/dev/play/karma-browserify/example/test/failingSpec.js
DEBUG [web-server]: serving (cached): /Users/joe/dev/play/karma-browserify/example/test/externalSpec.js
DEBUG [web-server]: serving (cached): /Users/joe/dev/play/karma-browserify/example/vendor/external.js
DEBUG [web-server]: serving (cached): /var/folders/99/490t3s6x7r573sb3d1grb1_c0000gn/T/652a5c663eb0ac2b3e30ad5c86d7ccbaefc6819f.browserify
DEBUG [web-server]: serving (cached): /Users/joe/dev/play/karma-browserify/example/lib/a.js
DEBUG [web-server]: serving (cached): /Users/joe/dev/play/karma-browserify/example/test/bSpec.js
PhantomJS 1.9.8 (Mac OS X) ERROR
  Error: Cannot find module '/Users/joe/dev/play/karma-browserify/example/lib/a.js'
  at /var/folders/99/490t3s6x7r573sb3d1grb1_c0000gn/T/652a5c663eb0ac2b3e30ad5c86d7ccbaefc6819f.browserify:1:0 <- node_modules/karma-browserify/node_modules/browserify/node_modules/browser-pack/_prelude.js:1:0
PhantomJS 1.9.8 (Mac OS X): Executed 0 of 0� ERROR� (0.029 secs / 0 secs)
DEBUG [karma]: Run complete, exiting.
DEBUG [launcher]: Disconnecting all browsers
DEBUG [framework.browserify]: �[39mcleaning up
DEBUG [launcher]: Process PhantomJS exited with code 0
DEBUG [temp-dir]: Cleaning temp dir /var/folders/99/490t3s6x7r573sb3d1grb1_c0000gn/T/karma-21387361

Inside the /Users/joe/dev/play/karma-browserify/example/lib/a.js we just have

module.exports = 'A'

If I remove the reference to a.js in the files section of the Karma conf then it works fine.

@joejag
Copy link
Author

joejag commented Nov 24, 2014

Very quick!

I didn't delete the lib reference from preProcessors locally. But I tested that now, and it still works.

Thanks.

@bendrucker
Copy link
Collaborator

You got it! preprocessors is a noop if there's no matching file in files. You're welcome to read through the chain of linked issues starting with #52 but for now the correct config is to only include "entry" files (tests).

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

2 participants