infragistics / mocha-trx-reporter Goto Github PK
View Code? Open in Web Editor NEWReporter for the Visual Studio TRX format
License: MIT License
Reporter for the Visual Studio TRX format
License: MIT License
Support for screenshots would be very useful: Azure Devops Pipelines do not support attachments from JUnit reports, but only from TRX reports. See this issue.
The node-trx library has support for attachments. See the code for usage.
I am trying to use "mocha-trx-reporter" to generate the ".trx" file for my E2E tests. I installed the "mocha-trx-reporter" latest version which is "^3.2.3". After installing when I tried to run the tests it is showing error as "TypeError: Cannot read property 'start' of undefined" in file "\node_modules\mocha-trx-reporter\lib\trx.js" line 83
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.
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>
?
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?
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:
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
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
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.
Hi!
I noticed that failing mocha hooks (before
, after
and so on) cause the it
tests of the before
s 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.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.