Giter Club home page Giter Club logo

mocha-trx-reporter's People

Contributors

bgever avatar christianruiz avatar dependabot[bot] avatar fabiante avatar pablopnn avatar pmoleri avatar santiagoaguiar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mocha-trx-reporter's Issues

Vulnerability

I am getting a couple vulnerabilities, low and moderate, when running npm audit with the mocha-trx-reporter package installed. It stems from an old version of lodash that is marked dependent and installed by [email protected].

Moderate │ Prototype Pollution
mocha-trx-reporter > node-trx > xmlbuilder > lodash
https://npmjs.com/advisories/782

Low │ Prototype Pollution
mocha-trx-reporter > node-trx > xmlbuilder > lodash
https://npmjs.com/advisories/577

I realize that xmlbuilder is not your package, but was wondering if you were aware and if anything has been started with addressing the issue.

JS Errors are not populating <Message> field in .trx file

When throwing a standard JS error like this ...

it('Test', () => {
    throw new Error("This is a normal Error!");
})

... <Message> always remains empty:

<UnitTestResult ... >
	<Output>
	<StdOut/>
	<ErrorInfo>
		<Message/>
		<StackTrace>Error: This is a normal Error!
at Context.it (build\tests\ErrorTest.test.js:102:19)</StackTrace>
	</ErrorInfo>
	</Output>
</UnitTestResult>

Could this plugin be modified so that it would use the appropriate XML attributes <Message> and <StdOut>?

Installation problems behind proxy

Probably because we have following line in package.json
"node-trx": "git://github.com/indigostudio/node-trx.git#master"

Since our proxy doesn't allow git protocol, the npm install fails. Could you please fix this?

Mocha-trx-reporter crashes when used from cypress

cypress --reporter mocha-trx-reporter 

Crashes with:

TypeError: test.isPending is not a function
    at C:\temp\node_modules\mocha-trx-reporter\lib\trx.js:63:22
    at Array.forEach (<anonymous>:null:null)
    at Runner.<anonymous> (C:\temp\node_modules\mocha-trx-reporter\lib\trx.js:62:34)
    at emitOne (events.js:120:20)
    at Runner.emit (events.js:210:7)
    at Reporter.emit (C:\temp\node_modules\cypress\dist\Cypress\resources\app\packages\server\lib\reporter.js:191:55)
    at Object.server.startWebsockets.onMocha (C:\temp\node_modules\cypress\dist\Cypress\resources\app\packages\server\lib\project.js:288:22)
    at Socket.<anonymous> (C:\temp\node_modules\cypress\dist\Cypress\resources\app\packages\server\lib\socket.js:237:36)
    at emitOne (events.js:115:13)
    at Socket.emit (events.js:210:7)
    at C:\temp\node_modules\cypress\dist\Cypress\resources\app\packages\socket\node_modules\socket.io\lib\socket.js:503:12
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)

I suspect it's because report contains nested Suites and it's trying to convert a Suite to a Test.

Our Cypress test looks like this:

describe('Hello world', () => {
  beforeEach(() => {
    cy.visit('/');
  });


  it('should show "Hello world"', () => {
    cy.get('#container').contains('Hello world');
  });
});

See also:

readme doesn't give usage for most reporter-options

It took a lot of trial and error to figure out how to use treatPendingAsNotExecuted in conjunction with output. There should simply be an example of using more than one option at once in the readme.

--reporter-options treatPendingAsNotExecuted,output=.\TestResults\result.trx

generating trx with classname and name as none

The tool is generating in trx file with partial information, It always fill test method classname and name property as none which leads to incorrect publishing on vsts because these two fields are mandatory field to correctly identify a test method.


<TestMethod codeBase="out/test/api.test.js" className="none" name="none"/>

There is issue filed on azure-pipeline repo for this issue here is the link microsoft/azure-pipelines-tasks#10024

mocha-trx-reporter don't save the TRX file to disk,

I am trying to use "mocha-trx-reporter" to generate the ".trx" file for my Cypress tests. I installed the "mocha-trx-reporter" version "3.3.1".I am trying to run the following command:"
npx cypress run --reporter cypress-trx-reporter --reporter-options outputDir=./custom-test-results " .
After the test is finished, the trx content is displayed in the terminal, but no trx file is created.

Failing mocha hooks lead to missing unit tests

Hi!

I noticed that failing mocha hooks (before, after and so on) cause the it tests of the befores describe block to be ommited from the trx report. An example:

describe("Outer", function() {
    before("Outer Before", () => null)

    describe("Inner", function() {
        before("Inner Before", () => { throw new Error("Fail") })

        it("Inner Test", () => null)
    })

    it("Outer Test", () => null)
})

The result of this test file looks like this:

<?xml version="1.0"?>
<TestRun xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010" id="c7bb0c2a-5892-4223-b549-a595916d6a6a" name="Terstegen@MC003FST 2018-11-16 08:54:23" runUser="Terstegen">
  <Times creation="2018-11-16T08:54:23.300Z" queuing="2018-11-16T08:54:23.300Z" start="2018-11-16T08:54:23.295Z" finish="2018-11-16T08:54:23.299Z"/>
  <TestSettings name="Default Test Settings" id="ce1a4cfb-64fa-4d63-8815-e9984737a62c"/>
  <ResultSummary outcome="Completed">
    <Counters total="1" executed="1" passed="1" error="0" failed="0" timeout="0" aborted="0" inconclusive="0" passedButRunAborted="0" notRunnable="0" notExecuted="0" disconnected="0" warning="0" completed="0" inProgress="0" pending="0"/>
  </ResultSummary>
  <TestDefinitions>
    <UnitTest id="1794c9c1-7265-454a-9cea-bd9af4db42c7" name="Outer Outer Test">
      <Execution id="d34bea67-8c71-4a29-a8e1-ce81ba7ac844"/>
      <TestMethod codeBase="build\tests\Util\NestedTests.test.js" className="none" name="none"/>
    </UnitTest>
  </TestDefinitions>
  <TestLists>
    <TestList id="8c84fa94-04c1-424b-9868-57a2d4851a1d" name="Results Not in a List"/>
    <TestList id="19431567-8539-422a-85d7-44ee4e166bda" name="All Loaded Results"/>
  </TestLists>
  <TestEntries>
    <TestEntry testId="1794c9c1-7265-454a-9cea-bd9af4db42c7" executionId="d34bea67-8c71-4a29-a8e1-ce81ba7ac844" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d"/>
  </TestEntries>
  <Results>
    <UnitTestResult testId="1794c9c1-7265-454a-9cea-bd9af4db42c7" testName="Outer Outer Test" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" computerName="MC003FST" outcome="Passed" startTime="2018-11-16T08:54:23.297Z" endTime="2018-11-16T08:54:23.298Z" duration="00:00:00.000" executionId="d34bea67-8c71-4a29-a8e1-ce81ba7ac844" relativeResultsDirectory="d34bea67-8c71-4a29-a8e1-ce81ba7ac844"/>
  </Results>
</TestRun>

Is it possible to keep the "Inner Test" case as failed in the report file? Or at least include the information that the "before" hook failed?

Otherwise this leads to colleguese not knowing why tests fail.

TRX reporter is not reporting the hook failures

The TRX reporter is not handling the hook failures correctly.

The condition here in "suite end" handler seems to be incorrect.
runner.on('suite end', (suite) => {
if (failedHook && failedHook.parent === suite) {

This is what I am seeing in debug console.

failedHook.parent
{root: false, title: '#test1()'}
root:false
title:'#test1()'
proto:Object

suite
{_bail: false, root: false, title: '#test1()', fullTitle: ƒ}
_bail:false
fullTitle:() => value
root:false
title:'#test1()'
proto:Object

failedHook.parent === suite
false

Since the failedHook.parent is not equal to suite, hook failures doesn't get reported in the trx reports.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.