@@ -58,51 +58,58 @@ describe('PBXProject', () => {
5858 } ) ;
5959
6060 describe ( 'parse function' , ( ) => {
61- it ( 'should emit an "end" event' , ( ) => {
61+ it ( 'should emit an "end" event' , ( t , done ) => {
6262 const myProj = new PBXProject ( 'test/parser/projects/hash.pbxproj' ) ;
6363
6464 myProj . parse ( ) . on ( 'end' , function ( ) {
65+ done ( ) ;
6566 } ) ;
6667 } ) ;
67- it ( 'should take the end callback as a parameter' , ( ) => {
68+ it ( 'should take the end callback as a parameter' , ( t , done ) => {
6869 const myProj = new PBXProject ( 'test/parser/projects/hash.pbxproj' ) ;
6970
7071 myProj . parse ( function ( ) {
72+ done ( ) ;
7173 } ) ;
7274 } ) ;
73- it ( 'should allow evented error handling' , ( ) => {
75+ it ( 'should allow evented error handling' , ( t , done ) => {
7476 const myProj = new PBXProject ( 'NotARealPath.pbxproj' ) ;
7577
7678 myProj . parse ( ) . on ( 'error' , function ( err ) {
7779 assert . equal ( typeof err , 'object' ) ;
80+ done ( ) ;
7881 } ) ;
7982 } ) ;
80- it ( 'should pass the hash object to the callback function' , ( ) => {
83+ it ( 'should pass the hash object to the callback function' , ( t , done ) => {
8184 const myProj = new PBXProject ( 'test/parser/projects/hash.pbxproj' ) ;
8285
8386 myProj . parse ( function ( _ , projHash ) {
8487 assert . ok ( projHash ) ;
88+ done ( ) ;
8589 } ) ;
8690 } ) ;
87- it ( 'should handle projects with comments in the header' , ( ) => {
91+ it ( 'should handle projects with comments in the header' , ( t , done ) => {
8892 const myProj = new PBXProject ( 'test/parser/projects/comments.pbxproj' ) ;
8993
9094 myProj . parse ( function ( _ , projHash ) {
9195 assert . ok ( projHash ) ;
96+ done ( ) ;
9297 } ) ;
9398 } ) ;
94- it ( 'should attach the hash object to the pbx object' , ( ) => {
99+ it ( 'should attach the hash object to the pbx object' , ( t , done ) => {
95100 const myProj = new PBXProject ( 'test/parser/projects/hash.pbxproj' ) ;
96101
97102 myProj . parse ( function ( ) {
98103 assert . ok ( myProj . hash ) ;
104+ done ( ) ;
99105 } ) ;
100106 } ) ;
101- it ( 'it should pass an error object back when the parsing fails' , ( ) => {
107+ it ( 'it should pass an error object back when the parsing fails' , ( t , done ) => {
102108 const myProj = new PBXProject ( 'test/parser/projects/fail.pbxproj' ) ;
103109
104110 myProj . parse ( function ( err , _ ) {
105111 assert . ok ( err ) ;
112+ done ( ) ;
106113 } ) ;
107114 } ) ;
108115 } ) ;
@@ -145,12 +152,13 @@ describe('PBXProject', () => {
145152 afterEach ( ( ) => {
146153 fs . writeFileSync ( bcpbx , original_pbx , 'utf-8' ) ;
147154 } ) ;
148- it ( 'should change the PRODUCT_NAME field in the .pbxproj file' , ( ) => {
155+ it ( 'should change the PRODUCT_NAME field in the .pbxproj file' , ( t , done ) => {
149156 const myProj = new PBXProject ( 'test/parser/projects/build-config.pbxproj' ) ;
150157 myProj . parse ( function ( ) {
151158 myProj . updateProductName ( 'furious anger' ) ;
152159 const newContents = myProj . writeSync ( ) ;
153160 assert . ok ( newContents . match ( / P R O D U C T _ N A M E \s * = \s * " f u r i o u s a n g e r " / ) ) ;
161+ done ( ) ;
154162 } ) ;
155163 } ) ;
156164 } ) ;
@@ -159,7 +167,7 @@ describe('PBXProject', () => {
159167 afterEach ( ( ) => {
160168 fs . writeFileSync ( bcpbx , original_pbx , 'utf-8' ) ;
161169 } ) ;
162- it ( 'should change build properties in the .pbxproj file' , ( ) => {
170+ it ( 'should change build properties in the .pbxproj file' , ( t , done ) => {
163171 const myProj = new PBXProject ( 'test/parser/projects/build-config.pbxproj' ) ;
164172 myProj . parse ( function ( ) {
165173 myProj . updateBuildProperty ( 'TARGETED_DEVICE_FAMILY' , '"arm"' ) ;
@@ -168,24 +176,27 @@ describe('PBXProject', () => {
168176 myProj . updateBuildProperty ( 'OTHER_LDFLAGS' , [ 'T' , 'E' , 'S' , 'T' ] ) ;
169177 newContents = myProj . writeSync ( ) ;
170178 assert . ok ( newContents . match ( / O T H E R _ L D F L A G S \s * = \s * \( \s * T , \s * E , \s * S , \s * T , \s * \) / ) ) ;
179+ done ( ) ;
171180 } ) ;
172181 } ) ;
173- it ( 'should change all targets in .pbxproj with multiple targets' , ( ) => {
182+ it ( 'should change all targets in .pbxproj with multiple targets' , ( t , done ) => {
174183 const myProj = new PBXProject ( 'test/parser/projects/multitarget.pbxproj' ) ;
175184 myProj . parse ( function ( ) {
176185 myProj . updateBuildProperty ( 'PRODUCT_BUNDLE_IDENTIFIER' , 'comcompanytest' ) ;
177186 const newContents = myProj . writeSync ( ) ;
178187 // Should be 10 times = 5 targets, debug and release each
179188 assert . ok ( newContents . match ( / P R O D U C T _ B U N D L E _ I D E N T I F I E R \s * = \s * c o m c o m p a n y t e s t / g) . length === 10 ) ;
189+ done ( ) ;
180190 } ) ;
181191 } ) ;
182- it ( 'should change only one target in .pbxproj with multiple targets' , ( ) => {
192+ it ( 'should change only one target in .pbxproj with multiple targets' , ( t , done ) => {
183193 const myProj = new PBXProject ( 'test/parser/projects/multitarget.pbxproj' ) ;
184194 myProj . parse ( function ( ) {
185195 myProj . updateBuildProperty ( 'PRODUCT_BUNDLE_IDENTIFIER' , 'comcompanytest' , null , 'MultiTargetTest' ) ;
186196 const newContents = myProj . writeSync ( ) ;
187197 // should be 2 times = one target debug and release
188198 assert . ok ( newContents . match ( / P R O D U C T _ B U N D L E _ I D E N T I F I E R \s * = \s * c o m c o m p a n y t e s t / g) . length === 2 ) ;
199+ done ( ) ;
189200 } ) ;
190201 } ) ;
191202 } ) ;
@@ -194,20 +205,22 @@ describe('PBXProject', () => {
194205 afterEach ( ( ) => {
195206 fs . writeFileSync ( bcpbx , original_pbx , 'utf-8' ) ;
196207 } ) ;
197- it ( 'should change all targets in .pbxproj with multiple targets' , ( ) => {
208+ it ( 'should change all targets in .pbxproj with multiple targets' , ( t , done ) => {
198209 const myProj = new PBXProject ( 'test/parser/projects/multitarget.pbxproj' ) ;
199210 myProj . parse ( function ( ) {
200211 myProj . updateBuildProperty ( 'PRODUCT_BUNDLE_IDENTIFIER' , 'comcompanytest' ) ;
201212 myProj . writeSync ( ) ;
202213 assert . ok ( myProj . getBuildProperty ( 'PRODUCT_BUNDLE_IDENTIFIER' ) === 'comcompanytest' ) ;
214+ done ( ) ;
203215 } ) ;
204216 } ) ;
205- it ( 'should change only one target in .pbxproj with multiple targets' , ( ) => {
217+ it ( 'should change only one target in .pbxproj with multiple targets' , ( t , done ) => {
206218 const myProj = new PBXProject ( 'test/parser/projects/multitarget.pbxproj' ) ;
207219 myProj . parse ( function ( ) {
208220 myProj . updateBuildProperty ( 'PRODUCT_BUNDLE_IDENTIFIER' , 'comcompanytest' , null , 'MultiTargetTest' ) ;
209221 myProj . writeSync ( ) ;
210222 assert . ok ( myProj . getBuildProperty ( 'PRODUCT_BUNDLE_IDENTIFIER' , undefined , 'MultiTargetTest' ) === 'comcompanytest' ) ;
223+ done ( ) ;
211224 } ) ;
212225 } ) ;
213226 } ) ;
@@ -216,28 +229,31 @@ describe('PBXProject', () => {
216229 afterEach ( ( ) => {
217230 fs . writeFileSync ( bcpbx , original_pbx , 'utf-8' ) ;
218231 } ) ;
219- it ( 'should add 4 build properties in the .pbxproj file' , ( ) => {
232+ it ( 'should add 4 build properties in the .pbxproj file' , ( t , done ) => {
220233 const myProj = new PBXProject ( 'test/parser/projects/build-config.pbxproj' ) ;
221234 myProj . parse ( function ( ) {
222235 myProj . addBuildProperty ( 'ENABLE_BITCODE' , 'NO' ) ;
223236 const newContents = myProj . writeSync ( ) ;
224237 assert . equal ( newContents . match ( / E N A B L E _ B I T C O D E \s * = \s * N O / g) . length , 4 ) ;
238+ done ( ) ;
225239 } ) ;
226240 } ) ;
227- it ( 'should add 2 build properties in the .pbxproj file for specific build' , ( ) => {
241+ it ( 'should add 2 build properties in the .pbxproj file for specific build' , ( t , done ) => {
228242 const myProj = new PBXProject ( 'test/parser/projects/build-config.pbxproj' ) ;
229243 myProj . parse ( function ( ) {
230244 myProj . addBuildProperty ( 'ENABLE_BITCODE' , 'NO' , 'Release' ) ;
231245 const newContents = myProj . writeSync ( ) ;
232246 assert . equal ( newContents . match ( / E N A B L E _ B I T C O D E \s * = \s * N O / g) . length , 2 ) ;
247+ done ( ) ;
233248 } ) ;
234249 } ) ;
235- it ( 'should not add build properties in the .pbxproj file for nonexist build' , ( ) => {
250+ it ( 'should not add build properties in the .pbxproj file for nonexist build' , ( t , done ) => {
236251 const myProj = new PBXProject ( 'test/parser/projects/build-config.pbxproj' ) ;
237252 myProj . parse ( function ( ) {
238253 myProj . addBuildProperty ( 'ENABLE_BITCODE' , 'NO' , 'nonexist' ) ;
239254 const newContents = myProj . writeSync ( ) ;
240255 assert . ok ( ! newContents . match ( / E N A B L E _ B I T C O D E \s * = \s * N O / g) ) ;
256+ done ( ) ;
241257 } ) ;
242258 } ) ;
243259 } ) ;
@@ -246,36 +262,40 @@ describe('PBXProject', () => {
246262 afterEach ( ( ) => {
247263 fs . writeFileSync ( bcpbx , original_pbx , 'utf-8' ) ;
248264 } ) ;
249- it ( 'should remove all build properties in the .pbxproj file' , ( ) => {
265+ it ( 'should remove all build properties in the .pbxproj file' , ( t , done ) => {
250266 const myProj = new PBXProject ( 'test/parser/projects/build-config.pbxproj' ) ;
251267 myProj . parse ( function ( ) {
252268 myProj . removeBuildProperty ( 'IPHONEOS_DEPLOYMENT_TARGET' ) ;
253269 const newContents = myProj . writeSync ( ) ;
254270 assert . ok ( ! newContents . match ( / I P H O N E O S _ D E P L O Y M E N T _ T A R G E T / ) ) ;
271+ done ( ) ;
255272 } ) ;
256273 } ) ;
257- it ( 'should remove specific build properties in the .pbxproj file' , ( ) => {
274+ it ( 'should remove specific build properties in the .pbxproj file' , ( t , done ) => {
258275 const myProj = new PBXProject ( 'test/parser/projects/build-config.pbxproj' ) ;
259276 myProj . parse ( function ( ) {
260277 myProj . removeBuildProperty ( 'IPHONEOS_DEPLOYMENT_TARGET' , 'Debug' ) ;
261278 const newContents = myProj . writeSync ( ) ;
262279 assert . equal ( newContents . match ( / I P H O N E O S _ D E P L O Y M E N T _ T A R G E T / g) . length , 2 ) ;
280+ done ( ) ;
263281 } ) ;
264282 } ) ;
265- it ( 'should not remove any build properties in the .pbxproj file' , ( ) => {
283+ it ( 'should not remove any build properties in the .pbxproj file' , ( t , done ) => {
266284 const myProj = new PBXProject ( 'test/parser/projects/build-config.pbxproj' ) ;
267285 myProj . parse ( function ( ) {
268286 myProj . removeBuildProperty ( 'IPHONEOS_DEPLOYMENT_TARGET' , 'notexist' ) ;
269287 const newContents = myProj . writeSync ( ) ;
270288 assert . equal ( newContents . match ( / I P H O N E O S _ D E P L O Y M E N T _ T A R G E T / g) . length , 4 ) ;
289+ done ( ) ;
271290 } ) ;
272291 } ) ;
273- it ( 'should fine with remove inexist build properties in the .pbxproj file' , ( ) => {
292+ it ( 'should fine with remove inexist build properties in the .pbxproj file' , ( t , done ) => {
274293 const myProj = new PBXProject ( 'test/parser/projects/build-config.pbxproj' ) ;
275294 myProj . parse ( function ( ) {
276295 myProj . removeBuildProperty ( 'ENABLE_BITCODE' ) ;
277296 const newContents = myProj . writeSync ( ) ;
278297 assert . ok ( ! newContents . match ( / E N A B L E _ B I T C O D E / ) ) ;
298+ done ( ) ;
279299 } ) ;
280300 } ) ;
281301 } ) ;
@@ -290,21 +310,23 @@ describe('PBXProject', () => {
290310 } ) ;
291311
292312 describe ( 'addPluginFile function' , ( ) => {
293- it ( 'should strip the Plugin path prefix' , ( ) => {
313+ it ( 'should strip the Plugin path prefix' , ( t , done ) => {
294314 const myProj = new PBXProject ( 'test/parser/projects/full.pbxproj' ) ;
295315
296316 myProj . parse ( function ( ) {
297317 assert . equal ( myProj . addPluginFile ( 'Plugins/testMac.m' ) . path , 'testMac.m' ) ;
298318 assert . equal ( myProj . addPluginFile ( 'Plugins\\testWin.m' ) . path , 'testWin.m' ) ;
319+ done ( ) ;
299320 } ) ;
300321 } ) ;
301- it ( 'should add files to the .pbxproj file using the / path seperator' , ( ) => {
322+ it ( 'should add files to the .pbxproj file using the / path seperator' , ( t , done ) => {
302323 const myProj = new PBXProject ( 'test/parser/projects/full.pbxproj' ) ;
303324
304325 myProj . parse ( function ( ) {
305326 const file = myProj . addPluginFile ( 'myPlugin\\newFile.m' ) ;
306327
307328 assert . equal ( myProj . pbxFileReferenceSection ( ) [ file . fileRef ] . path , '"myPlugin/newFile.m"' ) ;
329+ done ( ) ;
308330 } ) ;
309331 } ) ;
310332 } ) ;
0 commit comments