Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JUnitXmlReporter in docker container #208

Open
marekmosna opened this issue Dec 23, 2021 · 0 comments
Open

JUnitXmlReporter in docker container #208

marekmosna opened this issue Dec 23, 2021 · 0 comments

Comments

@marekmosna
Copy link

marekmosna commented Dec 23, 2021

Hello there,

I'm running protractor e2e tests in docker image.

FROM mrsheepuk/protractor

RUN npm install --save-dev jasmine-reporters@^2.0.0
RUN npm install --save jasmine-spec-reporter 

when I use TerminalReporter I get nice colorful output. Unfortunately, with JUnitXmlReporter the output is:

Warning: writing junit report failed for '..', 'junitresults-foo.xml'. Reasons:
  PhantomJs attempt: window is not defined
  NodeJS attempt: Unexpected token {

My config:

var reporters = require('jasmine-reporters');
var junitReporter = new reporters.JUnitXmlReporter({
  savePath: '..',
  consolidateAll: false
});

var terminalReporter = new reporters.TerminalReporter({
  verbosity: 3,
  color: true,
  showStack: true
});

var myReporter = {
  specDone: function(result){
    fs = require('fs');
    fs.writeFile('result.txt', 'Suite: ' + result.description + ' was ' + result.status);
    for(var i = 0; i < result.failedExpectations.length; i++) {
      fs.writeFile('target/result.txt', 'AfterAll ' + result.failedExpectations[i].message);
      fs.writeFile('target/result.txt', result.failedExpectations[i].stack);
    }
  }
};

exports.config = {
    seleniumAddress: 'http://localhost:4444/wd/hub',
    framework: "jasmine2",
    specs: ['*.spec.js'],
    // Chrome is not allowed to create a SUID sandbox when running inside Docker  
    capabilities: {
      'browserName': 'chrome',
      'chromeOptions': {
        'args': ['no-sandbox']
      }
    },

      // Options to be passed to Jasmine.
  jasmineNodeOpts: {
    showColors:true,
    defaultTimeoutInterval: 400000,
    isVerbose: true,
    includeStackTrace: true
  },

   onPrepare: function() {
        jasmine.getEnv().addReporter(junitReporter);
    }

  };

Can you please help me to fix it?
Many thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant