node.js - Karma Test Runner RequireJS 404 error, not serving up content -


getting 404 error app.js file though exists @ url says doesn't (served karma). idea , how solve? >.> going insane.

can't resolve app file

debug [web-server]: serving: /users/tina/sites/node_require/client/src/app.js debug [web-server]: serving: /users/tina/sites/node_require/client/src/views/add.js warn [web-server]: 404: /base/client/src/app 

my directory structure:

   karma.conf.js    bower_components/    client/       src/           -app.js           -main.js        spec/           -app.test.js           -test.main.js           views/              -add.test.js 

my karma.conf.js:

// karma configuration // generated on mon apr 13 2015 19:36:01 gmt-0400 (edt)  module.exports = function(config) {   config.set({      // base path, used resolve files , exclude     basepath:'',       // frameworks use     frameworks: ['jasmine', 'requirejs'],       // list of files / patterns load in browser     files: [       //'build/tests.js',       //{pattern: 'build/tests.js', included: false},       'client/spec/test-main.js',        {pattern: 'client/src/**/*.js', included: false},       {pattern: 'client/spec/**/*.test.js', included: false},       {pattern: 'bower_components/underscore/underscore.js', included: false},       {pattern: 'bower_components/jquery/jquery.js', included: false},       {pattern: 'bower_components/backbone/backbone.js', included: false},       {pattern: 'bower_components/backbone.marionette/lib/backbone.marionette.js', included: false},       {pattern: 'bower_components/requirejs-text/text.js', included: false},       {pattern: 'bower_components/handlebars/handlebars.runtime.js', included: false},       {pattern: 'bower_components/handlebars/handlebars.js', included: false},       {pattern: 'bower_components/requirejs-handlebars/hb.js', included: false},       ],       // list of files exclude     exclude: [     'client/src/main.js'     ],       // test results reporter use     // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'     reporters: ['progress'],       // web server port     port: 9876,       // enable / disable colors in output (reporters , 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 , executing tests whenever file changes     autowatch: true,       // start these browsers, available:     // - chrome     // - chromecanary     // - firefox     // - opera (has installed `npm install karma-opera-launcher`)     // - safari (only mac; has installed `npm install karma-safari-launcher`)     // - phantomjs     // - ie (only windows; has installed `npm install karma-ie-launcher`)     browsers: ['phantomjs'],       // if browser not capture in given timeout [ms], kill     capturetimeout: 60000,       // continuous integration mode     // if true, capture browsers, run tests , exit     singlerun: false   }); }; 

my test-main.js:

var tests = []; (var file in window.__karma__.files) {     if (/.test\.js$/.test(file)) {         tests.push(file);     } }  requirejs.config({     // karma serves files '/base'     baseurl: '/base/client/src/',     shim: {     jquery: {       exports: '$'     },     underscore: {       exports: '_'     },     backbone: {       deps: [         'jquery',         'underscore'       ],       exports: 'backbone'     },     marionette: {       deps: [         'jquery',         'underscore',         'backbone'       ],       exports: 'marionette'     },     bootstrap: {       deps: [         'jquery'       ]     },     'handlebars.runtime': {         exports: 'handlebars.runtime'     },     handlebars: {         deps: ['handlebars.runtime']     },   },   paths: {     backbone: '../../bower_components/backbone/backbone',     marionette: '../../bower_components/backbone.marionette/lib/backbone.marionette',     jquery: '../../bower_components/jquery/jquery',     underscore: '../../bower_components/underscore/underscore',     text: '../../bower_components/requirejs-text/text',     'handlebars.runtime': '../../bower_components/handlebars/handlebars.runtime',     handlebars: '../../bower_components/handlebars/handlebars',     hb: '../../bower_components/requirejs-handlebars/hb',   },       // ask require.js load these files (all our tests)     deps: tests,      // start test run, once require.js done     callback: window.__karma__.start }); 

app.test.js ( 'app' module here never resolves)

define([     'app',      'marionette', ], function (app, marionette) {     'use strict';      describe('app', function() {         var app = new app();         it('should have start function', function() {             expect(app.start).tobedefined();         });     .... 

debug log:

info [launcher]: starting browser phantomjs debug [launcher]: creating temp dir @ /var/folders/lz/rp48gjr977n5bq684cbydpcw0000gn/t/karma-16204309 debug [launcher]: /users/tina/sites/node_require/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/bin/phantomjs /var/folders/lz/rp48gjr977n5bq684cbydpcw0000gn/t/karma-16204309/capture.js debug [watcher]: excluded file "/users/tina/sites/node_require/client/src/main.js" debug [watcher]: resolved files:     /users/tina/sites/node_require/node_modules/requirejs/require.js     /users/tina/sites/node_require/node_modules/karma-requirejs/lib/adapter.js     /users/tina/sites/node_require/node_modules/karma-jasmine/lib/jasmine.js     /users/tina/sites/node_require/node_modules/karma-jasmine/lib/adapter.js     /users/tina/sites/node_require/client/spec/test-main.js     /users/tina/sites/node_require/client/src/app.js     /users/tina/sites/node_require/client/src/collections/contacts.js     /users/tina/sites/node_require/client/src/controller.js     /users/tina/sites/node_require/client/src/models/contact.js     /users/tina/sites/node_require/client/src/router.js     /users/tina/sites/node_require/client/src/views/add.js     /users/tina/sites/node_require/client/src/views/contact_details.js     /users/tina/sites/node_require/client/src/views/contacts.js     /users/tina/sites/node_require/client/spec/app.test.js     /users/tina/sites/node_require/client/spec/views/add.test.js     /users/tina/sites/node_require/bower_components/underscore/underscore.js     /users/tina/sites/node_require/bower_components/jquery/jquery.js     /users/tina/sites/node_require/bower_components/backbone/backbone.js     /users/tina/sites/node_require/bower_components/backbone.marionette/lib/backbone.marionette.js     /users/tina/sites/node_require/bower_components/requirejs-text/text.js     /users/tina/sites/node_require/bower_components/handlebars/handlebars.runtime.js     /users/tina/sites/node_require/bower_components/handlebars/handlebars.js     /users/tina/sites/node_require/bower_components/requirejs-handlebars/hb.js debug [web-server]: serving: /users/tina/sites/node_require/node_modules/karma/static/client.html debug [web-server]: serving: /users/tina/sites/node_require/node_modules/karma/static/karma.js debug [karma]: browser has connected on socket bl_al5kedvicyzohgjv7 info [phantomjs 1.9.8 (mac os x)]: connected on socket bl_al5kedvicyzohgjv7 debug [karma]: browsers ready, executing debug [web-server]: serving: /users/tina/sites/node_require/node_modules/karma/static/context.html debug [web-server]: serving: /users/tina/sites/node_require/node_modules/requirejs/require.js debug [web-server]: serving: /users/tina/sites/node_require/node_modules/karma-requirejs/lib/adapter.js debug [web-server]: serving: /users/tina/sites/node_require/node_modules/karma-jasmine/lib/adapter.js debug [web-server]: serving: /users/tina/sites/node_require/node_modules/karma-jasmine/lib/jasmine.js debug [web-server]: serving: /users/tina/sites/node_require/client/spec/test-main.js debug [web-server]: serving: /users/tina/sites/node_require/client/spec/app.test.js debug [web-server]: serving: /users/tina/sites/node_require/client/spec/views/add.test.js debug [web-server]: serving: /users/tina/sites/node_require/client/src/app.js debug [web-server]: serving: /users/tina/sites/node_require/client/src/views/add.js warn [web-server]: 404: /base/client/src/app error: 'there no timestamp /base/client/src/app!' phantomjs 1.9.8 (mac os x): executed 0 of 0 success (0 secs / 0 secs) debug [web-server]: serving: /users/tina/sites/node_require/client/src/collections/contacts.js debug [web-server]: serving: /users/tina/sites/node_require/client/src/models/cophantomjs 1.9.8 (mac os x) error     error: script error for: /base/client/src/app     http://requirejs.org/docs/errors.html#scripterror     @ /users/tina/sites/node_require/node_modules/requirejs/require.js:141 phantomjs 1.9.8 (mac os x): executed 0 of 0 error (0 secs / 0 secs) debug [web-server]: serving: /users/tina/sites/node_require/bower_components/reqphantomjs 1.9.8 (mac os x): executed 0 of 0 error (0.04 secs / 0 secs) debug [launcher]: disconnecting browsers debug [launcher]: killing phantomjs debug [web-server]: serving: /users/tina/sites/node_require/bower_components/jquery/jquery.js debug [launcher]: process phantomjs exitted code 0 debug [launcher]: cleaning temp dir /var/folders/lz/rp48gjr977n5bq684cbydpcw0000gn/t/karma-16204309 warning: task "karma:test" failed. use --force continue. 

the error due me forgetting include templates directory in conf file, necessary views/add.test.js file run correctly. fixed it:

  {pattern: 'client/templates/*.hbs', included: false}, 

it seems when dependencies unresolved in test file propagates 404: /base/client/src/app error


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -