因果没有运行测试。已执行0,共0个错误

时间:2018-07-31 17:15:46

标签: karma-jasmine karma-runner

我正在尝试进行业力测试,但是每次运行业力时,我都会遇到相同的错误:

  

$ karma start karma.conf.js-单运行

     

31 07 2018 12:56:48.134:INFO [karma]:Karma v1.7.1服务器从http://0.0.0.0:9876/启动

     

31 07 2018 12:56:48.138:INFO [启动器]:启动浏览器Chrome,具有无限的并发性

     

31 07 2018 12:56:48.144:INFO [启动器]:启动浏览器Chrome

     

31 07 2018 12:56:49.890:INFO [Chrome 67.0.3396(Windows 10.0.0)]:连接到ID为14298953的套接字2we1ypnXUlTXv5IRAAAA上

     

Chrome 67.0.3396(Windows 10.0.0):执行了0的0错误(0.006秒/ 0秒)

我(主要是)自动生成的karma.conf.js  位于测试之上的一级位置:C:\ Users \ king \ Desktop \ _REPOS \ inventivangular \ src

// Karma configuration
// Generated on Tue Jul 31 2018 12:30:22 GMT-0400 (Eastern Daylight Time)

module.exports = function(config) {
  config.set({

    // base path that will be used to resolve all patterns (eg. files, exclude)
    basePath: 'C:/Users/king/Desktop/_REPOS/inventivangular/src/',


    // frameworks to use
    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
    frameworks: ['jasmine'],


    // list of files / patterns to load in the browser
    files: [
      './app/*.component.ts',
      './app/*spec.ts'
    ],


    // list of files to exclude
    exclude: [
    ],


    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {
    },


    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: ['progress'],


    // web server port
    port: 9876,


    // enable / disable colors in the output (reporters and logs)
    colors: true,


    // level of logging
    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
    logLevel: config.LOG_INFO,


    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: true,


    // start these browsers
    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
    browsers: ['Chrome'],


    // Continuous Integration mode
    // if true, Karma captures browsers, runs the tests and exits
    singleRun: false,

    // Concurrency level
    // how many browser should be started simultaneous
    concurrency: Infinity
  })
}

要测试的文件的文件路径: C:\ Users \ king \ Desktop \ _REPOS \ inventivangular \ src \ app

enter image description here

1 个答案:

答案 0 :(得分:1)

ng test开始运行C:\Users\king\Desktop\_REPOS\inventivangular结束,它生成了自己的karma.conf.js,一切正常。

如果您使用的是自动生成的测试,则可能需要:

import { HttpClientTestingModule } from '@angular/common/http/testing' 

imports: [HttpClientTestingModule]