Adding enhancement (and test) that compensates for an invalid package.json (one without a name field) and automatically adds the name field with a value of "1" so that the analysis continues rather than fails. #975

This commit is contained in:
Steve Springett
2017-11-09 16:14:24 -06:00
parent 210dd3f778
commit 088566a2cf
3 changed files with 14 additions and 0 deletions

View File

@@ -91,4 +91,11 @@ public class NspAnalyzerTest extends BaseTest {
// node modules are not scanned - no evidence is collected
assertTrue(result.size() == 0);
}
@Test
public void testAnalyzeInvalidPackageMissingName() throws AnalysisException {
final Dependency result = new Dependency(BaseTest.getResourceAsFile(this, "nsp/minimal-invalid.json"));
analyzer.analyze(result, null);
// Upon analysis, not throwing an exception in this case, is all that's required to pass this test
}
}

View File

@@ -0,0 +1 @@
{ "devDependencies": { "generator-jhipster": "4.5.2" } }