jasmine-reporters icon indicating copy to clipboard operation
jasmine-reporters copied to clipboard

Xml report not generated for failing testcase on compilation error

Open laflaneuse opened this issue 6 years ago • 1 comments

Issue description We are using Protractor 5.2.0 with jasmine 3.1.0 and jasmine-reporters 2.2.1 . At the moment, when a testcase fails with a compilation error, no report will be generated for this testcase and our CI build cannot identify that a testcase is failing (we have false positives)

Configuration protractor.conf.js

const HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter'); const { SpecReporter } = require('jasmine-spec-reporter'); const reporters = require('jasmine-reporters'); const failFast = require('protractor-fail-fast'); const retry = require('protractor-retry').retry; const yargs = require('yargs'); const fs = require('fs'); const mkdirp = require('mkdirp'); const { join } = require('path'); const NUMBER_OF_RETRIES = 3; const RETRY_NUMBER = process.argv.indexOf('--retry') > -1 ? process.argv[process.argv.indexOf('--retry') + 1] : 0; const RETRY_SUITE = process.argv.indexOf('--suite') > -1 ? process.argv[process.argv.indexOf('--suite') + 1] : 'retry'; const REPORT_ROOT_PATH='out/test/frontend/e2e/';

// Run this with "--no-webdriver-update", the driver comes from the grid and is not necessary locally

const screenshotReporter = new HtmlScreenshotReporter({ dest: out/test/reports/e2e/${RETRY_NUMBER}, captureOnlyFailedSpecs: true, ignoreSkippedSpecs: true, showQuickLinks: true });

function finalizeReports() { let finalDir = join(REPORT_ROOT_PATH, 'final'); if (!fs.existsSync(finalDir)){ mkdirp.sync(finalDir); }

fs.readdirSync(REPORT_ROOT_PATH + RETRY_NUMBER).forEach(file => { if (file.indexOf('.xml') >= 0) { let name = 'final_' + file; let oldPath = join(REPORT_ROOT_PATH, RETRY_NUMBER.toString(), file); let newPath = join(finalDir, name); fs.copyFileSync(oldPath, newPath); } }) }

exports.config = { allScriptsTimeout: 15000, suites: { e2m: './src/test/ui-tests/e2m//*.e2m-spec.ts', e2e: './src/test/ui-tests/e2e//*.e2e-spec.ts' }, capabilities: { browserName: 'chrome', chromeOptions: { args: [ '--headless', '--disable-gpu', '--window-size=1200x800' ] }, shardTestFiles: true, maxInstances: 8 }, baseUrl: 'https://mySystem/', seleniumAddress: 'http://server.port/wd/hub', framework: 'jasmine', jasmineNodeOpts: { showColors: true, defaultTimeoutInterval: 60000, print: function() {} }, plugins: [ failFast.init({abortAllShards: false}) ], beforeLaunch: function() { return new Promise(function(resolve){ screenshotReporter.beforeLaunch(resolve); }); }, onPrepare() { retry.onPrepare(); return browser.getProcessedConfig().then(function(config) {

  require('ts-node').register({
    project: 'src/main/angular/tsconfig.e2e.json'
  });

  jasmine.getEnv().addReporter(
    new SpecReporter({ spec: { displayStacktrace: true } })
  );

  jasmine.getEnv().addReporter(screenshotReporter);

  let junitReporter = new reporters.JUnitXmlReporter({
    consolidate: false,
    savePath: join(REPORT_ROOT_PATH, RETRY_NUMBER.toString())
  });

  jasmine.getEnv().addReporter(junitReporter);

});

}, onCleanUp(results) { retry.onCleanUp(results); }, afterLaunch: (code) => new Promise((resolve) => { finalizeReports(); screenshotReporter.afterLaunch(() => resolve(code)); }).then(() => retry.afterLaunch(NUMBER_OF_RETRIES)) };

Logs build 14-Aug-2018 09:39:51 [chrome #01-13] Specs: somefile.ts build 14-Aug-2018 09:39:51 [chrome #01-13] build 14-Aug-2018 09:39:51 [chrome #01-13] (node:165) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead. build 14-Aug-2018 09:39:51 [chrome #01-13] [07:39:41] I/hosted - Using the selenium server at http://server:port/wd/hub build 14-Aug-2018 09:39:51 [chrome #01-13] [07:39:51] I/runnerCli - ⨯ Unable to compile TypeScript: build 14-Aug-2018 09:39:51 [chrome #01-13] somefile.ts(121,69): error TS2339: Property 'property' does not exist on type 'typeHelper'. ...

Many thanks in advance!

laflaneuse avatar Aug 16 '18 19:08 laflaneuse

+1

jkieley avatar Sep 03 '18 19:09 jkieley