{"id":29374605,"url":"https://github.com/peerigon/xunit-file","last_synced_at":"2025-07-09T20:09:51.587Z","repository":{"id":4306614,"uuid":"5438924","full_name":"peerigon/xunit-file","owner":"peerigon","description":"Basically the same reporter as mocha's xunit reporter, but writes the output in a file.","archived":false,"fork":false,"pushed_at":"2023-02-01T15:08:51.000Z","size":92,"stargazers_count":37,"open_issues_count":4,"forks_count":35,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-06-09T00:38:43.446Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/peerigon.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-08-16T12:55:54.000Z","updated_at":"2023-08-25T02:54:38.000Z","dependencies_parsed_at":"2023-02-17T06:55:21.909Z","dependency_job_id":null,"html_url":"https://github.com/peerigon/xunit-file","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/peerigon/xunit-file","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peerigon%2Fxunit-file","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peerigon%2Fxunit-file/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peerigon%2Fxunit-file/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peerigon%2Fxunit-file/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peerigon","download_url":"https://codeload.github.com/peerigon/xunit-file/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peerigon%2Fxunit-file/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264262668,"owners_count":23581450,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-07-09T20:09:48.170Z","updated_at":"2025-07-09T20:09:51.579Z","avatar_url":"https://github.com/peerigon.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"xunit-file\n==========\n\nBasically the same reporter as mocha's xunit reporter, but writes the output to a file.\n\n[![](https://img.shields.io/npm/v/xunit-file.svg)](https://www.npmjs.com/package/xunit-file)\n[![](https://img.shields.io/npm/dm/xunit-file.svg)](https://www.npmjs.com/package/xunit-file)\n\n# Usage\n\n```\nnpm install xunit-file --save-dev\n```\n\nRun mocha with `-R xunit-file` or `--reporter xunit-file`\n\nThe xunit.xml output is saved in `process.cwd()/xunit.xml` by default.\n\n### Options\n\nTo change the output and activate terminal output, you can create a `config.json`, or use environment variables.\n\n**config.json**\n```\n{\n    \"file\" : \"${cwd}/xunit.xml\",\n    \"consoleOutput\" : {\n      \"suite\" : true,\n      \"test\" : true,\n      \"fail\" : false\n    }\n}\n```\n\n**environment variables**\n```\n$ XUNIT_FILE=output/xunit.xml mocha -R xunit-file // writes result to output/xunit.xml\n$ LOG_XUNIT=true mocha -R xunit-file // activates terminal output\n$ XUNIT_SILENT=true mocha -R xunit-file // disable all terminal output\n```\n\nSet XUNIT_LOG_ENV environment variable, if you want the output process and environment variables in the properties section of the xml file.\n\n```\n$ XUNIT_LOG_ENV=true mocha -R xunit-file\n```\n\nAdd the following to the xml report.\n\n```xml\n\u003cproperties\u003e\n  \u003cproperty name=\"process.arch\" value=\"x64\"/\u003e\n  \u003cproperty name=\"process.platform\" value=\"win32\"/\u003e\n  \u003cproperty name=\"process.memoryUsage\" value=\"[ rss: '26570752', heapTotal: '17734144', heapUsed: '8982088']\"/\u003e\n  \u003cproperty name=\"process.cwd\" value=\"D:\\Dev\\Demo\\git\\Demo\\DemoApp\\build\\jsTest\"/\u003e\n  \u003cproperty name=\"process.execPath\" value=\"D:\\Dev\\Demo\\git\\Demo\\DemoApp\\build\\nodeJs\\node-v0.11.10-windows-x64\\bin\\node.exe\"/\u003e\n  \u003cproperty name=\"process.version\" value=\"v0.11.10\"/\u003e\n  \u003cproperty name=\"process.versions\" value=\"[ http_parser: '2.2', node: '0.11.10', v8: '3.22.24.10', uv: '0.11.17', zlib: '1.2.3', modules: '13', openssl: '1.0.1e']\"/\u003e\n\n  ...\n\n  \u003cproperty name=\"process.env.NODE_PATH\" value=\"D:\\Dev\\Demo\\git\\Demo\\DemoApp\\build\\jsTest\\node_modules\"/\u003e\n  \u003cproperty name=\"process.env.SUITE_NAME\" value=\"jsTest.myTest\"/\u003e\n  \u003cproperty name=\"process.env.XUNIT_FILE\" value=\"D:\\Dev\\Demo\\git\\Demo\\DemoApp\\build\\test-results\\TEST-jsTest.myTest.xml\"/\u003e\n  \u003cproperty name=\"process.env.LOG_XUNIT\" value=\"undefined\"/\u003e\n\u003c/properties\u003e\n```\n\n**File Path Options**\n\nThe file path accepts a few custom tokens to allow creation of dynamic file names.  This can be useful for multithreaded testing (such as using a Selenium Grid) or to keep multiple files by timestamp.  Tokens are in the following format:\n\n```\n${tokenName: 'Token Data'}\n```\n\nThe available tokens are `pid` to inject the process id, `cwd` to inject the current working directory, and `ts` or `timestamp` to inject a timestamp.\n\nBy default `ts` and `timestamp` use the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, ex: `2016-03-31T07:27:48+00:00`.  However, if you specify a custom format in the Token Data, the timestamp uses the [node dateformat](https://github.com/felixge/node-dateformat) library to output a string in that format.\n\nA full example `config.json` is as follows:\n\n```\n{\n  \"file\": \"${cwd}/${timestamp: 'MMDD-hhmm'}/xunit-${pid}.xml\"\n}\n```\n\nThis would output something like `~/myProject/1217-1507/xunit-1234.xml`.  This example would keep copies good for a year without collision, and group multithreaded results by test run.\n\nTokens can be used in either environment variables or a config.json. The default filepath is always `${cwd}/xunit.xml`.\n\n# Credits\nThis reporter is just the original [xunit reporter](https://github.com/visionmedia/mocha/blob/master/lib/reporters/xunit.js) from mocha only writing the result in an xml file.\n\n# LICENSE\n\nMIT\n\n# Sponsors\n\n[\u003cimg src=\"https://assets.peerigon.com/peerigon/logo/peerigon-logo-flat-spinat.png\" width=\"150\" /\u003e](https://peerigon.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeerigon%2Fxunit-file","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeerigon%2Fxunit-file","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeerigon%2Fxunit-file/lists"}