@@ -20,6 +20,10 @@ const ipfsd = require('../src')
20
20
21
21
const isWindows = os . platform ( ) === 'win32'
22
22
23
+ const VERSION_STRING = process . env . IPFS_JS ? 'js-ipfs version: 0.26.0' : 'ipfs version 0.4.11'
24
+ const API_PORT = process . env . IPFS_JS ? '5002' : '5001'
25
+ const GW_PORT = process . env . IPFS_JS ? '9090' : '8080'
26
+
23
27
describe ( 'daemon spawning' , ( ) => {
24
28
describe ( 'local daemon' , ( ) => {
25
29
const repoPath = '/tmp/ipfsd-ctl-test'
@@ -291,11 +295,15 @@ describe('daemon spawning', () => {
291
295
} )
292
296
} )
293
297
294
- it ( 'should give an error if setting an invalid config value' , ( done ) => {
295
- ipfsNode . setConfig ( 'Bootstrap' , 'true' , ( err ) => {
296
- expect ( err . message ) . to . match ( / f a i l e d t o s e t c o n f i g v a l u e / )
297
- done ( )
298
- } )
298
+ it ( 'should give an error if setting an invalid config value' , function ( done ) {
299
+ if ( ! process . env . IPFS_JS ) { // TODO: handle proper truthy/falsy
300
+ ipfsNode . setConfig ( 'Bootstrap' , 'true' , ( err ) => {
301
+ expect ( err . message ) . to . match ( / f a i l e d t o s e t c o n f i g v a l u e / )
302
+ done ( )
303
+ } )
304
+ } else {
305
+ this . skip ( )
306
+ }
299
307
} )
300
308
} )
301
309
@@ -313,7 +321,7 @@ describe('daemon spawning', () => {
313
321
it ( 'prints the version' , ( done ) => {
314
322
ipfsd . version ( ( err , version ) => {
315
323
expect ( err ) . to . not . exist ( )
316
- expect ( version ) . to . be . eql ( 'ipfs version 0.4.11' )
324
+ expect ( version ) . to . be . eql ( VERSION_STRING )
317
325
done ( )
318
326
} )
319
327
} )
@@ -378,7 +386,8 @@ describe('daemon spawning', () => {
378
386
} )
379
387
380
388
describe ( 'startDaemon' , ( ) => {
381
- it ( 'start and stop' , ( done ) => {
389
+ it ( 'start and stop' , function ( done ) {
390
+ this . timeout ( 20000 )
382
391
const dir = `${ os . tmpdir ( ) } /tmp-${ Date . now ( ) + '-' + Math . random ( ) . toString ( 36 ) } `
383
392
384
393
const check = ( cb ) => {
@@ -412,7 +421,9 @@ describe('daemon spawning', () => {
412
421
] , done )
413
422
} )
414
423
415
- it ( 'starts the daemon and returns valid API and gateway addresses' , ( done ) => {
424
+ it ( 'starts the daemon and returns valid API and gateway addresses' , function ( done ) {
425
+ this . timeout ( 20000 )
426
+
416
427
const dir = `${ os . tmpdir ( ) } /tmp-${ Date . now ( ) + '-' + Math . random ( ) . toString ( 36 ) } `
417
428
418
429
async . waterfall ( [
@@ -436,26 +447,30 @@ describe('daemon spawning', () => {
436
447
expect ( api ) . to . have . property ( 'gatewayHost' )
437
448
expect ( api ) . to . have . property ( 'gatewayPort' )
438
449
expect ( api . apiHost ) . to . equal ( '127.0.0.1' )
439
- expect ( api . apiPort ) . to . equal ( '5001' )
450
+ console . log ( API_PORT )
451
+ expect ( api . apiPort ) . to . equal ( API_PORT )
440
452
expect ( api . gatewayHost ) . to . equal ( '127.0.0.1' )
441
- expect ( api . gatewayPort ) . to . equal ( '8080' )
453
+ expect ( api . gatewayPort ) . to . equal ( GW_PORT )
442
454
443
455
daemon . stopDaemon ( done )
444
456
} )
445
457
} )
446
458
447
- it ( 'allows passing flags' , ( done ) => {
448
- ipfsd . disposable ( ( err , node ) => {
449
- expect ( err ) . to . not . exist ( )
450
-
451
- node . startDaemon ( [ '--should-not-exist' ] , ( err ) => {
452
- expect ( err ) . to . exist ( )
453
- expect ( err . message )
454
- . to . match ( / U n r e c o g n i z e d o p t i o n ' s h o u l d - n o t - e x i s t ' / )
459
+ it ( 'allows passing flags' , function ( done ) {
460
+ if ( ! process . env . IPFS_JS ) {
461
+ ipfsd . disposable ( ( err , node ) => {
462
+ expect ( err ) . to . not . exist ( )
463
+ node . startDaemon ( [ '--should-not-exist' ] , ( err ) => {
464
+ expect ( err ) . to . exist ( )
465
+ expect ( err . message )
466
+ . to . match ( / U n r e c o g n i z e d o p t i o n ' s h o u l d - n o t - e x i s t ' / )
455
467
456
- done ( )
468
+ done ( )
469
+ } )
457
470
} )
458
- } )
471
+ } else {
472
+ this . skip ( )
473
+ }
459
474
} )
460
475
} )
461
476
} )
0 commit comments