File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ function NYC (config) {
4949 this . cwd = config . cwd || process . cwd ( )
5050 this . reporter = arrify ( config . reporter || 'text' )
5151
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 } )
5353 this . cache = Boolean ( this . cacheDirectory && config . cache )
5454
5555 this . exclude = testExclude ( {
Original file line number Diff line number Diff line change 11/* global describe, it */
22
33const NYC = require ( '../' )
4+ const path = require ( 'path' )
45
56require ( 'chai' ) . should ( )
67
@@ -27,4 +28,21 @@ describe('NYC', function () {
2728 nyc . _disableCachingTransform ( ) . should . equal ( false )
2829 } )
2930 } )
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+ } )
3048} )
You can’t perform that action at this time.
0 commit comments