Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/com/cj/jshintmojo/Mojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,8 @@ private void handleResults(final Map<String, Result> currentResults,
}
}

saveReportFile(currentResults, reporter, reportFile);
if(numProblematicFiles > 0) {
saveReportFile(currentResults, reporter, reportFile);

String errorMessage = "\nJSHint found problems with " + numProblematicFiles + " file";

Expand Down
19 changes: 19 additions & 0 deletions src/test/java/com/cj/jshintmojo/MojoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,25 @@ public void walksTheDirectoryTreeToFindAndUseJshintFiles() throws Exception {
}
}
}

@Test
public void savesReportEvenWhenThereAreNoProblems() throws Exception {
// given
File directory = tempDir();
File reportFile = new File(directory, "reportFile");

LogStub log = new LogStub();
Mojo mojo = new Mojo("", "",
directory,
Collections.singletonList(""),
Collections.<String>emptyList(),true, null, "jslint", reportFile.getAbsolutePath(), null);
mojo.setLog(log);
// when
mojo.execute();
// then
assertTrue("Saves report", log.hasMessage("info",
"Generating \"JSHint\" report. reporter=jslint, reportFile="+reportFile.getAbsolutePath()+"."));
}

@Test
public void warnsUsersWhenConfiguredToWorkWithNonexistentDirectories() throws Exception {
Expand Down