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

junit report is empty even with successful tests #2780

Open
gian1200 opened this issue Aug 9, 2024 · 2 comments
Open

junit report is empty even with successful tests #2780

gian1200 opened this issue Aug 9, 2024 · 2 comments

Comments

@gian1200
Copy link

gian1200 commented Aug 9, 2024

When using @web/test-runner-junit-reporter, the generated report is empty

Expected

Accurate JUnit XML report
Docs: https://modern-web.dev/docs/test-runner/reporters/junit/

Actual

  • reults/test-results.xml:
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
</testsuites>

Additional info

  • web-test-runner.config.mjs:
import { jasmineTestRunnerConfig } from "web-test-runner-jasmine";
import { playwrightLauncher } from "@web/test-runner-playwright";
import { puppeteerLauncher } from "@web/test-runner-puppeteer";

import { defaultReporter } from "@web/test-runner";
import { junitReporter } from "@web/test-runner-junit-reporter";

import rollupInject from "@rollup/plugin-inject";
import rollupLegacy from "@rollup/plugin-legacy";
import { fromRollup } from "@web/dev-server-rollup";

const inject = fromRollup(rollupInject);
const legacy = fromRollup(rollupLegacy);

/**
 * @type {import("@web/test-runner").TestRunnerConfig}
 */
export default {
	...jasmineTestRunnerConfig(),
	"concurrency": 10,
	"coverage": true,
	"nodeResolve": true,
	// "watch": true,
	// in a monorepo you need to set set the root dir to resolve modules
	"rootDir": "",
	"files": "src/app/**/*.spec.mjs",
	// "debug": true,

	"browsers": [
		// puppeteerLauncher({})
		playwrightLauncher({
			"product": "chromium",
			"launchOptions": {
				"headless": true
			}
		})
	],
	"plugins": [
		legacy({
			"node_modules/jquery/dist/jquery.js": "$"
		}),
		inject({
			"$": "jquery",
			"fetchMock": "fetch-mock/esm/client",
			"Chart": ["chart.js/auto", "Chart"]
		})
	],
	"reporters": [
		// use the default reporter only for reporting test progress
		defaultReporter({ "reportTestResults": false, "reportTestProgress": true }),
		// use another reporter to report test results
		junitReporter({
			"outputPath": "./results/test-results.xml", // default `'./test-results.xml'`
			"reportLogs": true // default `false`
		})
	]
};
  • Shell:
> npx web-test-runner --config web-test-runner.config.mjs

Chromium: |██████████████████████████████| 11/11 test files | 39 passed, 0 failed                               
                                                                                                                
Code coverage: 78.18 %                                                                                          
View full coverage report at coverage\lcov-report\index.html                                                    
                                                                                                                
Finished running tests in 7.5s, all tests passed! 🎉  
@gian1200
Copy link
Author

gian1200 commented Sep 18, 2024

Worth mentioning that when using summaryReport, the report shows test names as undefined.

image

Update

It seems that testResults.tests[n] only has "passed" property. No name property.

image

Which component is responsible if that?

@gian1200
Copy link
Author

Update

it seems that the issue comes from blueprintui/web-test-runner-jasmine#9

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