以编程方式传递业力参数
Pass karma programmatically arguments
我正在将 karma 与 jasmine 和 jasmine-spec-tags 框架一起使用。从 CLI 启动 karma 时,我只使用 "karma start --tags=MY_TAG" 到 运行 一些带有标签 MY_TAG 的测试。这很好用。
现在,我需要以编程方式启动业力。我尝试了以下代码(注意末尾的 client.args
值):
const server = new Server(
{
autoWatch: true,
browsers: [
'Chrome',
],
files: [
'./node_modules/babel-polyfill/dist/polyfill.js',
'./node_modules/es6-shim/es6-shim.min.js',
'./karma/karma.entry.js'
],
frameworks: ['jasmine', 'jasmine-spec-tags'],
phantomJsLauncher: {
exitOnResourceError: true
},
port: 9876,
preprocessors: {
'./karma/karma.entry.js': ['webpack', 'sourcemap']
},
reporters: ['dots'],
singleRun: false,
webpack: webpackConf,
webpackServer: {
noInfo: true
},
client:
{
args: ['--tags=SchedulingApiService']
}
});
server.start();
这不起作用。我误解了 client.args
值吗?如果有任何帮助,我们会很高兴。
要解决此问题,client
部分必须如下所示:
client:
{
tags: 'SchedulingApiService'
}
我正在将 karma 与 jasmine 和 jasmine-spec-tags 框架一起使用。从 CLI 启动 karma 时,我只使用 "karma start --tags=MY_TAG" 到 运行 一些带有标签 MY_TAG 的测试。这很好用。
现在,我需要以编程方式启动业力。我尝试了以下代码(注意末尾的 client.args
值):
const server = new Server(
{
autoWatch: true,
browsers: [
'Chrome',
],
files: [
'./node_modules/babel-polyfill/dist/polyfill.js',
'./node_modules/es6-shim/es6-shim.min.js',
'./karma/karma.entry.js'
],
frameworks: ['jasmine', 'jasmine-spec-tags'],
phantomJsLauncher: {
exitOnResourceError: true
},
port: 9876,
preprocessors: {
'./karma/karma.entry.js': ['webpack', 'sourcemap']
},
reporters: ['dots'],
singleRun: false,
webpack: webpackConf,
webpackServer: {
noInfo: true
},
client:
{
args: ['--tags=SchedulingApiService']
}
});
server.start();
这不起作用。我误解了 client.args
值吗?如果有任何帮助,我们会很高兴。
要解决此问题,client
部分必须如下所示:
client:
{
tags: 'SchedulingApiService'
}