1
1
/* eslint-env mocha */
2
2
'use strict' ;
3
3
var path = require ( 'path' ) ;
4
- var File = require ( 'gulp-util' ) . File ;
4
+ var Vinyl = require ( 'vinyl' ) ;
5
5
require ( 'should' ) ;
6
6
var getFilepath = require ( './' ) ;
7
7
8
8
describe ( 'getFilepath' , function ( ) {
9
9
describe ( '(relative=false)' , function ( ) {
10
10
it ( 'returns the path relative to the source file\'s cwd' , function ( ) {
11
- var source = new File ( {
11
+ var source = new Vinyl ( {
12
12
cwd : __dirname ,
13
13
path : path . join ( __dirname , 'dir' , 'file.js' ) ,
14
14
base : path . join ( __dirname , 'dir' )
@@ -19,7 +19,7 @@ describe('getFilepath', function () {
19
19
} ) ;
20
20
21
21
it ( 'returns the unixified path relative to the source file\'s cwd' , function ( ) {
22
- var source = new File ( {
22
+ var source = new Vinyl ( {
23
23
cwd : 'C:\\a\\folder' ,
24
24
path : 'C:\\a\\folder\\dir\\file.js' ,
25
25
base : 'C:\\a\\folder\\dir'
@@ -32,12 +32,12 @@ describe('getFilepath', function () {
32
32
33
33
describe ( '(relative=true)' , function ( ) {
34
34
it ( 'returns the path relative to the target file\'s directory' , function ( ) {
35
- var target = new File ( {
35
+ var target = new Vinyl ( {
36
36
cwd : __dirname ,
37
37
path : path . join ( __dirname , 'dir1' , 'index.html' ) ,
38
38
base : path . join ( __dirname , 'dir1' )
39
39
} ) ;
40
- var source = new File ( {
40
+ var source = new Vinyl ( {
41
41
cwd : __dirname ,
42
42
path : path . join ( __dirname , 'dir2' , 'file.js' ) ,
43
43
base : path . join ( __dirname , 'dir2' )
@@ -48,12 +48,12 @@ describe('getFilepath', function () {
48
48
} ) ;
49
49
50
50
it ( 'returns the unixified path relative to the source file\'s cwd' , function ( ) {
51
- var target = new File ( {
51
+ var target = new Vinyl ( {
52
52
cwd : 'C:\\a\\folder' ,
53
53
path : 'C:\\a\\folder\\dir1\\index.html' ,
54
54
base : 'C:\\a\\folder\\dir1'
55
55
} ) ;
56
- var source = new File ( {
56
+ var source = new Vinyl ( {
57
57
cwd : 'C:\\a\\folder' ,
58
58
path : 'C:\\a\\folder\\dir2\\file.js' ,
59
59
base : 'C:\\a\\folder\\dir2'
@@ -66,7 +66,7 @@ describe('getFilepath', function () {
66
66
67
67
describe ( '(ignorePath)' , function ( ) {
68
68
it ( 'removes the provided `ignorePath` from the beginning of the path' , function ( ) {
69
- var source = new File ( {
69
+ var source = new Vinyl ( {
70
70
cwd : __dirname ,
71
71
path : path . join ( __dirname , 'dir' , 'file.js' ) ,
72
72
base : path . join ( __dirname , 'dir' )
@@ -77,7 +77,7 @@ describe('getFilepath', function () {
77
77
} ) ;
78
78
79
79
it ( 'removes the provided `ignorePath` even if it both begins and ends in a `/` from the beginning of the path' , function ( ) {
80
- var source = new File ( {
80
+ var source = new Vinyl ( {
81
81
cwd : __dirname ,
82
82
path : path . join ( __dirname , 'dir' , 'file.js' ) ,
83
83
base : path . join ( __dirname , 'dir' )
@@ -88,7 +88,7 @@ describe('getFilepath', function () {
88
88
} ) ;
89
89
90
90
it ( 'removes the provided `ignorePath`s from the beginning of the path' , function ( ) {
91
- var source = new File ( {
91
+ var source = new Vinyl ( {
92
92
cwd : __dirname ,
93
93
path : path . join ( __dirname , 'dir' , 'file.js' ) ,
94
94
base : path . join ( __dirname , 'dir' )
@@ -99,7 +99,7 @@ describe('getFilepath', function () {
99
99
} ) ;
100
100
101
101
it ( 'removes the provided `ignorePath` unixified from the beginning of the path' , function ( ) {
102
- var source = new File ( {
102
+ var source = new Vinyl ( {
103
103
cwd : __dirname ,
104
104
path : path . join ( __dirname , 'dir' , 'deep' , 'file.js' ) ,
105
105
base : path . join ( __dirname , 'dir' , 'deep' )
@@ -110,7 +110,7 @@ describe('getFilepath', function () {
110
110
} ) ;
111
111
112
112
it ( 'removes the provided `ignorePath` unixified from the beginning of a unixified path' , function ( ) {
113
- var source = new File ( {
113
+ var source = new Vinyl ( {
114
114
cwd : 'C:\\a\\folder' ,
115
115
path : 'C:\\a\\folder\\dir\\deep\\file.js' ,
116
116
base : 'C:\\a\\folder\\dir\\deep'
@@ -121,7 +121,7 @@ describe('getFilepath', function () {
121
121
} ) ;
122
122
123
123
it ( 'removes the provided `ignorePath` from the beginning of a unixified path' , function ( ) {
124
- var source = new File ( {
124
+ var source = new Vinyl ( {
125
125
cwd : 'C:\\a\\folder' ,
126
126
path : 'C:\\a\\folder\\dir\\deep\\file.js' ,
127
127
base : 'C:\\a\\folder\\dir\\deep'
@@ -134,7 +134,7 @@ describe('getFilepath', function () {
134
134
135
135
describe ( '(addRootSlash=true)' , function ( ) {
136
136
it ( 'prepends the path with a `/`' , function ( ) {
137
- var source = new File ( {
137
+ var source = new Vinyl ( {
138
138
cwd : __dirname ,
139
139
path : path . join ( __dirname , 'dir' , 'file.js' ) ,
140
140
base : path . join ( __dirname , 'dir' )
@@ -147,7 +147,7 @@ describe('getFilepath', function () {
147
147
148
148
describe ( '(addPrefix)' , function ( ) {
149
149
it ( 'prepends the prefix and a `/` to the path' , function ( ) {
150
- var source = new File ( {
150
+ var source = new Vinyl ( {
151
151
cwd : __dirname ,
152
152
path : path . join ( __dirname , 'dir' , 'file.js' ) ,
153
153
base : path . join ( __dirname , 'dir' )
@@ -158,7 +158,7 @@ describe('getFilepath', function () {
158
158
} ) ;
159
159
160
160
it ( 'keeps any leading `/` from the prefix' , function ( ) {
161
- var source = new File ( {
161
+ var source = new Vinyl ( {
162
162
cwd : __dirname ,
163
163
path : path . join ( __dirname , 'dir' , 'file.js' ) ,
164
164
base : path . join ( __dirname , 'dir' )
@@ -171,7 +171,7 @@ describe('getFilepath', function () {
171
171
172
172
describe ( '(addSuffix)' , function ( ) {
173
173
it ( 'appends the suffix to the path' , function ( ) {
174
- var source = new File ( {
174
+ var source = new Vinyl ( {
175
175
cwd : __dirname ,
176
176
path : path . join ( __dirname , 'dir' , 'file.js' ) ,
177
177
base : path . join ( __dirname , 'dir' )
0 commit comments