我有一个在以下环境中运行的应用程序:
我的大多数课程都包含在主app.module.ts
文件declarations
和entryComponents
中,该文件位于./src/app/app.module.ts
。我最近为位于./src/second/second.module.ts
的类添加了位于./src/second/pages/**/page.ts
的新模块。使用命令npm run test
时,失败并显示
> my-test@0.0.1 test /Users/me/proj/proj-repo
> karma start ./test-config/karma.conf.js
webpack: wait until bundle finished:
11 03 2019 10:03:06.579:ERROR [karma]: { inspect: [Function: inspect] }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-test@0.0.1 test: `karma start ./test-config/karma.conf.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-test@0.0.1 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
这是我的karma.conf.js
文件:
var webpackConfig = require('./webpack.test.js');
process.env.CHROME_BIN = require("puppeteer").executablePath();
module.exports = function(config) {
var _config = {
basePath: '../',
frameworks: ['jasmine'],
files: [
{
pattern: './test-config/karma-test-shim.js',
watched: true
},
{
pattern: './src/assets/**/*',
watched: false,
included: false,
served: true,
nocache: false
}
],
proxies: {
'/assets/': '/base/src/assets/'
},
preprocessors: {
'./test-config/karma-test-shim.js': ['webpack', 'sourcemap']
},
webpack: webpackConfig,
webpackMiddleware: {
stats: 'errors-only'
},
webpackServer: {
noInfo: true
},
browserConsoleLogOptions: {
level: 'log',
format: '%b %T: %m',
terminal: true
},
jasmineNodeOpts : {
defaultTimeoutInterval: 20000
},
coverageIstanbulReporter: {
reports: [ 'html', 'lcovonly', 'cobertura' ],
fixWebpackSourcePaths: true
},
reporters: config.coverage ? ['kjhtml', 'dots', 'coverage-istanbul', 'junit', 'progress'] : ['kjhtml', 'dots'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
concurrency: 1,
//browsers: ['PhantomJS'],
captureTimeout: 600000,
browserDisconnectTolerance: 3,
browserDisconnectTimeout : 600000,
browserNoActivityTimeout : 600000,
browsers: ['ChromeHeadless'],
singleRun: false,
junitReporter: {
outputDir: 'coverage',
useBrowserName: false
}
};
config.set(_config);
};
关于如何使这些测试运行的任何见解都将是很棒的!让我知道是否需要提供更多信息。