【问题标题】:"Process exited with code 0" when E2E tests failed at jasmine-spec-reporter当 E2E 测试在 jasmine-spec-reporter 失败时,“进程以代码 0 退出”
【发布时间】:2017-09-15 14:58:36
【问题描述】:

我的配置:

  • Windows 10
  • npm 5.3.0
  • 节点 v8.4.0
  • 茉莉花2.8.0
  • jasmine-spec-reporter 4.2.1
  • 量角器 5.1.2

以前我使用标准 jasmine 记录器进行 E2E 测试输出。 最近我安装了 jasmine-spec-reporter 并且输出看起来更好。 但是现在我在 TeamCity 中遇到了问题。 在 TeamCity 中执行测试后,我总是出现“进程以代码 0 退出”,即使某些测试失败。 使用标准记录器,我没有遇到这样的问题。 您能否建议如何解决此问题。

TeamCity 输出:

I/launcher - Running 1 instances of WebDriver
I/direct - Using ChromeDriver directly...
Jasmine started

  1 LoginComponent
    x should set focus to the Password field after incorrect password has been entered
      - Expected false to be truthy.
          at Function.CustomMatchers.expectToBeFocused (D:\TeamCity\BuildAgent\work\e2eng2\ng2\e2e\matchers\custom-matchers.ts:13:6)
          at UserContext.<anonymous> (D:\TeamCity\BuildAgent\work\e2eng2\ng2\e2e\tests\login.e2e.ts:53:18)
          at new ManagedPromise (D:\TeamCity\BuildAgent\work\e2eng2\ng2\node_modules\selenium-webdriver\lib\promise.js:1067:7)
          at ControlFlow.promise (D:\TeamCity\BuildAgent\work\e2eng2\ng2\node_modules\selenium-webdriver\lib\promise.js:2396:12)
          at TaskQueue.execute_ (D:\TeamCity\BuildAgent\work\e2eng2\ng2\node_modules\selenium-webdriver\lib\promise.js:2970:14)
          at TaskQueue.executeNext_ (D:\TeamCity\BuildAgent\work\e2eng2\ng2\node_modules\selenium-webdriver\lib\promise.js:2953:27)
          at asyncRun (D:\TeamCity\BuildAgent\work\e2eng2\ng2\node_modules\selenium-webdriver\lib\promise.js:2860:25)

**************************************************
*                    Failures                    *
**************************************************

1) LoginComponent should set focus to the Password field after incorrect password has been entered
  - Expected false to be truthy.

Executed 1 of 9 specs (1 FAILED) (8 SKIPPED) in 10 secs.
I/launcher - 0 instance(s) of WebDriver still running
I/launcher - chrome #01 passed
Process exited with code 0

我的量角器.conf.js

require('ts-node').register({
  compilerOptions: {
    noEmitHelpers: false
  }
});
var helpers = require('./helpers');
var SpecReporter = require('jasmine-spec-reporter').SpecReporter;

exports.config = {
  baseUrl: 'http://localhost:8080/ng2/',

  // use `npm run e2e`
  specs: [
    helpers.root('e2e/**/*.e2e.ts')
  ],
  exclude: [],

  framework: 'jasmine2',

  allScriptsTimeout: 110000,

  jasmineNodeOpts: {
    defaultTimeoutInterval: 600000,
    print: function() {}
  },
  directConnect: true,

  capabilities: {
    'browserName': 'chrome',
    chromeOptions: {
      args: [
        '--start-maximized'
      ]
    }
  },

  onPrepare: function() {
    browser.ignoreSynchronization = true;
    jasmine.getEnv().clearReporters();
    jasmine.getEnv().addReporter(new SpecReporter({  
      displayStacktrace: 'all',
      suite: {
        displayNumber: true,
      },
      spec: {
        displayPending: true,
        displayStacktrace: true,
      },
      summary: {
        displayDuration: true,
      },
      prefixes: {
        successful: '+ ',
        failed: 'x ',
        },
    }));
  },

   useAllAngular2AppRoots: true
};

【问题讨论】:

    标签: jasmine protractor e2e-testing jasmine-spec-reporter


    【解决方案1】:

    我解决了这个问题。 我的问题是我杀死了所有其他记者。 要修复它,删除这一行就足够了

    jasmine.getEnv().clearReporters();
    

    【讨论】:

      猜你喜欢
      • 2016-01-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-19
      • 2017-04-02
      • 1970-01-01
      相关资源
      最近更新 更多