
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
eslint-junit
Advanced tools
A eslint reporter that creates compatible junit xml files
yarn add --dev eslint-junit
Simply run:
eslint -f ./node_modules/eslint-junit/index.js
eslint-junit
offers four configurations based on environment variables or a eslint-junit
key defined in package.json
. All configuration values should be strings.
Variable Name | Description | Default |
---|---|---|
ESLINT_SUITE_NAME | name attribute of <testsuites> | "eslint tests" |
ESLINT_JUNIT_OUTPUT | File path to save the output. | "./junit.xml" |
ESLINT_JUNIT_CLASSNAME | Template string for the classname attribute of <testcase> . | "{ruleId}" |
ESLINT_JUNIT_TITLE | Template string for the name attribute of <testcase> . | "{line} : {source}" |
Example:
ESLINT_SUITE_NAME="Eslint Style Tests" ESLINT_JUNIT_OUTPUT="./artifacts/eslint-junit.xml" eslint
You can also define a eslint-junit
key in your package.json
. All are string values.
{
...
"eslint-junit": {
"suiteName": "eslint tests",
"output": "./eslint-junit.xml",
"classNameTemplate": "{ruleId}",
"titleTemplate": "{line} : {source}"
}
}
For the following case:
function test (a) {
a = '1';
}
The default output:
<testsuites name="eslint tests">
<testsuite errors="1" failures="0" name="/test.js" skipped="0" tests="1" time="1" timestamp="2017-09-06T20:04:53">
<testcase classname="no-param-reassign" name="2 : a = '1';" time="1">
<failure>Assignment to function parameter 'a'.</failure>
</testcase>
</testsuite>
</testsuites>
Changing the classNameTemplate
and titleTemplate
:
ESLINT_JUNIT_CLASSNAME="{ruleId}" ESLINT_JUNIT_TITLE="{source}" eslint
<testsuites name="eslint tests">
<testsuite errors="1" failures="0" name="/utils/getOptions.js" skipped="0" tests="1" time="1" timestamp="2017-09-06T20:04:53">
<testcase classname="no-param-reassign" name=" pathToResolve = path.dirname(pathToResolve);" time="1">
<failure>Assignment to function parameter 'pathToResolve'.</failure>
</testcase>
</testsuite>
</testsuites>
FAQs
A eslint result processor that generates junit xml files
The npm package eslint-junit receives a total of 8,031 weekly downloads. As such, eslint-junit popularity was classified as popular.
We found that eslint-junit demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.