Re: Karma fails with 404 on /base/config.js

1,733 views
Skip to first unread message

Vojta Jína

unread,
Oct 18, 2013, 1:05:54 AM10/18/13
to karma...@googlegroups.com
Maybe require.js is trying to fetch that file, but I've never seen that before.

V.


On Mon, Oct 14, 2013 at 12:23 PM, David Karr <davidmic...@gmail.com> wrote:
My current Karma prototype is failing with the following:
WARN [web-server]: 404: /base/config.js
Chrome 30.0.1599 (Windows 7) ERROR
        Uncaught Error: Script error for: config
        at .../AppData/Roaming/npm/node_modules/karma-requirejs/lib/
require.js:138

I don't have a "config.js" in my app, so this must be part of the framework.  I see that there is a "./node_modules/karma/lib/config.js" in my npm tree.

Here is my current "karma.conf.js":
module.exports = function(config) {
  config
.set({
    basePath
: '../../../..',
    frameworks
: ['jasmine', 'requirejs'],
    files
: [
           
"src/test/webapp/js/test-main.js",
           
{pattern: "src/main/content/jcr_root/media/**/*.js", included: false},
           
{pattern: "src/test/webapp/js/*.test.js", included: false}
           
],
    plugins
:[
             
'karma-jasmine',
             
'karma-requirejs',
             
'karma-coverage',
             
'karma-junit-reporter',
             
'karma-phantomjs-launcher',
             
'karma-chrome-launcher',
             
'karma-firefox-launcher',
             
'karma-ie-launcher'
             
],
    preprocessors
: {
   
"src/main/content/jcr_root/media/**/*.js": 'coverage'
   
},
    coverageReporter
: {
    type
: "lcov",
    dir
: "target/karma-coverage"
   
},
    junitReporter
: {
    outputFile
: 'target/surefire-reports/TEST-karma.xml'
   
},
    reporters
: ['dots', 'junit'],
    port
: 9876,
    colors
: true,
    logLevel
: config.LOG_INFO,
    autoWatch
: true,
    browsers
: ['Chrome'],
    captureTimeout
: 60000,
    singleRun
: false
 
});
};



And here is my "test-main.js":
var tests = [];
for (var file in window.__karma__.files) {
 
if (window.__karma__.files.hasOwnProperty(file)) {
 
if (/\.test\.js$/.test(file)) {
        tests
.push(file);
 
}
   
}
}
requirejs.config({
 baseUrl
: '/base',
 paths
: {
 
'jQuery': 'src/main/content/jcr_root/media/cms/shop/scripts/jquery-1.5.2',
 
'COMP': 'src/main/content/jcr_root/media/cms/mobile/scripts/common/COMP.main',
 
'COMP.util': 'src/main/content/jcr_root/media/cms/mobile/scripts/common/COMP.util'
 
},
 shim
: {
 
'COMP': {
 deps
: ['jQuery']
 
},
 
'COMP.util': {
 deps
: ['COMP']
 
}
 
},
 deps
: tests,
 callback
: window.__karma__.start
});


Any ideas would be appreciated.

--
You received this message because you are subscribed to the Google Groups "karma-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to karma-users...@googlegroups.com.
To post to this group, send email to karma...@googlegroups.com.
Visit this group at http://groups.google.com/group/karma-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/karma-users/19851fa2-4d11-4a8e-9d16-52505ee6c8fa%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages