karma-jspm icon indicating copy to clipboard operation
karma-jspm copied to clipboard

remove jspm dependency

Open jithinoj opened this issue 8 years ago • 1 comments

We have developed a single page application using aurelia+type script+jspm.Our purpose is remove the jspm packages from the project. We have using karma framework for unit testing. We have moved all files from"jspm_packages" folder to our custom folder named "jspm". The application is working properly. But now when we run the karma unit testing, it cause jspm packages having get 404 error is showing on the console

Our karma.config.js file is following

// Karma configuration

module.exports = function (config) { config.set({ basePath: './', baseURL: "/base/", // frameworks to use // available frameworks: https://npmjs.org/browse/keyword/karma-adapter frameworks: ['jspm', 'jasmine'],

    jspm: {          
        packages: "jspm",
        loadFiles: [

            'test/unit/*.spec.js',

        ],
        paths: {
            '*': '*.js',          
        }
    },

    // list of files to exclude
    exclude: [
        'jspm_packages'
    ],

    files: [
        //'jspm/system.js',
        // 'jspm/system-polyfills.js',

    ],

    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {
        'test/**/*.js': ['babel'],
        'src/**/*.js': ['babel']
    },
    'babelPreprocessor': {
        //options: {                
        //    sourceMap: 'inline',
        //    modules: 'system',
        //    moduleIds: false,
        //    optional: [
        //      "es7.decorators",
        //      "es7.classProperties"
        //    ]
        //}
        //,
        options: {
            // optional: ['runtime'],  // per http://babeljs.io/docs/usage/options/
            sourceMap: 'inline',
            moduleIds: false,
            modules: 'system',
            optional: [
              "runtime",
              "es7.decorators",
              "es7.classProperties"
            ]
        }
        //filename: function (file) {
        //    return file.originalPath.replace(/\.js$/, '.es7.js');
        //},
        //sourceFileName: function (file) {
        //    return file.originalPath;
        //}
    },
    proxies: {
        '/src/': '/base/src/',
        '/test/': '/base/test/',
        '/jspm_packages/': '/base/jspm_packages/',
        '/node_modules/': '/base/node_modules/'
    },
    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: ['progress'],


    // web server port
    port: 9876,


    // enable / disable colors in the output (reporters and logs)
    colors: true,


    // level of logging
    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
    logLevel: config.LOG_DEBUG,


    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: true,


    // start these browsers
    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
    browsers: ['Chrome'],


    // Continuous Integration mode
    // if true, Karma captures browsers, runs the tests and exits
    singleRun: false
});

};

and config.js file settings is foloowing

paths: { "": "src/", "github:": "jspm/github/", "npm:": "jspm/npm/",

jithinoj avatar Apr 19 '16 09:04 jithinoj

Try replace 'jspm_packages' ocorrencies for 'jspm' on proxies section

hoisel avatar Jun 29 '16 15:06 hoisel