File tree 2 files changed +19
-1
lines changed
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ function NYC (config) {
49
49
this . cwd = config . cwd || process . cwd ( )
50
50
this . reporter = arrify ( config . reporter || 'text' )
51
51
52
- this . cacheDirectory = config . cacheDir || findCacheDir ( { name : 'nyc' , cwd : this . cwd } )
52
+ this . cacheDirectory = ( config . cacheDir && path . resolve ( config . cacheDir ) ) || findCacheDir ( { name : 'nyc' , cwd : this . cwd } )
53
53
this . cache = Boolean ( this . cacheDirectory && config . cache )
54
54
55
55
this . exclude = testExclude ( {
Original file line number Diff line number Diff line change 1
1
/* global describe, it */
2
2
3
3
const NYC = require ( '../' )
4
+ const path = require ( 'path' )
4
5
5
6
require ( 'chai' ) . should ( )
6
7
@@ -27,4 +28,21 @@ describe('NYC', function () {
27
28
nyc . _disableCachingTransform ( ) . should . equal ( false )
28
29
} )
29
30
} )
31
+
32
+ describe ( 'cacheDirectory' , function ( ) {
33
+ it ( 'should resolve default cache folder to absolute path' , function ( ) {
34
+ const nyc = new NYC ( {
35
+ cache : true
36
+ } )
37
+ path . isAbsolute ( nyc . cacheDirectory ) . should . equal ( true )
38
+ } )
39
+
40
+ it ( 'should resolve custom cache folder to absolute path' , function ( ) {
41
+ const nyc = new NYC ( {
42
+ cacheDir : '.nyc_cache' ,
43
+ cache : true
44
+ } )
45
+ path . isAbsolute ( nyc . cacheDirectory ) . should . equal ( true )
46
+ } )
47
+ } )
30
48
} )
You can’t perform that action at this time.
0 commit comments