File tree Expand file tree Collapse file tree 4 files changed +9
-9
lines changed Expand file tree Collapse file tree 4 files changed +9
-9
lines changed Original file line number Diff line number Diff line change 4
4
"keywords" : [
5
5
" unit-testing"
6
6
],
7
- "version" : " 0.15 .0" ,
7
+ "version" : " 0.16 .0" ,
8
8
"author" : {
9
9
"name" : " Olivier Huin" ,
10
10
"url" : " https://github.com/olih"
Original file line number Diff line number Diff line change 1
1
import { fdir } from 'fdir' ;
2
2
3
- type ToConfigFunction = ( specFile : string ) => { specFile : string } ;
4
-
5
3
const isStringArray = ( value : unknown ) : value is string [ ] =>
6
4
typeof value === 'object' && value !== null && Array . isArray ( value ) ;
7
5
@@ -11,10 +9,10 @@ const isStringArray = (value: unknown): value is string[] =>
11
9
* @param toConfigWrapper function that takes a specFile and return the config
12
10
* @returns a list of configurations for the runner
13
11
*/
14
- export const toConfigList = async (
12
+ export async function toConfigList < A > (
15
13
specDir : string ,
16
- toConfigWrapper : ToConfigFunction
17
- ) : Promise < { specFile : string } [ ] > = > {
14
+ toConfigWrapper : ( specFile : string ) => A
15
+ ) : Promise < A [ ] > {
18
16
const crawler = new fdir ( )
19
17
. withBasePath ( )
20
18
. filter ( ( path ) => path . endsWith ( '.zest.yaml' ) ) ;
@@ -24,4 +22,4 @@ export const toConfigList = async (
24
22
} else {
25
23
return [ ] ;
26
24
}
27
- } ;
25
+ }
Original file line number Diff line number Diff line change 1
- export const version = '0.15 .0' ;
1
+ export const version = '0.16 .0' ;
Original file line number Diff line number Diff line change @@ -2,16 +2,18 @@ import { it } from 'node:test';
2
2
import { deepStrictEqual } from 'node:assert' ;
3
3
import { toConfigList } from '../src/runner.js' ;
4
4
5
- const toConfigFunction = ( specFile : string ) => ( { specFile } ) ;
5
+ const toConfigFunction = ( specFile : string ) => ( { specFile , additional : 'info' } ) ;
6
6
7
7
it ( 'should search for spec files' , async ( ) => {
8
8
const actual = await toConfigList ( 'spec' , toConfigFunction ) ;
9
9
deepStrictEqual ( actual , [
10
10
{
11
11
specFile : 'spec/dummy.zest.yaml' ,
12
+ additional : 'info' ,
12
13
} ,
13
14
{
14
15
specFile : 'spec/level2/dummy2.zest.yaml' ,
16
+ additional : 'info' ,
15
17
} ,
16
18
] ) ;
17
19
} ) ;
You can’t perform that action at this time.
0 commit comments