@@ -18,6 +18,16 @@ const configDirPath = path.join(
1818 'configs' ,
1919) ;
2020
21+ const localMocks = path . join (
22+ fileURLToPath ( path . dirname ( import . meta. url ) ) ,
23+ '..' ,
24+ '..' ,
25+ '..' ,
26+ 'mocks' ,
27+ 'fixtures' ,
28+ 'configs' ,
29+ ) ;
30+
2131describe ( 'coreConfigMiddleware' , ( ) => {
2232 const CLI_DEFAULTS = {
2333 plugins : [ ] ,
@@ -29,7 +39,7 @@ describe('coreConfigMiddleware', () => {
2939 'should load a valid .%s config' ,
3040 async extension => {
3141 const config = await coreConfigMiddleware ( {
32- config : path . join ( configDirPath , `code-pushup.config.${ extension } ` ) ,
42+ config : path . join ( localMocks , `code-pushup.config.${ extension } ` ) ,
3343 ...CLI_DEFAULTS ,
3444 } ) ;
3545 expect ( config . config ) . toContain ( `code-pushup.config.${ extension } ` ) ;
@@ -46,11 +56,8 @@ describe('coreConfigMiddleware', () => {
4656 it ( 'should load config which relies on provided --tsconfig' , async ( ) => {
4757 await expect (
4858 coreConfigMiddleware ( {
49- config : path . join (
50- configDirPath ,
51- 'code-pushup.needs-tsconfig.config.ts' ,
52- ) ,
53- tsconfig : path . join ( configDirPath , 'tsconfig.json' ) ,
59+ config : path . join ( localMocks , 'code-pushup.needs-tsconfig.config.ts' ) ,
60+ tsconfig : path . join ( localMocks , 'tsconfig.alias.json' ) ,
5461 ...CLI_DEFAULTS ,
5562 } ) ,
5663 ) . resolves . toBeTruthy ( ) ;
@@ -60,11 +67,13 @@ describe('coreConfigMiddleware', () => {
6067 await expect (
6168 coreConfigMiddleware ( {
6269 config : path . join (
63- configDirPath ,
64- 'code-pushup.needs-tsconfig.config.ts' ,
70+ localMocks ,
71+ 'code-pushup.needs-tsconfig-fail .config.ts' ,
6572 ) ,
6673 ...CLI_DEFAULTS ,
6774 } ) ,
68- ) . rejects . toThrow ( "Cannot find package '@example/custom-plugin'" ) ;
75+ ) . rejects . toThrow (
76+ "Cannot find module '@definitely-non-existent-package/custom-plugin'" ,
77+ ) ;
6978 } ) ;
7079} ) ;
0 commit comments