@@ -4,7 +4,7 @@ var fs = require('fs')
4
4
var path = require ( 'path' )
5
5
var File = require ( 'vinyl' )
6
6
7
- // var isNode = !global.window
7
+ var isNode = ! global . window
8
8
9
9
// this comment is used by mocha, do not delete
10
10
/* global describe, before, it */
@@ -76,6 +76,10 @@ describe('IPFS Node.js API wrapper tests', function () {
76
76
77
77
describe ( '.add' , function ( ) {
78
78
it ( 'add file' , function ( done ) {
79
+ if ( ! isNode ) {
80
+ return done ( )
81
+ }
82
+
79
83
this . timeout ( 10000 )
80
84
81
85
var file = new File ( {
@@ -109,8 +113,11 @@ describe('IPFS Node.js API wrapper tests', function () {
109
113
} )
110
114
} )
111
115
112
- // Not working due to fs.lstat not being available in the browser
113
116
it ( 'add path' , function ( done ) {
117
+ if ( ! isNode ) {
118
+ return done ( )
119
+ }
120
+
114
121
this . timeout ( 10000 )
115
122
116
123
apiClients [ 'a' ] . add ( testfilePath , function ( err , res ) {
@@ -123,6 +130,9 @@ describe('IPFS Node.js API wrapper tests', function () {
123
130
} )
124
131
125
132
it ( 'add a nested dir' , function ( done ) {
133
+ if ( ! isNode ) {
134
+ return done ( )
135
+ }
126
136
this . timeout ( 10000 )
127
137
128
138
apiClients [ 'a' ] . add ( __dirname + '/test-folder' , { recursive : true } , function ( err , res ) {
@@ -165,6 +175,10 @@ describe('IPFS Node.js API wrapper tests', function () {
165
175
describe ( '.ls' , function ( ) {
166
176
var folder = 'QmaMTzaGBmdLrispnPRTESta4yDQdK4uKSVcQez2No4h6q'
167
177
it ( 'ls' , function ( done ) {
178
+ if ( ! isNode ) {
179
+ return done ( )
180
+ }
181
+
168
182
this . timeout ( 100000 )
169
183
170
184
apiClients [ 'a' ] . ls ( folder , function ( err , res ) {
0 commit comments