nikku/karma-browserify

Error: Cannot find module

sgen opened this issue · 2 comments

sgen commented

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

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

Cf. example project.

sgen commented

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?