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

WARN [web-server]: 404: from jspm packages

Open troymclure1 opened this issue 7 years ago • 0 comments

Hi There,

I receiving errors when I try to run my karma tests with karma-systemjs. The error is: WARN [web-server]: 404: /base/jspm_packages/npm/[email protected]. Do I need to use a shim for this, if so, is there a sample that works?

Any help is appreciated.

My package json

{ "jspm": { "dependencies": { "@angular/common": "npm:@angular/common@^2.1.2", "@angular/compiler": "npm:@angular/compiler@^2.1.2", "@angular/core": "npm:@angular/core@^2.1.2", "@angular/forms": "npm:@angular/forms@^2.1.2", "@angular/http": "npm:@angular/http@^2.1.2", "@angular/material": "npm:@angular/material@^2.0.0-alpha.9-3", "@angular/platform-browser": "npm:@angular/platform-browser@^2.1.2", "@angular/platform-browser-dynamic": "npm:@angular/platform-browser-dynamic@^2.1.2", "@angular/router": "npm:@angular/router@^3.1.2", "crypto": "github:jspm/nodelibs-crypto@^0.1.0", "css": "github:systemjs/plugin-css@^0.1.32", "reflect-metadata": "npm:reflect-metadata@^0.1.3", "rxjs": "npm:[email protected]", "text": "github:systemjs/plugin-text@^0.0.9", "ts": "github:frankwallis/plugin-typescript@^2.0.17", "zone.js": "npm:zone.js@^0.6.16" }, "devDependencies": { "typescript": "npm:typescript@^2.0.10" } }, "devDependencies": { "@types/es6-shim": "^0.31.32", "@types/hammerjs": "^2.0.33", "@types/jasmine": "^2.5.38", "es6-shim": "^0.35.1", "jasmine": "^2.5.2", "jasmine-core": "^2.5.2", "jspm": "^0.16.48", "karma": "^1.3.0", "karma-chrome-launcher": "^2.0.0", "karma-coverage": "^1.1.1", "karma-jasmine": "^1.0.2", "karma-jspm": "^2.2.0", "karma-mocha-reporter": "^2.2.1", "karma-phantomjs-launcher": "^1.0.2", "karma-systemjs": "^0.15.0", "karma-typescript": "^2.1.3", "phantomjs": "^2.1.7", "phantomjs-polyfill": "0.0.2", "typescript": "^2.0.7" }, "dependencies": { "angular2-polyfill": "0.0.32" } }

  • karma conf

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

    // base path that will be used to resolve all patterns (eg. files, exclude)
    basePath: '.',

    // frameworks to use
    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
    frameworks: ['systemjs', 'jasmine'],

    plugins: [
        'karma-chrome-launcher',
        'karma-jasmine',
        'karma-systemjs'
    ],

    systemjs: {
        configFile: 'config.js',
        config: {
            paths: {
                "typescript": "node_modules/typescript/lib/typescript.js",
                "systemjs": "node_modules/systemjs/dist/system.js",
                'system-polyfills': 'node_modules/systemjs/dist/system-polyfills.js',
                'es6-module-loader': 'node_modules/es6-module-loader/dist/es6-module-loader.js'
            },
            packages: {
                'test': {
                    defaultExtension: 'ts'
                },
                'app': {
                    defaultExtension: 'ts'
                }
            },
            transpiler: 'typescript'
        },
        serveFiles: [
            'app/**/*.ts'
        ]
    },

    // list of files / patterns to load in the browser
    files: [
        'test/home.component.spec.ts'
    ],

   // proxies : { "/app" : "/app", "/jspm_packages" : "/jspm_packages" },

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


    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {

    },

    // 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_INFO,


    // 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: true
});

};

-- system config

System.config({ baseURL: ".", // baseURL: (typeof karma !== "undefined") ? "base" : "/" defaultJSExtensions: true, transpiler: "typescript", strictImportSequence: true, typescriptOptions: { "module": "commonjs", "emitDecoratorMetadata": true, "tsconfig": true }, paths: { "npm:": "jspm_packages/npm/", "github:": "jspm_packages/github/" },

packages: { "app": { "main": "main", "defaultExtension": "ts" } },

troymclure1 avatar Nov 22 '16 05:11 troymclure1