File tree Expand file tree Collapse file tree 3 files changed +30
-2
lines changed Expand file tree Collapse file tree 3 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -21,16 +21,18 @@ pbxProject.prototype.parse = function (cb) {
2121 var worker = fork ( __dirname + '/parseJob.js' , [ this . filepath ] )
2222
2323 worker . on ( 'message' , function ( msg ) {
24- if ( msg . code ) {
24+ if ( msg . name == 'SyntaxError' || msg . code ) {
2525 this . emit ( 'error' , msg ) ;
2626 } else {
2727 this . hash = msg ;
2828 this . emit ( 'end' , null , msg )
2929 }
3030 } . bind ( this ) ) ;
3131
32- if ( cb )
32+ if ( cb ) {
33+ this . on ( 'error' , cb ) ;
3334 this . on ( 'end' , cb ) ;
35+ }
3436
3537 return this ;
3638}
Original file line number Diff line number Diff line change 1+ // !$*UTF8*$!
2+ THIS SHOULD FAIL TO PARSE
3+ {
4+ archiveVersion = 1;
5+ classes = {
6+ };
7+ objectVersion = 45;
8+ rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
9+ objects = {
10+ /* Begin PBXTargetDependency section */
11+ 301BF551109A68C00062928A /* PBXTargetDependency */ = {
12+ isa = PBXTargetDependency;
13+ name = PhoneGapLib;
14+ targetProxy = 301BF550109A68C00062928A /* PBXContainerItemProxy */;
15+ };
16+ /* End PBXTargetDependency section */
17+ };
18+ }
Original file line number Diff line number Diff line change @@ -55,6 +55,14 @@ exports['parse function'] = {
5555 test . ok ( myProj . hash ) ;
5656 test . done ( ) ;
5757 } )
58+ } ,
59+ 'it should pass an error object back when the parsing fails' : function ( test ) {
60+ var myProj = new pbx ( 'test/parser/projects/fail.pbxproj' ) ;
61+
62+ myProj . parse ( function ( err , projHash ) {
63+ test . ok ( err ) ;
64+ test . done ( ) ;
65+ } )
5866 }
5967}
6068
You can’t perform that action at this time.
0 commit comments