@@ -29,6 +29,7 @@ import {
2929 getRecordingLogger ,
3030 LoggedMessage ,
3131 mockCodeQLVersion ,
32+ createTestConfig ,
3233} from "./testing-utils" ;
3334import {
3435 GitHubVariant ,
@@ -230,6 +231,63 @@ test("load code quality config", async (t) => {
230231 } ) ;
231232} ) ;
232233
234+ test ( "initActionState doesn't throw if there are queries configured in the repository properties" , async ( t ) => {
235+ return await withTmpDir ( async ( tempDir ) => {
236+ const logger = getRunnerLogger ( true ) ;
237+ const languages = "javascript" ;
238+
239+ const codeql = createStubCodeQL ( {
240+ async betterResolveLanguages ( ) {
241+ return {
242+ extractors : {
243+ javascript : [ { extractor_root : "" } ] ,
244+ } ,
245+ } ;
246+ } ,
247+ } ) ;
248+
249+ // This should be ignored and no error should be thrown.
250+ const repositoryProperties = {
251+ "github-codeql-extra-queries" : "+foo" ,
252+ } ;
253+
254+ // Expected configuration for a CQ-only analysis.
255+ const computedConfig : configUtils . UserConfig = {
256+ "disable-default-queries" : true ,
257+ queries : [ { uses : "code-quality" } ] ,
258+ "query-filters" : [ ] ,
259+ } ;
260+
261+ const expectedConfig = createTestConfig ( {
262+ analysisKinds : [ AnalysisKind . CodeQuality ] ,
263+ languages : [ KnownLanguage . javascript ] ,
264+ codeQLCmd : codeql . getPath ( ) ,
265+ computedConfig,
266+ dbLocation : path . resolve ( tempDir , "codeql_databases" ) ,
267+ debugArtifactName : "" ,
268+ debugDatabaseName : "" ,
269+ tempDir,
270+ repositoryProperties,
271+ } ) ;
272+
273+ await t . notThrowsAsync ( async ( ) => {
274+ const config = await configUtils . initConfig (
275+ createTestInitConfigInputs ( {
276+ analysisKindsInput : "code-quality" ,
277+ languagesInput : languages ,
278+ repository : { owner : "github" , repo : "example" } ,
279+ tempDir,
280+ codeql,
281+ repositoryProperties,
282+ logger,
283+ } ) ,
284+ ) ;
285+
286+ t . deepEqual ( config , expectedConfig ) ;
287+ } ) ;
288+ } ) ;
289+ } ) ;
290+
233291test ( "loading a saved config produces the same config" , async ( t ) => {
234292 return await withTmpDir ( async ( tempDir ) => {
235293 const logger = getRunnerLogger ( true ) ;
0 commit comments