snyk-module
Advanced tools
Comparing version 1.7.1 to 1.8.0
@@ -128,2 +128,8 @@ module.exports = moduleToObject; | ||
if (options.packageManager === 'maven') { | ||
if (str.indexOf(':') === -1) { | ||
throw new Error('invalid Maven package name: ' + str); | ||
} | ||
return module; | ||
} | ||
var valid = validate(module.name); | ||
@@ -130,0 +136,0 @@ |
@@ -55,3 +55,3 @@ { | ||
}, | ||
"version": "1.7.1" | ||
"version": "1.8.0" | ||
} |
@@ -127,1 +127,38 @@ var test = require('tap').test; | ||
}); | ||
test('Maven modules', function(t) { | ||
var groupId = 'org.apache.httpcomponents'; | ||
var artifactId = 'httpcomponents-core'; | ||
var packageName = groupId + ':' + artifactId; | ||
t.equal(mod.encode(packageName), groupId + '%3A' + artifactId); | ||
t.deepEqual(mod(packageName, {packageManager: 'maven'}), | ||
{name: packageName, version: '*'}); | ||
t.deepEqual(mod(packageName, '3.4.5', {packageManager: 'maven'}), | ||
{name: packageName, version: '3.4.5'}); | ||
t.deepEqual(mod(packageName, '3.4.5-SNAPSHOT', {packageManager: 'maven'}), | ||
{name: packageName, version: '3.4.5-SNAPSHOT'}); | ||
t.deepEqual(mod(packageName + '@3.4.5', {packageManager: 'maven'}), | ||
{name: packageName, version: '3.4.5'}); | ||
try { | ||
mod(groupId, {packageManager: 'maven'}); | ||
} catch(e) { | ||
t.equal(e.message, 'invalid Maven package name: ' + groupId); | ||
} | ||
try { | ||
mod(packageName); | ||
} catch(e) { | ||
t.equal(e.message, | ||
'invalid package name: ' + | ||
groupId + ':' + artifactId + | ||
', errors: name can only contain URL-friendly characters'); | ||
} | ||
t.end(); | ||
}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12685
271