nikku / karma-browserify

A fast Browserify integration for Karma that handles large projects with ease
MIT License
321 stars 50 forks source link

Error: Cannot find module #207

Closed sgen closed 7 years ago

sgen commented 7 years ago

Im getting the following error when trying to import my module for testing: Error: Cannot find module 'test-karma-browserify'. I get the same error whether I try to import my module by name or by relative path.

Here is a repro repo.

Any help you can offer is much appreciated!

nikku commented 7 years ago

Do not preprocess your sources, preprocess the test cases instead.

Cf. example project.

sgen commented 7 years ago

Swapping the index.js for test.js in the preprocessor section of the config fixed the original error, but also created a new error in the module file: Uncaught ReferenceError: module is not defined ab3f95.

Preprocessing both the module and test cases fixed the error: (5e8f55)[https://github.com/sgen/test-karma-browserify/commit/5e8f5593c8e3fafa640e4ebc654c0263914427f3].

Is that just a product of the exporting as well as importing?