angular - ng test 不执行任何测试用例
问题描述
我正在使用 angular2 并希望实现 jasmine-karma 测试。当我运行 ng test 时,它运行没有错误,但不执行任何测试用例(说 0 执行了 0 个错误)。对 test.ts 文件发出警告,"C:/Users/T01192B/Applications/capital-markets-frm-insight-profile/src/test.ts" does not match any file.
它没有从路径中选择 test.ts。
尝试更改 karma.config.js 文件无效。
module.exports = function(config) {
config.set({
basePath: ' ',
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
},
files: [{
pattern: './src/test.ts',
watched: false
}],
preprocessors: {
'./src/test.ts': ['@angular/cli']
},
mime: {
'text/x-typescript': ['ts', 'tsx']
},
coverageIstanbulReporter: {
reports: ['html', 'lcovonly'],
fixWebpackSourcePaths: true
},
angularCli: {
environment: 'dev'
},
reporters: config.angularCli && config.angularCli.codeCoverage ?
['progress', 'coverage-istanbul'] :
['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
});
};
解决方案
推荐阅读
- ruby - 调用 `super` 的时机
- java - 在 Windows 机器中连接到 postgress 数据库时出现异常
- asp.net-mvc - 在 javascript 文件中使用时,asp.net 翻译功能会为非英文字符提供垃圾字母
- python - 我从安装requirement.txt 后尝试运行应用程序?
- r - 如何在csv文件中查找特定数据
- python - 如何在新环境中运行 spyder 3?
- javascript - Weblogic 服务器登录凭据传递到主页以重复使用
- c - 如何使用 C API 为创建的 .skp 文件设置图标?
- swift - 分解 Uint32 的数据字节缓冲区
- gradle - 父 gradle 文件中定义的任务未运行所有命令