templateUrlでコンポーネントをテストするときにこのエラーが発生しました。webpasck'testで間違っているのは不思議です。それは前進している!Angular2テスト: '未処理プロミスの拒否:'、 'strategyTables.htmlを読み込めませんでした'
エラー: '処理されていないプロミス拒否:'、 'strategyTables.htmlを読み込めませんでした'、 ';ゾーン: '、' ProxyZone '、';タスク: '、' Promise.then '、';値: ' 'strategyTables.htmlの読み込みに失敗しました'、未定義 ERROR:エラー{originalStack:' エラー:キャッチされない(約束では):strategyTables.html
//karma.config.js
// Karma configuration
var webpackConfig = require('./webpack.test');
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: ['jasmine'],
// list of files/patterns to load in the browser
files: [
{pattern: './karma-shim.js', watched: false}
],
// 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: {
'./karma-shim.js': ['webpack']
},
webpack: webpackConfig,
plugins:[
'karma-jasmine',
'karma-chrome-launcher',
require("karma-webpack")
],
proxies:{
//http://localhost:3000/#/pages/strategys/strategytables
"/app/": "base/src/app"
},
// 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: false,
// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity
})
}
//karma-shim,js
Error.stackTraceLimit = Infinity;
require('reflect-metadata');
require('zone.js/dist/zone');
require('zone.js/dist/proxy');
require('zone.js/dist/sync-test');
require('zone.js/dist/jasmine-patch');
require('zone.js/dist/async-test');
require('zone.js/dist/fake-async-test');
var appContext = require.context('./src',true,/\.spec\.ts/);
appContext.keys().forEach(appContext);
var testing = require('@angular/core/testing');
var testingBrowser = require('@angular/platform-browser-dynamic/testing');
testing.TestBed.initTestEnvironment(testingBrowser.
BrowserDynamicTestingModule,
testingBrowser.platformBrowserDynamicTesting());
//webpack.test.js
module.exports = {
devtool: 'cheap-module-eval-source-map',
resolve: {
extensions: ['.ts','.js']
},
entry: {
},
module: {
loaders: [
//��.ts��β���ļ�ʹ�� TypeScript loader
{test: /.ts$/,loader: 'awesome-typescript-loader'},
{
test:/\.html$/,
loader: 'html'
},
{
test:/\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/,
loader: 'null'
},
{
test:/\.css$/,
loader: 'null'
}
]
}
}
templateUrlに相対パスまたは絶対パスを使用していましたか?あなたがそれを修正した場合、私は問題が何であるか知りたいです。 – Winnemucca