nikku / karma-browserify

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

ERROR [framework.browserify]: Error: Cannot find module #211

Closed krnbatta closed 6 years ago

krnbatta commented 7 years ago

When i run tests via karma, i get ERROR [framework.browserify]: Error: Cannot find module for all the files in js folder. Here is the structure of my app. app/js/**/*.js, app/tests/**/*.js, app/karma.conf.js

Following is my karma.conf.js file:

module.exports = function(config) {
    config.set({

        basePath: '',
        frameworks: ['browserify', 'jasmine'],
        browsers: ['Chrome'],
        files: [
            'js/**/*.js',
            'tests/**/*.js'
        ],

        exclude: [],

        preprocessors: {
            'js/**/*.js': ['browserify'],
            'tests/**/*.js': ['browserify']
        },

        browserify: {
            debug: true,
            transform: ['babelify']
        },
    });
};

In js folder, where i have code, i have used import statements using relative paths. Eg.: import Store from '../../services/store'; import template from './template';

nikku commented 6 years ago

Don't include source files as part of the files configuration.

Mifrill commented 5 years ago

Hello, @krnbatta. Did you solve your problem? I've got the same error with ember config, perhaps your solution would be partly-helpful for me. Thanks