Sur*_*esh 6 karma-runner angular
我的示例Angular应用中有两个规格文件。规范文件的名称为
src/app/app.component.spec.ts&src/app/app.component-two.spec.ts。我只想运行file中的测试src/app/app.component.spec.ts。因此,我在文件中添加了另一个文件作为排除karma.conf.js文件(粘贴在下面),但仍然执行exclude选项中提到的测试。任何帮助是极大的赞赏。
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
exclude: [
'src/app/app.component-two.spec.ts'
],
frameworks: ['jasmine', '@angular/cli'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular/cli/plugins/karma')
],
client:{
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
reports: [ 'html', 'lcovonly' ],
fixWebpackSourcePaths: true
},
angularCli: {
environment: 'dev'
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
});
};
Run Code Online (Sandbox Code Playgroud)
您可以排除以下文件中的文件tsconfig.spec.json:
{
"extends": "../tsconfig.json",
"compilerOptions": { ... },
"files": [
"test.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
],
"exclude": [
"app/app.component-two.spec.ts" <------------------
]
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2896 次 |
| 最近记录: |