1
- import { CoreConfig , PluginConfig , PluginReport , Report } from '../../src' ;
1
+ import {
2
+ CoreConfig ,
3
+ PluginConfig ,
4
+ PluginReport ,
5
+ Report ,
6
+ coreConfigSchema ,
7
+ } from '../../src' ;
2
8
import { categoryConfigs } from './categories.mock' ;
3
9
import { eslintPluginConfig } from './eslint-plugin.mock' ;
4
10
import { lighthousePluginConfig } from './lighthouse-plugin.mock' ;
11
+ import { persistConfig } from './persist-config.mock' ;
5
12
import { auditReport , pluginConfig } from './plugin-config.mock' ;
6
13
7
14
export function config ( outputDir = 'tmp' ) : CoreConfig {
8
15
return {
9
- persist : { outputDir } ,
16
+ persist : persistConfig ( { outputDir } ) ,
10
17
upload : {
11
18
organization : 'code-pushup' ,
12
19
project : 'cli' ,
@@ -25,38 +32,38 @@ export function minimalConfig(
25
32
const AUDIT_1_SLUG = 'audit-1' ;
26
33
const outputFile = `${ PLUGIN_1_SLUG } .${ Date . now ( ) } .json` ;
27
34
28
- return JSON . parse (
29
- JSON . stringify ( {
30
- persist : { outputDir } ,
31
- upload : {
32
- organization : 'code-pushup' ,
33
- project : 'cli' ,
34
- apiKey : 'dummy-api-key' ,
35
- server : 'https://example.com/api' ,
35
+ const cfg = coreConfigSchema . parse ( {
36
+ persist : persistConfig ( { outputDir } ) ,
37
+ upload : {
38
+ organization : 'code-pushup' ,
39
+ project : 'cli' ,
40
+ apiKey : 'dummy-api-key' ,
41
+ server : 'https://example.com/api' ,
42
+ } ,
43
+ categories : [
44
+ {
45
+ slug : 'category-1' ,
46
+ title : 'Category 1' ,
47
+ refs : [
48
+ {
49
+ type : 'audit' ,
50
+ plugin : PLUGIN_1_SLUG ,
51
+ slug : AUDIT_1_SLUG ,
52
+ weight : 1 ,
53
+ } ,
54
+ ] ,
36
55
} ,
37
- categories : [
38
- {
39
- slug : 'category-1' ,
40
- title : 'Category 1' ,
41
- refs : [
42
- {
43
- type : 'audit' ,
44
- plugin : PLUGIN_1_SLUG ,
45
- slug : AUDIT_1_SLUG ,
46
- weight : 1 ,
47
- } ,
48
- ] ,
49
- } ,
50
- ] ,
51
- plugins : [
52
- pluginConfig ( [ auditReport ( { slug : AUDIT_1_SLUG } ) ] , {
53
- slug : PLUGIN_1_SLUG ,
54
- outputDir,
55
- outputFile,
56
- } ) ,
57
- ] ,
58
- } satisfies Omit < CoreConfig , 'upload' > & Required < Pick < CoreConfig , 'upload' > > ) ,
59
- ) ;
56
+ ] ,
57
+ plugins : [
58
+ pluginConfig ( [ auditReport ( { slug : AUDIT_1_SLUG } ) ] , {
59
+ slug : PLUGIN_1_SLUG ,
60
+ outputDir,
61
+ outputFile,
62
+ } ) ,
63
+ ] ,
64
+ } ) ;
65
+
66
+ return JSON . parse ( JSON . stringify ( cfg ) ) ;
60
67
}
61
68
62
69
export function minimalReport ( outputDir = 'tmp' ) : Report {
0 commit comments