@@ -36,6 +36,7 @@ import {
3636 mockCodeQLVersion ,
3737 createTestConfig ,
3838 makeMacro ,
39+ initAllState ,
3940} from "./testing-utils" ;
4041import {
4142 GitHubVariant ,
@@ -160,8 +161,9 @@ test.serial("load empty config", async (t) => {
160161 } ,
161162 } ) ;
162163
164+ const state = initAllState ( { logger } ) ;
163165 const config = await configUtils . initConfig (
164- createFeatures ( [ ] ) ,
166+ state ,
165167 createTestInitConfigInputs ( {
166168 languagesInput : languages ,
167169 repository : { owner : "github" , repo : "example" } ,
@@ -202,8 +204,9 @@ test.serial("load code quality config", async (t) => {
202204 } ,
203205 } ) ;
204206
207+ const state = initAllState ( { logger } ) ;
205208 const config = await configUtils . initConfig (
206- createFeatures ( [ ] ) ,
209+ state ,
207210 createTestInitConfigInputs ( {
208211 analysisKinds : [ AnalysisKind . CodeQuality ] ,
209212 languagesInput : languages ,
@@ -280,9 +283,10 @@ test.serial(
280283 repositoryProperties,
281284 } ) ;
282285
286+ const state = initAllState ( { logger } ) ;
283287 await t . notThrowsAsync ( async ( ) => {
284288 const config = await configUtils . initConfig (
285- createFeatures ( [ ] ) ,
289+ state ,
286290 createTestInitConfigInputs ( {
287291 analysisKinds : [ AnalysisKind . CodeQuality ] ,
288292 languagesInput : languages ,
@@ -321,8 +325,9 @@ test.serial("loading a saved config produces the same config", async (t) => {
321325 // Sanity check that getConfig returns undefined before we have called initConfig
322326 t . deepEqual ( await configUtils . getConfig ( tempDir , logger ) , undefined ) ;
323327
328+ const state = initAllState ( { logger } ) ;
324329 const config1 = await configUtils . initConfig (
325- createFeatures ( [ ] ) ,
330+ state ,
326331 createTestInitConfigInputs ( {
327332 languagesInput : "javascript,python" ,
328333 tempDir,
@@ -373,8 +378,9 @@ test.serial("loading config with version mismatch throws", async (t) => {
373378 . stub ( actionsUtil , "getActionVersion" )
374379 . returns ( "does-not-exist" ) ;
375380
381+ const state = initAllState ( { logger } ) ;
376382 const config = await configUtils . initConfig (
377- createFeatures ( [ ] ) ,
383+ state ,
378384 createTestInitConfigInputs ( {
379385 languagesInput : "javascript,python" ,
380386 tempDir,
@@ -402,8 +408,9 @@ test.serial("loading config with version mismatch throws", async (t) => {
402408test . serial ( "load input outside of workspace" , async ( t ) => {
403409 return await withTmpDir ( async ( tempDir ) => {
404410 try {
411+ const state = initAllState ( ) ;
405412 await configUtils . initConfig (
406- createFeatures ( [ ] ) ,
413+ state ,
407414 createTestInitConfigInputs ( {
408415 configFile : "../input" ,
409416 tempDir,
@@ -431,8 +438,9 @@ test.serial("load non-existent input", async (t) => {
431438 t . false ( fs . existsSync ( path . join ( tempDir , configFile ) ) ) ;
432439
433440 try {
441+ const state = initAllState ( ) ;
434442 await configUtils . initConfig (
435- createFeatures ( [ ] ) ,
443+ state ,
436444 createTestInitConfigInputs ( {
437445 languagesInput,
438446 configFile,
@@ -508,8 +516,9 @@ test.serial("load non-empty input", async (t) => {
508516 const languagesInput = "javascript" ;
509517 const configFilePath = createConfigFile ( inputFileContents , tempDir ) ;
510518
519+ const state = initAllState ( ) ;
511520 const actualConfig = await configUtils . initConfig (
512- createFeatures ( [ ] ) ,
521+ state ,
513522 createTestInitConfigInputs ( {
514523 languagesInput,
515524 buildModeInput : "none" ,
@@ -567,8 +576,9 @@ test.serial(
567576 // Only JS, python packs will be ignored
568577 const languagesInput = "javascript" ;
569578
579+ const state = initAllState ( ) ;
570580 const config = await configUtils . initConfig (
571- createFeatures ( [ ] ) ,
581+ state ,
572582 createTestInitConfigInputs ( {
573583 languagesInput,
574584 configFile : configFilePath ,
@@ -619,8 +629,9 @@ test.serial("API client used when reading remote config", async (t) => {
619629 const configFile = "octo-org/codeql-config/config.yaml@main" ;
620630 const languagesInput = "javascript" ;
621631
632+ const state = initAllState ( ) ;
622633 await configUtils . initConfig (
623- createFeatures ( [ ] ) ,
634+ state ,
624635 createTestInitConfigInputs ( {
625636 languagesInput,
626637 configFile,
@@ -641,9 +652,10 @@ test.serial(
641652 mockGetContents ( dummyResponse ) ;
642653
643654 const repoReference = "octo-org/codeql-config/config.yaml@main" ;
655+ const state = initAllState ( ) ;
644656 try {
645657 await configUtils . initConfig (
646- createFeatures ( [ ] ) ,
658+ state ,
647659 createTestInitConfigInputs ( {
648660 configFile : repoReference ,
649661 tempDir,
@@ -671,9 +683,10 @@ test.serial("Invalid format of remote config handled correctly", async (t) => {
671683 mockGetContents ( dummyResponse ) ;
672684
673685 const repoReference = "octo-org/codeql-config/config.yaml@main" ;
686+ const state = initAllState ( ) ;
674687 try {
675688 await configUtils . initConfig (
676- createFeatures ( [ ] ) ,
689+ state ,
677690 createTestInitConfigInputs ( {
678691 configFile : repoReference ,
679692 tempDir,
@@ -701,9 +714,10 @@ test.serial("No detected languages", async (t) => {
701714 } ,
702715 } ) ;
703716
717+ const state = initAllState ( ) ;
704718 try {
705719 await configUtils . initConfig (
706- createFeatures ( [ ] ) ,
720+ state ,
707721 createTestInitConfigInputs ( {
708722 tempDir,
709723 codeql,
@@ -724,9 +738,10 @@ test.serial("Unknown languages", async (t) => {
724738 return await withTmpDir ( async ( tempDir ) => {
725739 const languagesInput = "rubbish,english" ;
726740
741+ const state = initAllState ( ) ;
727742 try {
728743 await configUtils . initConfig (
729- createFeatures ( [ ] ) ,
744+ state ,
730745 createTestInitConfigInputs ( {
731746 languagesInput,
732747 tempDir,
0 commit comments