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

[no test files] Not handled well by set-exit-code #163

Open
mqw opened this issue Jun 14, 2023 · 1 comment
Open

[no test files] Not handled well by set-exit-code #163

mqw opened this issue Jun 14, 2023 · 1 comment

Comments

@mqw
Copy link

mqw commented Jun 14, 2023

When I run my tests with gotest output and have [no test files] in one of the directories - it's fine - exit code 0
Whe I run same tests with gojson output and import with -parser gojson - the exit code is 1

@joschi
Copy link

joschi commented Jun 28, 2024

Doesn't seem to be an issue with go-junit-report 2.1.0.

❯ go test -v ./foo
testing: warning: no tests to run
PASS
ok  	github.com/joschi/go-junit-report/v2/foo	(cached) [no tests to run]

❯ go test -v -json ./foo | build/go-junit-report -parser gojson -set-exit-code
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
	<testsuite name="github.com/joschi/go-junit-report/v2/foo" tests="0" failures="0" errors="0" id="0" hostname="joschi-dash0.lan" time="0.000" timestamp="2024-06-28T14:28:19+02:00">
		<system-out><![CDATA[testing: warning: no tests to run]]></system-out>
	</testsuite>
</testsuites>

❯ echo $status
0

❯ go test -v ./foo | build/go-junit-report -parser gotest -set-exit-code
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
	<testsuite name="github.com/joschi/go-junit-report/v2/foo" tests="0" failures="0" errors="0" id="0" hostname="joschi-dash0.lan" time="0.000" timestamp="2024-06-28T14:29:22+02:00">
		<system-out><![CDATA[testing: warning: no tests to run]]></system-out>
	</testsuite>
</testsuites>

❯ echo $status
0

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

2 participants