Skip to content

Commit 454eded

Browse files
committed
de-windows cwd paths in tests
1 parent aa41310 commit 454eded

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

test/index.js

+12-11
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ function deWindows(p) {
1313
return p.replace(/\\/g, '/');
1414
}
1515

16+
var cwd = deWindows(process.cwd());
1617
var dir = deWindows(__dirname);
1718

1819
function suite(moduleName) {
@@ -357,18 +358,18 @@ function suite(moduleName) {
357358
it('emits all objects (unordered) when given multiple absolute paths and no cwd', function (done) {
358359
var expected = [
359360
{
360-
cwd: process.cwd(),
361+
cwd: cwd,
361362
base: dir + '/fixtures/whatsgoingon/hey/isaidhey/whatsgoingon',
362363
path:
363364
dir + '/fixtures/whatsgoingon/hey/isaidhey/whatsgoingon/test.txt',
364365
},
365366
{
366-
cwd: process.cwd(),
367+
cwd: cwd,
367368
base: dir + '/fixtures',
368369
path: dir + '/fixtures/test.coffee',
369370
},
370371
{
371-
cwd: process.cwd(),
372+
cwd: cwd,
372373
base: dir + '/fixtures/whatsgoingon',
373374
path: dir + '/fixtures/whatsgoingon/test.js',
374375
},
@@ -527,7 +528,7 @@ function suite(moduleName) {
527528

528529
it('works with direct paths and no cwd', function (done) {
529530
var expected = {
530-
cwd: process.cwd(),
531+
cwd: cwd,
531532
base: dir + '/fixtures',
532533
path: dir + '/fixtures/test.coffee',
533534
};
@@ -545,21 +546,21 @@ function suite(moduleName) {
545546

546547
it('works with a relative cwd', function (done) {
547548
var expected = {
548-
cwd: process.cwd() + '/test',
549+
cwd: cwd + '/test',
549550
base: dir + '/fixtures',
550551
path: dir + '/fixtures/test.coffee',
551552
};
552553

553-
var cwd = path.relative(process.cwd(), __dirname);
554-
555554
function assert(pathObjs) {
556555
expect(pathObjs.length).toEqual(1);
557556
expect(pathObjs[0]).toEqual(expected);
558557
}
559558

560559
stream.pipeline(
561560
[
562-
globStream(dir + '/fixtures/test.coffee', { cwd: cwd }),
561+
globStream(dir + '/fixtures/test.coffee', {
562+
cwd: path.relative(process.cwd(), __dirname),
563+
}),
563564
concat(assert),
564565
],
565566
done
@@ -568,7 +569,7 @@ function suite(moduleName) {
568569

569570
it('supports negative globs', function (done) {
570571
var expected = {
571-
cwd: process.cwd(),
572+
cwd: cwd,
572573
base: dir + '/fixtures/stuff',
573574
path: dir + '/fixtures/stuff/run.dmc',
574575
};
@@ -588,7 +589,7 @@ function suite(moduleName) {
588589

589590
it('supports negative file paths', function (done) {
590591
var expected = {
591-
cwd: process.cwd(),
592+
cwd: cwd,
592593
base: dir + '/fixtures/stuff',
593594
path: dir + '/fixtures/stuff/run.dmc',
594595
};
@@ -717,7 +718,7 @@ function suite(moduleName) {
717718

718719
it('resolves absolute paths when root option is given', function (done) {
719720
var expected = {
720-
cwd: process.cwd(),
721+
cwd: cwd,
721722
base: dir + '/fixtures',
722723
path: dir + '/fixtures/test.coffee',
723724
};

0 commit comments

Comments
 (0)