Coder Social home page Coder Social logo

tap-junit's Introduction

Welcome

Hello! 👋 Welcome to my profile

I'm Dustin, a Fullstack Software Engineer,

I'm a Functional Developer at heart, and my most used toolset/language is JavaScript. I've authored many cool and fun libraries for the language!

I'm always looking to expand my horizons though and I've been delving little by little into other languages like Haskell, Clojure, Elm, and Scheme/Racket!

Thanks for taking the time to read this, check out my toolsets and feel free to ask questions/open issues/contibute where you see fit.

Dustin's GitHub stats Top Langs

tap-junit's People

Contributors

dhershman1 avatar hsalokor avatar stalderpascal avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

tap-junit's Issues

unexpected undefined failure message in output

Describe the bug
The tap output from the markdownlint package looks like it is in the tap spec, however the output of the tool does not pick up the failure message.

To Reproduce
Steps to reproduce the behavior:

  1. On windows... npm i -D tap-junit
  2. Save below tap as file input.tap
  3. run npx tap-junit --pretty -o output/tests -n output.xml -i .\input.tap
  4. Compare output

Expected behavior
I expected the comments in the tap file between --- and ... to be in the <failure message="as in here" type="fail" />

Desktop (please complete the following information):

  • OS: Windows & Azure Pipline (running ubuntu latest)
  • Node Version: latest

Additional context
Input example tap

TAP version 13
1..4
not ok 1 - Manual/about.md
  ---
  message: /tmp/lint/Manual/about.md 9 MD025/single-title/single-h1 Multiple top-level headings in the same document [Context  "# About this manual"]
  ...
ok 2 - Manual/welcome.md
ok 3 - Media/README.md
not ok 4 - README.md
  ---
  message: /tmp/lint/README.md 4 MD025/single-title/single-h1 Multiple top-level headings in the same document [Context  "# Getting Started"]\n/tmp/lint/README.md 11 MD025/single-title/single-h1 Multiple top-level headings in the same document [Context  "# Build and Test"]\n/tmp/lint/README.md 17 MD025/single-title/single-h1 Multiple top-level headings in the same document [Context  "# Contribute"]
  ...

Generated output

<?xml version="1.0"?>
<testsuites failures="2" name="markdownlint-junit.xml" tests="4">
	<testsuite failures="2" name="Tap-Junit-Suite" skipped="0" tests="4">
		<testcase id="1" name="Manual/about.md">
			<failure message="undefined" type="fail"/>
		</testcase>
		<testcase id="2" name="Manual/welcome.md"/>
		<testcase id="3" name="Media/README.md"/>
		<testcase id="4" name="README.md">
			<failure message="undefined" type="fail"/>
		</testcase>
	</testsuite>
</testsuites>

Console output:

Tap-Junit: Finished! markdownlint-junit.xml created at -- output/tests

Error: Tap-Junit: Looks like some test suites failed
    at C:\Users\****\node_modules\tap-junit\src\index.js:42:23

3.1.1 strangeness when installed with yarn instead of npm

Describe the bug

As of 3.1.1, tap-junit fails to run when installed with yarn.

$ ./node_modules/.bin/tap-junit -v
': No such file or directory

To Reproduce

It doesn't work when installed with yarn:

$ docker run -it --rm node:13.12.0-alpine3.11 sh
/ # yarn add [email protected]
...
Done in 1.22s.
/ # ./node_modules/.bin/tap-junit -v
': No such file or directory

It does work when installed with npm:

/ # npm install [email protected]
...
+ [email protected]
added 17 packages from 12 contributors and audited 17 packages in 2.039s
found 0 vulnerabilities

/ # ./node_modules/.bin/tap-junit -v
3.1.1

It worked with yarn in 3.1.0:

/ # yarn add [email protected]
...
Done in 1.10s.
/ # ./node_modules/.bin/tap-junit -v
3.1.0

Expected behavior
I expected tap-junit to run (in the case above, a version string should be printed).

Desktop (please complete the following information):
I'm running Ubuntu 18.04, though the instructions using Docker, above, should be universally reproducible.

SKIP produces an empty JUnit output

Describe the bug

When using the # SKIP directive then no output is reported.

To Reproduce

Given

running (cwd: ./): node --require /app/test/_promise_rejection.js test/instrumentation/modules/mongodb.test.js
# SKIP [email protected] does not support node v8.6.0

It produces an empty JUnit output

Expected behavior

Produce a skipped entry

<testsuite  tests="1" failures="0"  errors="0" skipped="1" name="Node.js" >
  <testcase name="[email protected] does not support node v8.6.0" >
     <skipped><![CDATA[SKIP [email protected] does not support node v8.6.0]]></skipped>
  </testcase>
</testsuite>

Command Line Usage
If you're able please specify the command line format you used for tap-junit for example:

tap-xunit --package='Node.js' 

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

npm audit warning on use of minimist

Describe the bug

npm audit flags minimist with a low-risk prototype pollution security warning

To Reproduce
Steps to reproduce the behavior:

  1. Install tap-junit in a project
  2. Run npm audit

Expected behavior
No warnings given

Screenshots

Screen Shot 2020-04-03 at 7 24 34 AM

Desktop (please complete the following information):

  • OS: macOS Mojave
  • Browser: n/a, CLI tool

Additional context
None that I can think of.

Docker Container

Is your feature request related to a problem? Please describe.
Not related to a problem.

Describe the solution you'd like
Would like to see a Docker container on Docker Hub, so instead of having to install Node, I can just use Docker to execute. E.g.:

docker run dhershman1/tap-junit

Describe alternatives you've considered
Alternative is that I build the Docker container myself. While that's possible and easy, I'd rather have a Docker container maintained by the original project.

Additional context
Here's a sample Dockerfile for it:

FROM node:8
RUN npm i -D [email protected]
WORKDIR /io
ENTRYPOINT [ "sh", "/node_modules/tap-junit/bin/tap-junit" ]

( Note that this assumes that there is a --version option. )

Show Error Output

Is your feature request related to a problem? Please describe.
Yes, I'm getting an exit code 1 from the program, but I don't know why.

Describe the solution you'd like
When there is a problem, then print a concise description of the problem to stderr. E.g.:

tap-junit: ERROR: No input file specified.

Describe alternatives you've considered
No easy alternatives (outside debugging).

Additional context
No additional info.

failure does not fulfil the junit xml schema

Hi there,

I realised that the output when there is a failure does not follow the junit xml scheme:

<testcase>
  <failure type="type" message="message"></failure>
  <system-out>stdout text</system-out>
  <system-err>stderr text</system-err>
</testcase>

Instead, tap-junit is outputing

<testcase>
  <failure>
    <system-out>stdout text</system-out>
  </failure>
</testcase>

This is causing some plugins, such as Jenkins junit don't understand this xml.

JUnit xml schema: https://github.com/windyroad/JUnit-Schema/blob/master/JUnit.xsd
Example file: http://llg.cubic.org/docs/junit/

Thanks,
Fran

(v3.0.2) BATS output not handled properly

Describe the bug
When BATS produces output with a fair amount of details, then tap-junit (v3.0.2) misinterprets that input.

To Reproduce
Steps to reproduce the behavior:

  1. Have a file named unit-test-results.tap.txt with the following contents:
1..4
ok 1 dry run (DEBUG) - status
not ok 2 dry run (DEBUG) - output
# (from function `assert_equal' in file /opt/bats-helpers/bats-assert/src/assert.bash, line 91,
#  in test file /Users/johndoe/acmeinc/bblocks-publish/src/test/bats/009-dry-run-debug.bats, line 25)
#   `assert_equal "${lines[3]}" "DEBUG: CODEBASE_DIR=/code"' failed
# 
# -- values do not equal --
# expected : DEBUG: CODEBASE_DIR=/code
# actual   : DEBUG: CODEBASE_DIR=/Users/johndoe/acmeinc/bblocks-publish
# --
# 
not ok 3 dry run (DEBUG) - output length
# (from function `assert_equal' in file /opt/bats-helpers/bats-assert/src/assert.bash, line 91,
#  in test file /Users/johndoe/acmeinc/bblocks-publish/src/test/bats/009-dry-run-debug.bats, line 40)
#   `assert_equal "${#lines[@]}" 24' failed
# 
# -- values do not equal --
# expected : 24
# actual   : 16
# --
# 
not ok 4 dry run (DEBUG) - output ALL - TODO: Remove
# (from function `assert_equal' in file /opt/bats-helpers/bats-assert/src/assert.bash, line 91,
#  in test file /Users/johndoe/acmeinc/bblocks-publish/src/test/bats/009-dry-run-debug.bats, line 44)
#   `assert_equal "${output}" ""' failed
# 
# -- values do not equal --
# expected (0 lines):
# 
# actual (16 lines):
#   DEBUG: DEBUG=yes
#   DEBUG: DRY_RUN=yes
#   DEBUG: SKIP=no
#   DEBUG: CODEBASE_DIR=/Users/johndoe/acmeinc/bblocks-publish
#   DEBUG: BBLOCKSFILE=BBlocksfile
#   DEBUG: ARTIFACT_REPO_AUTH is set.
#   DEBUG: CURL_CMD=curl
#   DRY_RUN: curl --version
#   DEBUG: curl --version succeeded.
#   DEBUG: CURL_TIMEOUT_IN_SEC=120
#   DEBUG: CURL_CONNECT_TIMEOUT_IN_SEC=10
#   DEBUG: Publish repo URL is: https://artifactory-de.acmeinc.com/artifactory/libs-release-local/
#   DEBUG: Coordinates: com.acmeinc.bblocks :: bblocks-fetch :: 0-SNAPSHOT
#   Publishing script to: TODO
#   /Users/johndoe/acmeinc/bblocks-publish/target/bblocks-fetch: line 157: ${target_dir}/${self.coords.name}: bad substitution
#   DEBUG: cURL exit code: 1
# --
# 
  1. Pass this into tap-junit, e.g.:
cat unit-test-results.tap.txt | tap-junit > junit.xml

Expected behavior

  1. On step 2, valid JUnit XML is produced.
  2. The XML contains either 1 or 4 test suites (depending on how it maps the TAP tests).
  3. The XML contains exactly 4 test cases.

Actual behavior

  1. OK: On step 2, valid JUnit XML is produced.
  2. NOK: The XML contains 45 test suites.
  3. OK: The XML contains exactly 4 test cases.

Here is the produced JUnit XML:

<?xml version="1.0"?>
<testsuites tests="4" name="Tap-Junit" failures="3" errors="0">
  <testsuite tests="2" failures="1" errors="0" name="dry run (DEBUG) - status">
    <testcase name="#1 dry run (DEBUG) - status"/>
    <testcase name="#2 dry run (DEBUG) - output">
      <failure message="not ok 2 dry run (DEBUG) - output"/>
    </testcase>
  </testsuite>
  <testsuite tests="0" failures="0" errors="0" name="(from function `assert_equal' in file /opt/bats-helpers/bats-assert/src/assert.bash, line 91,"/>
  <testsuite tests="0" failures="0" errors="0" name="in test file /Users/johndoe/acmeinc/bblocks-publish/src/test/bats/009-dry-run-debug.bats, line 25)"/>
  <testsuite tests="0" failures="0" errors="0" name="`assert_equal &quot;${lines[3]}&quot; &quot;DEBUG: CODEBASE_DIR=/code&quot;' failed"/>
  <testsuite tests="0" failures="0" errors="0" name=" "/>
  <testsuite tests="0" failures="0" errors="0" name="-- values do not equal --"/>
  <testsuite tests="0" failures="0" errors="0" name="expected : DEBUG: CODEBASE_DIR=/code"/>
  <testsuite tests="0" failures="0" errors="0" name="actual   : DEBUG: CODEBASE_DIR=/Users/johndoe/acmeinc/bblocks-publish"/>
  <testsuite tests="0" failures="0" errors="0" name="--"/>
  <testsuite tests="1" failures="1" errors="0" name=" ">
    <testcase name="#3 dry run (DEBUG) - output length">
      <failure message="not ok 3 dry run (DEBUG) - output length"/>
    </testcase>
  </testsuite>
  <testsuite tests="0" failures="0" errors="0" name="(from function `assert_equal' in file /opt/bats-helpers/bats-assert/src/assert.bash, line 91,"/>
  <testsuite tests="0" failures="0" errors="0" name="in test file /Users/johndoe/acmeinc/bblocks-publish/src/test/bats/009-dry-run-debug.bats, line 40)"/>
  <testsuite tests="0" failures="0" errors="0" name="`assert_equal &quot;${#lines[@]}&quot; 24' failed"/>
  <testsuite tests="0" failures="0" errors="0" name=" "/>
  <testsuite tests="0" failures="0" errors="0" name="-- values do not equal --"/>
  <testsuite tests="0" failures="0" errors="0" name="expected : 24"/>
  <testsuite tests="0" failures="0" errors="0" name="actual   : 16"/>
  <testsuite tests="0" failures="0" errors="0" name="--"/>
  <testsuite tests="1" failures="1" errors="0" name=" ">
    <testcase name="#4 dry run (DEBUG) - output ALL - TODO: Remove">
      <failure message="not ok 4 dry run (DEBUG) - output ALL - TODO: Remove"/>
    </testcase>
  </testsuite>
  <testsuite tests="0" failures="0" errors="0" name="(from function `assert_equal' in file /opt/bats-helpers/bats-assert/src/assert.bash, line 91,"/>
  <testsuite tests="0" failures="0" errors="0" name="in test file /Users/johndoe/acmeinc/bblocks-publish/src/test/bats/009-dry-run-debug.bats, line 44)"/>
  <testsuite tests="0" failures="0" errors="0" name="`assert_equal &quot;${output}&quot; &quot;&quot;' failed"/>
  <testsuite tests="0" failures="0" errors="0" name=" "/>
  <testsuite tests="0" failures="0" errors="0" name="-- values do not equal --"/>
  <testsuite tests="0" failures="0" errors="0" name="expected (0 lines):"/>
  <testsuite tests="0" failures="0" errors="0" name=" "/>
  <testsuite tests="0" failures="0" errors="0" name="actual (16 lines):"/>
  <testsuite tests="0" failures="0" errors="0" name="DEBUG: DEBUG=yes"/>
  <testsuite tests="0" failures="0" errors="0" name="DEBUG: DRY_RUN=yes"/>
  <testsuite tests="0" failures="0" errors="0" name="DEBUG: SKIP=no"/>
  <testsuite tests="0" failures="0" errors="0" name="DEBUG: CODEBASE_DIR=/Users/johndoe/acmeinc/bblocks-publish"/>
  <testsuite tests="0" failures="0" errors="0" name="DEBUG: BBLOCKSFILE=BBlocksfile"/>
  <testsuite tests="0" failures="0" errors="0" name="DEBUG: ARTIFACT_REPO_AUTH is set."/>
  <testsuite tests="0" failures="0" errors="0" name="DEBUG: CURL_CMD=curl"/>
  <testsuite tests="0" failures="0" errors="0" name="DRY_RUN: curl --version"/>
  <testsuite tests="0" failures="0" errors="0" name="DEBUG: curl --version succeeded."/>
  <testsuite tests="0" failures="0" errors="0" name="DEBUG: CURL_TIMEOUT_IN_SEC=120"/>
  <testsuite tests="0" failures="0" errors="0" name="DEBUG: CURL_CONNECT_TIMEOUT_IN_SEC=10"/>
  <testsuite tests="0" failures="0" errors="0" name="DEBUG: Publish repo URL is: https://artifactory-de.acmeinc.com/artifactory/libs-release-local/"/>
  <testsuite tests="0" failures="0" errors="0" name="DEBUG: Coordinates: com.acmeinc.bblocks :: bblocks-fetch :: 0-SNAPSHOT"/>
  <testsuite tests="0" failures="0" errors="0" name="Publishing script to: TODO"/>
  <testsuite tests="0" failures="0" errors="0" name="/Users/johndoe/acmeinc/bblocks-publish/target/bblocks-fetch: line 157: ${target_dir}/${self.coords.name}: bad substitution"/>
  <testsuite tests="0" failures="0" errors="0" name="DEBUG: cURL exit code: 1"/>
  <testsuite tests="0" failures="0" errors="0" name="--"/>
  <testsuite tests="0" failures="0" errors="0" name=" "/>
</testsuites>

File references:

pgTAP output is reported as failures

Describe the bug
pgTAP outputs All tests successful, but tap-junit says there are failures.

To Reproduce

test.tap:

t/utils.sql .......
1..3
ok 1 - slugify function test 1
ok 2 - slugify function test 2
ok 3 - slugify function test 3
ok
All tests successful.
Files=1, Tests=3,  4 wallclock secs ( 0.19 usr  0.03 sys +  0.54 cusr  0.12 csys =  0.88 CPU)
Result: PASS

output:

cat test.tap | npx tap-junit --pretty
<?xml version="1.0"?>
<testsuites tests="4" name="Tap-Junit" failures="1">
  <testsuite name="Tap-Junit-Suite" tests="4" skipped="0" failures="1">
    <testcase name="slugify function test 1" id="1"/>
    <testcase name="slugify function test 2" id="2"/>
    <testcase name="slugify function test 3" id="3"/>
    <testcase id="4"/>
  </testsuite>
</testsuites>

Desktop:

  • OS: MacOS
  • Node Version: v18.15.0
  • Version: 5.0.2

Additional context
Failure count seems to match test file count, so I guess it counts each file as a failure for some reason.

Add Version Option

Is your feature request related to a problem? Please describe.
Nope.

Describe the solution you'd like
An option for retrieving the version. Either -v or --version, or both.

Describe alternatives you've considered
I don't see alternatives.

Additional context
Rationale: be able to:

  1. verify easily that the program is installed, without having to have a TAP file,
  2. determine the version of the program.

Allow Specification of Input File Name on Command Line

Is your feature request related to a problem? Please describe.
Currently I need to pipe the contents of a file into tap-junit (inside a Docker container) instead of being able to just pass the TAP input file name to the command.

Describe the solution you'd like
I'd like the program to support a command line argument for specifying a single TAP input file. E.g.:

tap-junit -i input.tap -n output.xml

Describe alternatives you've considered
Just pipe the file contents into the tap-junit process.

Additional context
No additional info.

Remove usage API

So I am currently on the fence about removing the JS API side of tap-junit and bringing it back to a 100% CLI tool.

The original reason for adding an api piece was for a personal use case, which is no longer a problem.

So far pretty much all usage of module are via the CLI.

Is there any reason to keep the API at this point in time, or can I remove it for a 2.0.0 release?

Test name is empty

Hi there,

There seems to be a problem with the name of the tests. After upgrading the version, I realised that I no longer have the test name in the xml.

Looking at the source code I saw that we're passing an object to newTest that expects testName as property, but then we're calling this function passing name instead

testCase = newTest({ name });

and

tap.on('test', res => {
  testCase = newTest(res);
});

where res has a property name. See test.js in tap-out.

Sending a pull request shortly.

Fran

Quest to Limit Dependencies

Hello!

I am creating this issue to represent that I will soon be releasing a "beta" tag of tap-junit. Under this beta tag I will be pushing changes to help limit the number of dependencies that tap-junit relies on.

I am a strong advocator for limiting the use of dependencies within other tools/libs which is why I am going about this.

Currently

Currently in the beta release the fs-extra package was swapped with an internal system to build out folder structures. So if you notice any issues when creating output locations and what not please let me know!

You can check out the beta code here: https://github.com/dhershman1/tap-junit/tree/development

How To

You can install the beta by using npm i tap-junit@beta in your project.

Roadmap

First on the list is fs-extra, A great tool that I am hardly using its full power.

What I am thinking about shooting for next is possibly minimist a lightweight cli helper, it's not really maintained anymore and instead of switching I figured tap-junit doesn't need that many options so we can ship our own.

Contributing

So this is a large process that I want to take slowly. Technically this shouldn't break anything about tap-junit and how you use it. It will remain the same completely.

So if you use the beta and give me feedback/report problems with your app when you tried it that would be fantastic!

Thanks a bunch!

Error on 'not ok'

Describe the bug
On test failures, bats produces tap output that tap-junit cannot parse; it results in a “missing attribute value” error.

To Reproduce
Steps to reproduce the behavior:

  1. Create a file tap.txt with these contents:
1..3
ok 1 simple comparison - successful
not ok 2 simple comparison - unsuccessful
ok 3 # skip simple comparison - ignored
  1. Ensure tap-junit is installed:
npm i -D tap-junit
  1. Get the tap-junit version:
~/node_modules/tap-junit/bin/tap-junit --version
  1. Pipe the tap.txt file into tap-junit:
cat tap3.txt | ~/node_modules/tap-junit/bin/tap-junit

Expected behavior

  1. On step 2, the installation is successful.
  2. On step 3, the version is properly displayed.
  3. On step 4, the conversion to XML is successful.

Actual behavior

  1. OK: On step 2, the installation is successful.
  2. OK: On step 3, the version is properly displayed:
$ ~/node_modules/tap-junit/bin/tap-junit --version
3.0.1
  1. NOK: On step 4, the conversion to XML is not successful:
cat tap.txt | ~/node_modules/tap-junit/bin/tap-junit 
/Users/ernst/node_modules/xmlbuilder/lib/XMLAttribute.js:14
        throw new Error("Missing attribute value. " + this.debugInfo(name));
        ^

Error: Missing attribute value. attribute: {type}, parent: <failure>
    at new XMLAttribute (/Users/ernst/node_modules/xmlbuilder/lib/XMLAttribute.js:14:15)
    at XMLElement.module.exports.XMLElement.attribute (/Users/ernst/node_modules/xmlbuilder/lib/XMLElement.js:72:35)
    at XMLElement.module.exports.XMLElement.attribute (/Users/ernst/node_modules/xmlbuilder/lib/XMLElement.js:65:16)
    at new XMLElement (/Users/ernst/node_modules/xmlbuilder/lib/XMLElement.js:24:14)
    at XMLElement.module.exports.XMLNode.node (/Users/ernst/node_modules/xmlbuilder/lib/XMLNode.js:163:15)
    at XMLElement.module.exports.XMLNode.element (/Users/ernst/node_modules/xmlbuilder/lib/XMLNode.js:110:28)
    at XMLElement.module.exports.XMLNode.ele (/Users/ernst/node_modules/xmlbuilder/lib/XMLNode.js:392:19)
    at suite.asserts.forEach.test (/Users/ernst/node_modules/tap-junit/src/serialize.js:28:20)
    at Array.forEach (<anonymous>)
    at testCases.forEach.suite (/Users/ernst/node_modules/tap-junit/src/serialize.js:20:19)

Additional information:

  • OS: macOS 10.14.2
Darwin Ernsts-MacBook-Pro.local 18.2.0 Darwin Kernel Version 18.2.0: Mon Nov 12 20:24:46 PST 2018; root:xnu-4903.231.4~2/RELEASE_X86_64 x86_64

v4 output results in NullPointerException when used in Jenkins

Caveat: I don't know the junit.xml format at all, so my apologies if this is a bug in Jenkins rather than tap-junit. I opened this ticket because it works when using tap-junit version 3.

Describe the bug

Jenkins builds fail with a NullPointerException when passing output of tap-junit version 4 to the junit plugin.

This is caused by the lack of a name attribute on the testsuite element. Jenkins falls back to that attribute if no classname attribute is present on a testcase (source).

To Reproduce

  1. Use Jenkins
  2. Have a build output an XML file through tap-junit
  3. Run that XML file through Jenkins's junit plugin
17:53:48  Recording test results
17:53:48  null
Error when executing always post condition:
Also:   hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from 1.2.3.4/1.2.3.4:56789
		at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1800)
		at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357)
		at hudson.remoting.Channel.call(Channel.java:1001)
		at hudson.FilePath.act(FilePath.java:1070)
		at hudson.FilePath.act(FilePath.java:1059)
		at hudson.tasks.junit.JUnitParser.parseResult(JUnitParser.java:107)
		at hudson.tasks.junit.JUnitResultArchiver.parse(JUnitResultArchiver.java:149)
		at hudson.tasks.junit.JUnitResultArchiver.parseAndSummarize(JUnitResultArchiver.java:243)
		at hudson.tasks.junit.pipeline.JUnitResultsStepExecution.run(JUnitResultsStepExecution.java:52)
		at hudson.tasks.junit.pipeline.JUnitResultsStepExecution.run(JUnitResultsStepExecution.java:25)
		at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
		at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
		at java.util.concurrent.FutureTask.run(FutureTask.java:266)
		at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
		at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.NullPointerException
	at hudson.tasks.junit.CaseResult.getPackageName(CaseResult.java:399)
	at hudson.tasks.junit.TestResult.tally(TestResult.java:795)
	at hudson.tasks.junit.JUnitParser$ParseResultCallable.invoke(JUnitParser.java:145)
	at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3112)
	at hudson.remoting.UserRequest.perform(UserRequest.java:211)
	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
	at hudson.remoting.Request$2.run(Request.java:375)
	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:73)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:118)
	at java.lang.Thread.run(Thread.java:748)

Expected behavior

The XML file is parsed by Jenkins

Influence Test Suite Name

Is your feature request related to a problem? Please describe.
I'm using tap-junit to show test results using the JUnit integration for Jenkins. However, Jenkins now shows the test results in this structure:

  • (root)
    • test case 1 name
      • test case 1 name
      • test case 2 name

Notice that the whole test suite is named “test case 1 name” – which is not so great.

Describe the solution you'd like
I'd like to have either a default name (like test suite) or otherwise I'd like to have the option of specifying the test suite name somehow (even better).

Describe alternatives you've considered
No alternatives considered.

Additional context
No additional context.

Tap Comment Output is not valid according to Junit schema

Describe the bug
When accepting tap input (from mocha) with tap comments #, the xml output contains the comment as string content in the testcase element (in this case, summarising number of tests, passes and fails). This is not valid according to https://github.com/junit-team/junit5/blob/43638eb6a870e0d6c49224053dfeb39dcf0ef33f/platform-tests/src/test/resources/jenkins-junit.xsd and is rejected by GitLab CI and Jenkins.
e.g.

<testsuites tests="1" name="junit.xml" failures="0">
<testsuite name="tests" tests="1" skipped="0" failures="0">
<testcase name="test1" id="1"># tests 1
# pass 1
# fail 0
</testcase>
</testsuite>
</testsuites>

This appears similar to #32 - comments in the tap file are being added as content of the testcase element but this is invalid.

To Reproduce
Steps to reproduce the behavior:

  1. set mocha's reporter to tap
  2. nyc mocha test.spec.ts | tap-junit --classname tests --name junit.xml -p

Expected behavior
XML is valid according to the above schema.

Command Line Usage
If you're able please specify the command line format you used for tap-junit for example:

nyc mocha test.spec.ts | tap-junit --output out --classname tests --name junit.xml -p && nyc report

Desktop (please complete the following information):

  • OS: alpine linux x64
  • Node Version: 14
  • Version 4.2.0

Additional context
Gitlab rejects xml with text children of the testcase node. It doesn't seem to mind the additional id attribute on the same element even though this is also invalid according to the above schema.

add failure details

eg.

<failure>
    ---
      operator: ok
      expected: true
      actual: null
      at: iteratorCallback (...)
    ...
</failure>

Add ability to specify file extensions

Is your feature request related to a problem? Please describe.
In a somewhat complex build pipeline, where different testresult formats are used, we use a conventionbased system where file extsion describes the format of the testresult, e.g. testreport.xuni, testreport.vsts etc.

Describe the solution you'd like
The ability to specify file extension for the output file.

Describe alternatives you've considered
Tried tap-xunit, but the output is not compatible with our platform, looking at other options.

I will happily provide a pull request if this is something you think is a good solution.

Error message is not captured from ava tap report

Describe the bug
Error message in tap report from ava is not captured in JUnit report.

To Reproduce
Steps to reproduce the behavior:

  1. See the repo https://github.com/vanashimko/ava-tap-junit-reproduce
  2. npm run test
  3. Observe tap.txt:
TAP version 13
not ok 1 - 2+2=4
  ---
    name: AssertionError
    assertion: is
    values:
      'Difference:': |-
        - 4
        + 5
    at: 'test.js:4:4'
  ...

1..1
# tests 1
# pass 0
# fail 1
  1. Observe generated tap.xml
<?xml version="1.0"?>
<testsuites tests="1" name="Tap-Junit" failures="1">
  <testsuite name="Tap-Junit-Suite" tests="1" skipped="0" failures="1">
    <testcase name="2+2=4" id="1">
      <failure type="fail"> </failure>
    </testcase>
  </testsuite>
</testsuites>

Expected behavior
Error message from tap report is saved to JUnit report.

Desktop (please complete the following information):

  • OS: Windows and Linux
  • Browser: N/A (nodejs 14.15.4 LTS)

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.