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 我需要使用什么设置来确保Jenkins自动运行我的单元测试?_Angular_Unit Testing_Jenkins_Continuous Integration - Fatal编程技术网

Angular 我需要使用什么设置来确保Jenkins自动运行我的单元测试?

Angular 我需要使用什么设置来确保Jenkins自动运行我的单元测试?,angular,unit-testing,jenkins,continuous-integration,Angular,Unit Testing,Jenkins,Continuous Integration,我正在申请Angular 7,我有大约50个测试。这些在我的机器上传递。 我的目标是确保我的应用程序的最新版本得到构建,并在Jenkins上运行测试 我认为Jenkins服务器是在linux上运行的。 我正在使用以下命令执行测试: npm install ng test --watch=false --code-coverage 我在karma.conf.js文件中尝试了多种不同的设置。 我目前试图在jenkins服务器上使用phantomJS。 这是我的karma.conf.js: modu

我正在申请Angular 7,我有大约50个测试。这些在我的机器上传递。 我的目标是确保我的应用程序的最新版本得到构建,并在Jenkins上运行测试

我认为Jenkins服务器是在linux上运行的。 我正在使用以下命令执行测试:

npm install
ng test --watch=false --code-coverage
我在karma.conf.js文件中尝试了多种不同的设置。 我目前试图在jenkins服务器上使用phantomJS。 这是我的karma.conf.js:

module.exports = function (config) {
  config.set({
    basePath: '',
    frameworks: ['jasmine', '@angular-devkit/build-angular'],
    plugins: [
      require('karma-jasmine'),
      require('karma-chrome-launcher'),
      require('karma-phantomjs-launcher'),
      require('karma-jasmine-html-reporter'),
      require('karma-coverage-istanbul-reporter'),
      require('@angular-devkit/build-angular/plugins/karma')
    ],
    client: {
      clearContext: false 
    },
    coverageIstanbulReporter: {
      dir: require('path').join(__dirname, '../coverage'),
      reports: ['html', 'lcovonly'],
      fixWebpackSourcePaths: true
    },
    reporters: ['progress', 'kjhtml'],
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: ['PhantomJS'],
    singleRun: false
  });
};
我还在devdependences中添加了karma phantomjslauncher

"karma-phantomjs-launcher": "^1.0.4",
我从Jenkins获得以下控制台输出:

PhantomJS 2.1.1 (Linux 0.0.0) ERROR
  {
    "message": "TypeError: undefined is not a function (evaluating 'new Array(type.length).fill(undefined)')\nat 
http://localhost:9876/_karma_webpack_/vendor.js:60532:43",
    "str": "TypeError: undefined is not a function (evaluating 'new Array(type.length).fill(undefined)')\nat 
http://localhost:9876/_karma_webpack_/vendor.js:60532:43"
  }
我不知道如何解决这个问题,有人知道我的设置哪里错了吗