angular-phone-cat アプリに似た Angular 1.5 アプリがあり、正常に動作します。ここで、単体テストを実装するときに、karma.conf ファイルに必要な適切なファイルをロードし、ノード サーバーをnpm start
で起動します。次に、ブラウザにアクセスhttp://localhost:8000
して、指定したディレクトリのディレクトリ構造を確認できますkarma.conf ですが、index.html ファイルを参照できません404 error
。
逆に、angular-phonecat
アプリで同じことを行うと、index.html
を参照するとファイルを表示できますhttp://localhost:8000
。
ここに私の karma.conf ファイルがあります:
//jshint strict: false
module.exports = function(config) {
config.set({
basePath: '',
files: [
'scripts/angular/angular.min.js',
'scripts/angular/angular-route.min.js',
'scripts/angular/angular-ui-router.min.js',
'app/weatherApp.js',
'app/weather-app/modules/weather/weatherModule.js',
'app/weather-app/modules/weather/weatherService.js',
'app/weather-app/modules/weather/weather-controller.js',
'app/weather-app/modules/weather/weatherService.spec.js'
],
autoWatch: true,
frameworks: ['jasmine'],
browsers: ['Chrome', 'Firefox'],
plugins: [
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-jasmine'
]
});
};