Node.js NodeJS应用程序Azure管道中的Karma Start

Node.js NodeJS应用程序Azure管道中的Karma Start,node.js,azure-devops,azure-pipelines,Node.js,Azure Devops,Azure Pipelines,我有一个NodeJS(FlexServices)应用程序,我需要执行单元测试 这是我的karma.conf.js module.exports = function(config) { config.set({ frameworks: ["jasmine", "karma-typescript"], files: [ { pattern: "src/**/*.ts" }

我有一个NodeJS(FlexServices)应用程序,我需要执行单元测试

这是我的karma.conf.js

module.exports = function(config) {
    config.set({
        frameworks: ["jasmine", "karma-typescript"],
        files: [
            { pattern: "src/**/*.ts" }
        ],

        preprocessors: {
            "**/*.ts": ["karma-typescript"]
        },
        reporters: ["progress", "karma-typescript"],
        browsers: ["Chrome"],
        singleRun: true
    });
};
我拥有的管道目前正在本地windows服务器上运行。在运行
karma start--single run
命令之前,我安装了karma cli

- task: Npm@1
  displayName: "npm install karma cli"
  inputs:
    command: 'custom'
    customCommand: 'install -g karma-cli'
当我运行管道时,我从npm获得以下错误日志

npm ERR! errno 1
> test-flex@2.2.0 test E:\ADOAgents\Agent1\_work\3185\s
npm ERR! test-flex@2.2.0 test: `karma start --single-run`
> karma start --single-run
npm ERR! Exit status 1

npm ERR! 
29 04 2021 10:35:45.388:INFO [compiler.karma-typescript]: Compiling project using Typescript 3.9.9
npm ERR! Failed at the test-flex@2.2.0 test script.
29 04 2021 10:35:50.633:INFO [compiler.karma-typescript]: Compiled 12 files in 5230 ms.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
29 04 2021 10:35:51.532:INFO [bundler.karma-typescript]: Bundled imports for 11 file(s) in 388 ms.

29 04 2021 10:35:51.977:INFO [karma-server]: Karma v4.4.1 server started at http://0.0.0.0:9876/
npm ERR! A complete log of this run can be found in:
29 04 2021 10:35:51.978:INFO [launcher]: Launching browsers Chrome with concurrency unlimited
npm ERR!     C:\Users\svc-teamfbuild\AppData\Roaming\npm-cache\_logs\2021-04-29T14_36_56_065Z-debug.log
29 04 2021 10:35:51.988:INFO [launcher]: Starting browser Chrome
29 04 2021 10:36:52.006:WARN [launcher]: Chrome have not captured in 60000 ms, killing.
29 04 2021 10:36:54.015:WARN [launcher]: Chrome was not killed in 2000 ms, sending SIGKILL.
29 04 2021 10:36:56.018:WARN [launcher]: Chrome was not killed by SIGKILL in 2000 ms, continuing.

我是否错过了使其正常工作的方法???

如果您运行此命令
npm install-g karma cli
karma start--single run
而不是在Azure管道中运行它,是否存在此问题?@wallezzi是的。如果它在本地工作,并且karma cli已经在本地安装,您可以在管道中使用,无需再次使用npm进行安装。使用私有代理是否有效?如果我使用云代理,则有效,但在未安装任何内容的on-prem代理上无效。这就是为什么我需要找出package.json和karma.conf.js的最低配置。