File tree Expand file tree Collapse file tree 2 files changed +22
-7
lines changed Expand file tree Collapse file tree 2 files changed +22
-7
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,13 @@ module.exports = function(glob, options) {
25
25
rootDir = escape ( rootDir ) ;
26
26
}
27
27
28
+ // store last character before glob is modified
29
+ var suffix = glob . slice ( - 1 ) ;
30
+
31
+ // check to see if glob is negated (and not a leading negated-extglob)
32
+ var ing = isNegated ( glob ) ;
33
+ glob = ing . pattern ;
34
+
28
35
// trim starting ./ from glob patterns
29
36
if ( glob . slice ( 0 , 2 ) === './' ) {
30
37
glob = glob . slice ( 2 ) ;
@@ -35,13 +42,6 @@ module.exports = function(glob, options) {
35
42
glob = '' ;
36
43
}
37
44
38
- // store last character before glob is modified
39
- var suffix = glob . slice ( - 1 ) ;
40
-
41
- // check to see if glob is negated (and not a leading negated-extglob)
42
- var ing = isNegated ( glob ) ;
43
- glob = ing . pattern ;
44
-
45
45
// make glob absolute
46
46
if ( rootDir && glob . charAt ( 0 ) === '/' ) {
47
47
glob = join ( rootDir , glob ) ;
Original file line number Diff line number Diff line change @@ -45,6 +45,21 @@ describe('resolve', function() {
45
45
assert . equal ( actual , '!' + unixify ( path . resolve ( 'a/*.js' ) ) ) ;
46
46
} ) ;
47
47
48
+ it ( 'should make a negative glob (starting with `./`) absolute' , function ( ) {
49
+ actual = resolve ( '!./a/*.js' ) ;
50
+ assert . equal ( actual , '!' + unixify ( path . resolve ( 'a/*.js' ) ) ) ;
51
+ } ) ;
52
+
53
+ it ( 'should make a negative glob (just `./`) absolute' , function ( ) {
54
+ actual = resolve ( '!./' ) ;
55
+ assert . equal ( actual , '!' + unixify ( path . resolve ( '.' ) ) + '/' ) ;
56
+ } ) ;
57
+
58
+ it ( 'should make a negative glob (just `.`) absolute' , function ( ) {
59
+ actual = resolve ( '!.' ) ;
60
+ assert . equal ( actual , '!' + unixify ( path . resolve ( '.' ) ) ) ;
61
+ } ) ;
62
+
48
63
it ( 'should make a negative extglob absolute' , function ( ) {
49
64
actual = resolve ( '!(foo)' ) ;
50
65
assert . equal ( actual , unixify ( path . resolve ( '!(foo)' ) ) ) ;
You can’t perform that action at this time.
0 commit comments