如何调试因果服务器中的错误?

时间:2019-02-21 14:56:28

标签: karma-jasmine karma-runner karma-chrome-launcher karma-typescript

我将karmakarma-typescript一起使用(但这不是Angular项目,因此我没有使用angular-cli)。

大约一半的测试运行在所有测试通过后 都会产生错误,我对如何进行感到困惑。这是输出。

$ karma start karma.conf.js --single-run --jenkins
21 02 2019 09:43:38.104:INFO [compiler.karma-typescript]: Compiling project using Typescript 3.2.4
21 02 2019 09:43:53.795:INFO [compiler.karma-typescript]: Compiled 21 files in 15446 ms.
21 02 2019 09:43:57.633:INFO [bundler.karma-typescript]: Bundled imports for 21 file(s) in 3328 ms.
21 02 2019 09:43:59.695:INFO [karma-server]: Karma v4.0.0 server started at http://0.0.0.0:9876/
21 02 2019 09:43:59.720:INFO [launcher]: Launching browsers ChromeHeadless with concurrency unlimited
21 02 2019 09:43:59.757:INFO [launcher]: Starting browser ChromeHeadless
21 02 2019 09:44:01.220:INFO [HeadlessChrome 72.0.3626 (Windows 10.0.0)]: Connected on socket 16JL3Xy0xm-ri3aBAAAA with id 59122393
HeadlessChrome 72.0.3626 (Windows 10.0.0): Executed 0 of 110 SUCCESS (0 secs / 0 secs)
[1A[2KHeadlessChrome 72.0.3626 (Windows 10.0.0): Executed 1 of 110 SUCCESS (0 secs / 0.061 secs)
...
[1A[2KHeadlessChrome 72.0.3626 (Windows 10.0.0): Executed 110 of 110 SUCCESS (2.695 secs / 2.341 secs)
TOTAL: 110 SUCCESS
21 02 2019 09:44:05.251:ERROR [karma-server]: { Error: read ECONNRESET
    at TCP.onStreamRead (internal/stream_base_commons.js:111:27) errno: 'ECONNRESET', code: 'ECONNRESET', syscall: 'read' }
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command

(在我的--jenkins中使用karma.conf.js标志主要是确定是否使用ChromeHeadless而不是Chrome –见下文)。

我相当确定此错误不是由我的代码引起的。

相关软件包:

    "@types/jasmine": "^3.3.8",
    "@types/jasminewd2": "^2.0.6",
    "awesome-typescript-loader": "^5.2.1",
    "jasmine": "^3.3.1",
    "jasmine-core": "^3.3.0",
    "karma": "^4.0.0",
    "karma-chrome-launcher": "^2.2.0",
    "karma-cli": "^2.0.0",
    "karma-jasmine": "^2.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "karma-junit-reporter": "^1.2.0",
    "karma-typescript": "^4.0.0",
    "ts-loader": "^5.3.3",
    "typescript": "^3.2.4"

最后,这是我的karma.conf.js

module.exports = function(config) {
  const jenkins = config.jenkins;
  config.set({
    basePath: '',
    frameworks: ["jasmine", "karma-typescript"],
    plugins: [
      require('karma-jasmine'),
      require("karma-chrome-launcher"),
      require("karma-typescript"),
      jenkins ? require('karma-junit-reporter') : require('karma-jasmine-html-reporter')
    ],
    client:{
      clearContext: false // leave Jasmine Spec Runner output visible in browser
    },
    files: [
      "src/**/*.ts"
    ],
    preprocessors: {
      "src/**/*.ts": "karma-typescript"
    },
    reporters: [
      'progress', (jenkins ? 'junit' : 'kjhtml'), 'karma-typescript'
    ],
    browsers: [jenkins ? 'ChromeHeadless' : 'Chrome'],
    karmaTypescriptConfig: {
      tsconfig: "./tsconfig.json",
      coverageOptions: {
        exclude: [/mock/, /\.spec\.ts$/, /testing-utils/]
      }
    },
    colors: !jenkins,
    logLevel: config.LOG_INFO,
    autoWatch: !jenkins,
    singleRun: jenkins,
    junitReporter: {
      outputDir: 'karma-results',
      outputFile: 'karma-results.xml'
    }
  });
};

0 个答案:

没有答案