2
2
const { test} = require ( 'tap' ) ;
3
3
const { execCli} = require ( '../helper/cli' ) ;
4
4
5
- test ( 'correctly distributes the test files' , t => {
5
+ test ( 'correctly distributes more test files than CI_NODE_TOTAL ' , t => {
6
6
t . plan ( 3 ) ;
7
7
for ( let i = 0 ; i < 3 ; i ++ ) {
8
8
execCli ( [ ] , {
9
- dirname : 'fixture/parallel-runs' ,
9
+ dirname : 'fixture/parallel-runs/more-files-than-ci-total ' ,
10
10
env : {
11
11
AVA_FORCE_CI : 'ci' ,
12
12
CI_NODE_INDEX : String ( i ) ,
@@ -15,3 +15,31 @@ test('correctly distributes the test files', t => {
15
15
} , err => t . ifError ( err ) ) ;
16
16
}
17
17
} ) ;
18
+
19
+ test ( 'correctly distributes less test files than CI_NODE_TOTAL' , t => {
20
+ t . plan ( 3 ) ;
21
+ for ( let i = 0 ; i < 3 ; i ++ ) {
22
+ execCli ( [ ] , {
23
+ dirname : 'fixture/parallel-runs/less-files-than-ci-total' ,
24
+ env : {
25
+ AVA_FORCE_CI : 'ci' ,
26
+ CI_NODE_INDEX : String ( i ) ,
27
+ CI_NODE_TOTAL : '3'
28
+ }
29
+ } , err => t . ifError ( err ) ) ;
30
+ }
31
+ } ) ;
32
+
33
+ test ( 'fail when there are no files' , t => {
34
+ t . plan ( 3 ) ;
35
+ for ( let i = 0 ; i < 3 ; i ++ ) {
36
+ execCli ( [ ] , {
37
+ dirname : 'fixture/parallel-runs/no-files' ,
38
+ env : {
39
+ AVA_FORCE_CI : 'ci' ,
40
+ CI_NODE_INDEX : String ( i ) ,
41
+ CI_NODE_TOTAL : '3'
42
+ }
43
+ } , err => t . ok ( err ) ) ;
44
+ }
45
+ } ) ;
0 commit comments