File tree Expand file tree Collapse file tree 5 files changed +90
-1
lines changed Expand file tree Collapse file tree 5 files changed +90
-1
lines changed Original file line number Diff line number Diff line change @@ -265,7 +265,7 @@ def build_package(package_data):
265265 version = package_data .get ('version' )
266266 homepage = package_data .get ('homepage' , '' )
267267
268- if not name or not version :
268+ if not name :
269269 # a package.json without name and version is not a usable npm package
270270 # FIXME: raise error?
271271 return
Original file line number Diff line number Diff line change 1+ { "name" : " bson"
2+ , "description" : " A bson parser for node.js and the browser"
3+ , "main" : " ../"
4+ , "directories" : { "lib" : " ../lib/bson" }
5+ , "engines" : { "node" : " >=0.6.0" }
6+ , "licenses" : [ { "type" : " Apache License, Version 2.0"
7+ , "url" : " http://www.apache.org/licenses/LICENSE-2.0" } ]
8+ }
Original file line number Diff line number Diff line change 1+ [
2+ {
3+ "type": "npm",
4+ "namespace": null,
5+ "name": "bson",
6+ "version": null,
7+ "qualifiers": {},
8+ "subpath": null,
9+ "primary_language": "JavaScript",
10+ "description": "A bson parser for node.js and the browser",
11+ "release_date": null,
12+ "parties": [],
13+ "keywords": [],
14+ "homepage_url": null,
15+ "download_url": "https://registry.npmjs.org/bson/-/bson-None.tgz",
16+ "size": null,
17+ "sha1": null,
18+ "md5": null,
19+ "sha256": null,
20+ "sha512": null,
21+ "bug_tracking_url": null,
22+ "code_view_url": null,
23+ "vcs_url": null,
24+ "copyright": null,
25+ "license_expression": "apache-2.0",
26+ "declared_license": [{
27+ "type": "Apache License, Version 2.0",
28+ "url": "http://www.apache.org/licenses/LICENSE-2.0"
29+ }],
30+ "notice_text": null,
31+ "root_path": null,
32+ "dependencies": [],
33+ "contains_source_code": null,
34+ "source_packages": [],
35+ "purl": "pkg:npm/bson",
36+ "repository_homepage_url": "https://www.npmjs.com/package/bson",
37+ "repository_download_url": "https://registry.npmjs.org/bson/-/bson-None.tgz",
38+ "api_data_url": "https://registry.npmjs.org/bson"
39+ }
40+ ]
Original file line number Diff line number Diff line change 1+ {
2+ "version" : " 0.2.0" ,
3+ "description" : " A sample Node.js" ,
4+ "main" : " index.js" ,
5+ "scripts" : {
6+ "start" : " node index.js"
7+ },
8+ "dependencies" : {
9+ "express" : " ^4.13.3"
10+ },
11+ "engines" : {
12+ "node" : " 4.0.0"
13+ },
14+ "repository" : {
15+ "type" : " git" ,
16+ "url" : " https://github.com/heroku/node-js-sample"
17+ },
18+ "keywords" : [
19+ " node" ,
20+ " heroku" ,
21+ " express"
22+ ],
23+ "author" : " Mark Pundsack" ,
24+ "contributors" : [
25+ " Zeke Sikelianos <[email protected] > (http://zeke.sikelianos.com)" 26+ ],
27+ "license" : " MIT"
28+ }
Original file line number Diff line number Diff line change @@ -245,6 +245,19 @@ def test_parse_npm_shrinkwrap(self):
245245 packages = npm .parse (test_file )
246246 self .check_packages (packages , expected_loc , regen = False )
247247
248+ def test_parse_with_name (self ):
249+ test_file = self .get_test_loc ('npm/with_name/package.json' )
250+ expected_loc = self .get_test_loc ('npm/with_name/package.json.expected' )
251+ packages = npm .parse (test_file )
252+ self .check_packages (packages , expected_loc , regen = False )
253+
254+ def test_parse_without_name (self ):
255+ test_file = self .get_test_loc ('npm/without_name/package.json' )
256+ try :
257+ npm .parse (test_file )
258+ except AttributeError as e :
259+ assert "'NoneType' object has no attribute 'to_dict'" in str (e )
260+
248261 def test_parse_yarn_lock (self ):
249262 test_file = self .get_test_loc ('npm/yarn-lock/yarn.lock' )
250263 expected_loc = self .get_test_loc (
You can’t perform that action at this time.
0 commit comments