我正在编写角度2单元测试(Karma),我在我的代码中使用PrimeNG库来处理一些角度2组件。我引用了库如下: {pattern:'dist / lib / primeng / primeng.js',包括:true,watched:true},
然后我得到了“需求未定义”的问题。
我安装了“browserify”,如下所示:here。
karma.conf.js
frameworks: ['jasmine', 'browserify'],
files: [
// paths loaded by Karma
{pattern: 'node_modules/systemjs/dist/system-polyfills.js', included: true, watched: true},
{pattern: 'node_modules/systemjs/dist/system.src.js', included: true, watched: true},
{pattern: 'node_modules/es6-shim/es6-shim.js', included: true, watched: true},
{pattern: 'node_modules/angular2/bundles/angular2-polyfills.js', included: true, watched: true},
{pattern: 'node_modules/rxjs/bundles/Rx.js', included: true, watched: true},
{pattern: 'node_modules/angular2/bundles/angular2.js', included: true, watched: true},
{pattern: 'node_modules/angular2/bundles/testing.dev.js', included: true, watched: true},
{pattern: 'node_modules/angular2/bundles/router.dev.js', included: true, watched: true},
{pattern: 'node_modules/ng2-translate/bundles/ng2-translate.js', included: true, watched: true},
{pattern: 'node_modules/angular2/bundles/http.dev.js', included: true, watched: true},
{pattern: 'node_modules/angular2/testing_internal/bundles/angular2.js', included: true, watched: true},
{pattern: 'dist/lib/primeng/primeng.js', included: true, watched: true},
...
preprocessors: {
'dist/**/!(*spec).js': ['coverage', 'browserify']
},
...
现在我收到错误: 未捕获错误:包错误(参见日志)85fde0323d1ffadfffe8f4c4080d0f13.browserify
我理解错误是因为我没有执行here提到的步骤,但即使这样做也行不通,我认为我没有全面了解。 每次安装东西或从存储库中取出时,我都不想手动构建捆绑包