File tree 4 files changed +25
-2
lines changed
4 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -98,7 +98,10 @@ export class IstanbulCoverageProvider extends BaseCoverageProvider implements Co
98
98
relativePath : ! this . options . allowExternal ,
99
99
} )
100
100
101
- this . coverageFilesDirectory = resolve ( this . options . reportsDirectory , '.tmp' )
101
+ const shard = this . ctx . config . shard
102
+ const tempDirectory = `.tmp${ shard ? `-${ shard . index } -${ shard . count } ` : '' } `
103
+
104
+ this . coverageFilesDirectory = resolve ( this . options . reportsDirectory , tempDirectory )
102
105
}
103
106
104
107
resolveOptions ( ) {
Original file line number Diff line number Diff line change @@ -101,7 +101,10 @@ export class V8CoverageProvider extends BaseCoverageProvider implements Coverage
101
101
relativePath : ! this . options . allowExternal ,
102
102
} )
103
103
104
- this . coverageFilesDirectory = resolve ( this . options . reportsDirectory , '.tmp' )
104
+ const shard = this . ctx . config . shard
105
+ const tempDirectory = `.tmp${ shard ? `-${ shard . index } -${ shard . count } ` : '' } `
106
+
107
+ this . coverageFilesDirectory = resolve ( this . options . reportsDirectory , tempDirectory )
105
108
}
106
109
107
110
resolveOptions ( ) {
Original file line number Diff line number Diff line change
1
+ import { readdirSync } from 'node:fs'
2
+ import { expect , test } from 'vitest'
3
+
4
+ test ( 'temporary directory is postfixed with --shard value' , ( ) => {
5
+ const files = readdirSync ( './coverage' )
6
+
7
+ expect ( files ) . toContain ( '.tmp-1-4' )
8
+ expect ( files ) . not . toContain ( '.tmp' )
9
+ } )
Original file line number Diff line number Diff line change @@ -43,6 +43,14 @@ const testCases = [
43
43
} ,
44
44
assertionConfig : null ,
45
45
} ,
46
+ {
47
+ testConfig : {
48
+ name : 'temp directory with shard' ,
49
+ include : [ 'option-tests/shard.test.ts' ] ,
50
+ shard : '1/4' ,
51
+ } ,
52
+ assertionConfig : null ,
53
+ } ,
46
54
]
47
55
48
56
for ( const provider of [ 'v8' , 'istanbul' ] ) {
You can’t perform that action at this time.
0 commit comments