
Security News
Risky Biz Podcast: Making Reachability Analysis Work in Real-World Codebases
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
jshint-junit-reporter
Advanced tools
A JSHint output report that returns results compatible with JUnit XML. This makes it possible to integrate the results into any reporting framework that accepts that format. I have found this particularly useful in continuous integration scenarios (Bamboo, Jenkins, etc.)
The entire JSHint run is considered a test suite and each file with failures is a test case. A failure node is added to each test case indicating the number of linting errors for that test case. The body of that node enumerates the messages.
<?xml version="1.0" encoding="utf-8"?>
<testsuite name="jshint" tests="1" failures="3" errors="0" >
<testcase name="test.js">
<failure message="3 JSHint Failures" >
1. line 3, char 5: Missing "use strict" statement.
2. line 4, char 2: Missing semicolon.
3. line 1, char 1: 'x' is not defined.
</failure>
</testcase>
</testsuite>
Download the file directly on install using NPM:
npm install jshint-junit-reporter
Pass the path to reporter.js to the JSHint --reporter
option like this:
jshint --reporter=reporter.js reporter.js
You can also use this plugin with the grunt-contrib-jshint plugin that support
the reporter
option using something like this in your options
object:
options: {
reporter: require("jshint-junit-reporter"),
reporterOutput: "junit-output.xml"
}
Note: To use this option you should be on grunt-contrib-jshint >0.5.3
.
In order to hook this into Bamboo I have a 3 step test-plan:
grunt jshint
I also fill in the Working Sub-directory
field with the path to my repo, which my case is grunt
.
grunt/junit-output.xml
Again, change this to whatever works for your naming convention. With the newer verison of grunt you can just reference the single file and it should work fine!
The reporter API provided by JSHint provides access only to failure information. Therefore, the resulting XML will only list test cases for files that contained failures.
The number of tests containing linting failures will be reflected in the "tests" attribute of the testsuite element. The total number of failures in those files will be reflected in the "failures" attribute.
In the happy case that there are no failures an empty test case will be created for you.
FAQs
A JSHint reporter for jUnit.
The npm package jshint-junit-reporter receives a total of 722 weekly downloads. As such, jshint-junit-reporter popularity was classified as not popular.
We found that jshint-junit-reporter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.