Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular ng测试命令出错(KARMA-JASMINE单元测试)_Angular_Unit Testing_Typescript_Angular Cli_Karma Jasmine - Fatal编程技术网

Angular ng测试命令出错(KARMA-JASMINE单元测试)

Angular ng测试命令出错(KARMA-JASMINE单元测试),angular,unit-testing,typescript,angular-cli,karma-jasmine,Angular,Unit Testing,Typescript,Angular Cli,Karma Jasmine,在我的应用程序中,我集成了Angular cli,因为它第一次不存在 我想用karma和jasmine测试我的应用程序 当我运行命令ng test时,我得到错误: package.json: 观察到的行为 期望行为 我想在浏览器上查看单元测试 由于这些错误,我无法测试 即使在StackOverflow上,我也没有发现任何与这些错误相关的内容 tsconfig.json karma.config.js @angular/cli: 1.1.0 node: 7.10.1 os: linux x64 @

在我的应用程序中,我集成了Angular cli,因为它第一次不存在

我想用karma和jasmine测试我的应用程序

当我运行命令
ng test
时,我得到错误:

package.json
: 观察到的行为 期望行为 我想在浏览器上查看单元测试

由于这些错误,我无法测试

即使在StackOverflow上,我也没有发现任何与这些错误相关的内容

tsconfig.json karma.config.js
@angular/cli: 1.1.0
node: 7.10.1
os: linux x64
@angular/animations: 4.4.6
@angular/common: 4.4.6
@angular/compiler: 4.4.6
@angular/core: 4.4.6
@angular/forms: 4.4.6
@angular/http: 4.4.6
@angular/platform-browser: 4.4.6
@angular/platform-browser-dynamic: 4.4.6
@angular/router: 4.4.6
@angular/service-worker: 1.0.0-beta.16
@angular/cli: 1.1.0
@angular/compiler-cli: 4.4.6
@angular/language-service: 4.4.6
@angular/platform-server: 4.4.6
ERROR in /repo/node_modules/@angular/core/src/di/reflective_provider.d.ts (87,123): Cannot find name 'Map'.

ERROR in /repo/node_modules/@angular/core/src/di/reflective_provider.d.ts (87,165): Cannot find name 'Map'.

ERROR in /repo/node_modules/rxjs/Observable.d.ts (58,60): 'Promise' only refers to a type, but is being used as a value here.

ERROR in /repo/node_modules/rxjs/Observable.d.ts (73,59): 'Promise' only refers to a type, but is being used as a value here.

ERROR in /repo/node_modules/@angular/core/src/change_detection/differs/iterable_differs.d.ts (15,48): Cannot find name 'Iterable'.

ERROR in /repo/node_modules/@angular/core/src/change_detection/differs/keyvalue_differs.d.ts (23,18): Cannot find name 'Map'.

ERROR in /repo/node_modules/@angular/core/src/change_detection/differs/default_iterable_differ.d.ts (28,32): Cannot find name 'Iterable'.

ERROR in /repo/node_modules/@angular/core/src/change_detection/differs/default_keyvalue_differ.d.ts (24,16): Cannot find name 'Map'.

ERROR in /repo/node_modules/@angular/core/src/change_detection/differs/default_keyvalue_differ.d.ts (32,16): Cannot find name 'Map'.

ERROR in /repo/src/client/app/iterm-extended/component/get-a-quote.component.ts (32,14): Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.
{
  "compilerOptions": {
    // "module": "es2015",
    "moduleResolution": "node",
    "target": "es5",
    "noImplicitAny": false,
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [
      "es2017",
      "dom"
    ],
    "typeRoots": [
      "node_modules/@types"
    ],
    "skipLibCheck": true
  },
  "include": [
    "src/client/**/*.ts"
  ],
  "exclude": [
    "node_modules",
    "src/client/main-prod.ts"
  ],
  "compileOnSave": false
}
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')
    ],
    files: [
      "src/client/test-cases/iterm-extended/**/*.spec.ts",
      { pattern: 'node_modules/**', included: false, watched: false },
      { pattern: 'src/client/app/iinvest/**', included: false, watched: false },
      { pattern: 'src/client/app/imax/**', included: false, watched: false },
      { pattern: 'src/client/app/iterm/**', included: false, watched: false },
      { pattern: 'src/client/app/itermPlus-extended/**', included: false, watched: false },
      { pattern: 'src/client/app/pages/**', included: false, watched: false },
      { pattern: 'src/client/app/shared/**', included: false, watched: false }
    ],
    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
  });
};