Skip to content

Commit 849f5d2

Browse files
Burt HarrisBurt Harris
Burt Harris
authored and
Burt Harris
committed
Fix test error reporting if symlink fails.
Catch EPERM errors on Windows and report as warning
1 parent 1168658 commit 849f5d2

11 files changed

+254
-166
lines changed

test/dest-modes.js

+14-12
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ var isWindows = require('./utils/is-windows');
1414
var applyUmask = require('./utils/apply-umask');
1515
var isDirectory = require('./utils/is-directory-mock');
1616
var testConstants = require('./utils/test-constants');
17+
var testStreams = require('./utils/test-streams');
18+
19+
var join = testStreams.join;
1720

1821
var from = miss.from;
1922
var pipe = miss.pipe;
20-
var concat = miss.concat;
2123

2224
var inputBase = testConstants.inputBase;
2325
var outputBase = testConstants.outputBase;
@@ -62,7 +64,7 @@ describe('.dest() with custom modes', function() {
6264
pipe([
6365
from.obj([file]),
6466
vfs.dest(outputBase, { cwd: __dirname }),
65-
concat(assert),
67+
join(assert),
6668
], done);
6769
});
6870

@@ -90,7 +92,7 @@ describe('.dest() with custom modes', function() {
9092
pipe([
9193
from.obj([file]),
9294
vfs.dest(outputBase, { cwd: __dirname }),
93-
concat(assert),
95+
join(assert),
9496
], done);
9597
});
9698

@@ -118,7 +120,7 @@ describe('.dest() with custom modes', function() {
118120
pipe([
119121
from.obj([file]),
120122
vfs.dest(outputBase, { cwd: __dirname }),
121-
concat(assert),
123+
join(assert),
122124
], done);
123125
});
124126

@@ -147,7 +149,7 @@ describe('.dest() with custom modes', function() {
147149
pipe([
148150
from.obj([file]),
149151
vfs.dest(outputBase, { cwd: __dirname }),
150-
concat(assert),
152+
join(assert),
151153
], done);
152154
});
153155

@@ -176,7 +178,7 @@ describe('.dest() with custom modes', function() {
176178
pipe([
177179
from.obj([file]),
178180
vfs.dest(outputBase, { cwd: __dirname }),
179-
concat(assert),
181+
join(assert),
180182
], done);
181183
});
182184

@@ -201,7 +203,7 @@ describe('.dest() with custom modes', function() {
201203
pipe([
202204
from.obj([file]),
203205
vfs.dest(outputBase, { cwd: __dirname, mode: expectedMode }),
204-
concat(assert),
206+
join(assert),
205207
], done);
206208
});
207209

@@ -234,7 +236,7 @@ describe('.dest() with custom modes', function() {
234236
pipe([
235237
from.obj([file]),
236238
vfs.dest(outputBase, { cwd: __dirname }),
237-
concat(assert),
239+
join(assert),
238240
], done);
239241
});
240242

@@ -271,7 +273,7 @@ describe('.dest() with custom modes', function() {
271273
pipe([
272274
from.obj([file1, file2]),
273275
vfs.dest(outputBase, { cwd: __dirname }),
274-
concat(assert),
276+
join(assert),
275277
], done);
276278
});
277279

@@ -302,7 +304,7 @@ describe('.dest() with custom modes', function() {
302304
mode: expectedFileMode,
303305
dirMode: expectedDirMode,
304306
}),
305-
concat(assert),
307+
join(assert),
306308
], done);
307309
});
308310

@@ -333,7 +335,7 @@ describe('.dest() with custom modes', function() {
333335
pipe([
334336
from.obj([file]),
335337
vfs.dest(outputBase, { cwd: __dirname }),
336-
concat(assert),
338+
join(assert),
337339
], done);
338340
});
339341

@@ -368,7 +370,7 @@ describe('.dest() with custom modes', function() {
368370
pipe([
369371
from.obj([file]),
370372
vfs.dest(outputBase, { cwd: __dirname }),
371-
concat(assert),
373+
join(assert),
372374
], done);
373375
});
374376

test/dest-owner.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ var vfs = require('../');
1010
var cleanup = require('./utils/cleanup');
1111
var isWindows = require('./utils/is-windows');
1212
var testConstants = require('./utils/test-constants');
13+
var testStreams = require('./utils/test-streams');
14+
15+
var join = testStreams.join;
1316

1417
var from = miss.from;
1518
var pipe = miss.pipe;
16-
var concat = miss.concat;
1719

1820
var inputBase = testConstants.inputBase;
1921
var outputBase = testConstants.outputBase;
@@ -54,7 +56,7 @@ describe('.dest() with custom owner', function() {
5456
pipe([
5557
from.obj([file]),
5658
vfs.dest(outputBase),
57-
concat(assert),
59+
join(assert),
5860
], done);
5961
});
6062

@@ -83,7 +85,7 @@ describe('.dest() with custom owner', function() {
8385
pipe([
8486
from.obj([file]),
8587
vfs.dest(outputBase),
86-
concat(assert),
88+
join(assert),
8789
], done);
8890
});
8991
});

test/dest-symlinks.js

+32-30
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ var cleanup = require('./utils/cleanup');
1313
var isWindows = require('./utils/is-windows');
1414
var isDirectory = require('./utils/is-directory-mock');
1515
var testConstants = require('./utils/test-constants');
16+
var testStreams = require('./utils/test-streams');
17+
18+
var join = testStreams.join;
19+
var mochaPump = testStreams.mochaPump;
1620

1721
var from = miss.from;
18-
var pipe = miss.pipe;
19-
var concat = miss.concat;
2022

2123
var inputBase = testConstants.inputBase;
2224
var outputBase = testConstants.outputBase;
@@ -52,10 +54,10 @@ describe('.dest() with symlinks', function() {
5254
expect(files[0].path).toEqual(outputPath);
5355
}
5456

55-
pipe([
57+
mochaPump(this, [
5658
from.obj([file]),
5759
vfs.dest(outputBase),
58-
concat(assert),
60+
join(assert),
5961
], done);
6062
});
6163

@@ -76,10 +78,10 @@ describe('.dest() with symlinks', function() {
7678
expect(outputLink).toEqual(path.normalize('../fixtures/test.txt'));
7779
}
7880

79-
pipe([
81+
mochaPump(this, [
8082
from.obj([file]),
8183
vfs.dest(outputBase, { relativeSymlinks: true }),
82-
concat(assert),
84+
join(assert),
8385
], done);
8486
});
8587

@@ -112,10 +114,10 @@ describe('.dest() with symlinks', function() {
112114
expect(lstats.isDirectory()).toEqual(false);
113115
}
114116

115-
pipe([
117+
mochaPump(this, [
116118
from.obj([file]),
117119
vfs.dest(outputBase),
118-
concat(assert),
120+
join(assert),
119121
], done);
120122
});
121123

@@ -149,10 +151,10 @@ describe('.dest() with symlinks', function() {
149151
expect(lstats.isDirectory()).toEqual(false);
150152
}
151153

152-
pipe([
154+
mochaPump(this, [
153155
from.obj([file]),
154156
vfs.dest(outputBase),
155-
concat(assert),
157+
join(assert),
156158
], done);
157159
});
158160

@@ -185,10 +187,10 @@ describe('.dest() with symlinks', function() {
185187
expect(lstats.isDirectory()).toEqual(false);
186188
}
187189

188-
pipe([
190+
mochaPump(this, [
189191
from.obj([file]),
190192
vfs.dest(outputBase, { useJunctions: false }),
191-
concat(assert),
193+
join(assert),
192194
], done);
193195
});
194196

@@ -227,10 +229,10 @@ describe('.dest() with symlinks', function() {
227229
expect(lstats.isDirectory()).toEqual(false);
228230
}
229231

230-
pipe([
232+
mochaPump(this, [
231233
from.obj([file]),
232234
vfs.dest(outputBase, { useJunctions: useJunctions }),
233-
concat(assert),
235+
join(assert),
234236
], done);
235237
});
236238

@@ -263,10 +265,10 @@ describe('.dest() with symlinks', function() {
263265
expect(lstats.isDirectory()).toEqual(false);
264266
}
265267

266-
pipe([
268+
mochaPump(this, [
267269
from.obj([file]),
268270
vfs.dest(outputBase, { relativeSymlinks: true }),
269-
concat(assert),
271+
join(assert),
270272
], done);
271273
});
272274

@@ -300,10 +302,10 @@ describe('.dest() with symlinks', function() {
300302
expect(lstats.isDirectory()).toEqual(false);
301303
}
302304

303-
pipe([
305+
mochaPump(this, [
304306
from.obj([file]),
305307
vfs.dest(outputBase, { useJunctions: true, relativeSymlinks: true }),
306-
concat(assert),
308+
join(assert),
307309
], done);
308310
});
309311

@@ -329,11 +331,11 @@ describe('.dest() with symlinks', function() {
329331
expect(outputLink).toEqual(path.normalize('../fixtures/test.txt'));
330332
}
331333

332-
pipe([
334+
mochaPump(this, [
333335
from.obj([file]),
334336
// The useJunctions option is ignored when file is not a directory
335337
vfs.dest(outputBase, { useJunctions: true, relativeSymlinks: true }),
336-
concat(assert),
338+
join(assert),
337339
], done);
338340
});
339341

@@ -369,10 +371,10 @@ describe('.dest() with symlinks', function() {
369371
expect(lstats.isDirectory()).toEqual(false);
370372
}
371373

372-
pipe([
374+
mochaPump(this, [
373375
from.obj([file]),
374376
vfs.dest(outputBase, { useJunctions: false, relativeSymlinks: true }),
375-
concat(assert),
377+
join(assert),
376378
], done);
377379
});
378380

@@ -399,10 +401,10 @@ describe('.dest() with symlinks', function() {
399401
fs.mkdirSync(outputBase);
400402
fs.writeFileSync(outputPath, existingContents);
401403

402-
pipe([
404+
mochaPump(this, [
403405
from.obj([file]),
404406
vfs.dest(outputBase, { overwrite: false }),
405-
concat(assert),
407+
join(assert),
406408
], done);
407409
});
408410

@@ -430,10 +432,10 @@ describe('.dest() with symlinks', function() {
430432
fs.mkdirSync(outputBase);
431433
fs.writeFileSync(outputPath, existingContents);
432434

433-
pipe([
435+
mochaPump(this, [
434436
from.obj([file]),
435437
vfs.dest(outputBase, { overwrite: true }),
436-
concat(assert),
438+
join(assert),
437439
], done);
438440
});
439441

@@ -465,10 +467,10 @@ describe('.dest() with symlinks', function() {
465467
fs.mkdirSync(outputBase);
466468
fs.writeFileSync(outputPath, existingContents);
467469

468-
pipe([
470+
mochaPump(this, [
469471
from.obj([file]),
470472
vfs.dest(outputBase, { overwrite: overwrite }),
471-
concat(assert),
473+
join(assert),
472474
], done);
473475
});
474476

@@ -500,10 +502,10 @@ describe('.dest() with symlinks', function() {
500502
fs.mkdirSync(outputBase);
501503
fs.writeFileSync(outputPath, existingContents);
502504

503-
pipe([
505+
mochaPump(this, [
504506
from.obj([file]),
505507
vfs.dest(outputBase, { overwrite: overwrite }),
506-
concat(assert),
508+
join(assert),
507509
], done);
508510
});
509511
});

0 commit comments

Comments
 (0)