88 Uri ,
99 window ,
1010} from "vscode" ;
11- import * as os from "os" ;
1211import * as yaml from "js-yaml" ;
1312
1413import { QlPack } from "../../../remote-queries/run-remote-query" ;
@@ -20,7 +19,6 @@ import {
2019} from "../../../config" ;
2120import { UserCancellationException } from "../../../commandRunner" ;
2221import * as ghApiClient from "../../../remote-queries/gh-api/gh-api-client" ;
23- import { lte } from "semver" ;
2422import { Repository } from "../../../remote-queries/gh-api/repository" ;
2523import { createMockExtensionContext } from "../../no-workspace" ;
2624import { OutputChannelLogger } from "../../../logging" ;
@@ -138,8 +136,6 @@ describe("Remote queries", () => {
138136 workflow_run_id : 20 ,
139137 repositories_queried : [ "octodemo/hello-world-1" ] ,
140138 } ) ;
141-
142- executeCommandSpy . mockRestore ( ) ;
143139 } ) ;
144140
145141 it ( "should run a remote query that is part of a qlpack" , async ( ) => {
@@ -186,21 +182,13 @@ describe("Remote queries", () => {
186182 ) ;
187183 expect ( qlpackContents . name ) . toBe ( "codeql-remote/query" ) ;
188184
189- verifyQlPack (
190- "in-pack.ql" ,
191- packFS . fileContents ( "qlpack.yml" ) ,
192- "0.0.0" ,
193- await pathSerializationBroken ( ) ,
194- ) ;
185+ verifyQlPack ( "in-pack.ql" , packFS . fileContents ( "qlpack.yml" ) , "0.0.0" ) ;
195186
196187 const libraryDir = ".codeql/libraries/codeql" ;
197188 const packNames = packFS . directoryContents ( libraryDir ) . sort ( ) ;
198189
199190 // check dependencies.
200- // 2.7.4 and earlier have ['javascript-all', 'javascript-upgrades']
201- // later only have ['javascript-all']. ensure this test can handle either
202- expect ( packNames . length ) . to . be . lessThan ( 3 ) . toBeGreaterThan ( 0 ) ;
203- expect ( packNames [ 0 ] ) . toEqual ( "javascript-all" ) ;
191+ expect ( packNames ) . toEqual ( [ "javascript-all" ] ) ;
204192 } ) ;
205193
206194 it ( "should run a remote query that is not part of a qlpack" , async ( ) => {
@@ -242,12 +230,7 @@ describe("Remote queries", () => {
242230 expect ( packFS . fileExists ( "not-in-pack.ql" ) ) . toBe ( false ) ;
243231
244232 // the compiled pack
245- verifyQlPack (
246- "in-pack.ql" ,
247- packFS . fileContents ( "qlpack.yml" ) ,
248- "0.0.0" ,
249- await pathSerializationBroken ( ) ,
250- ) ;
233+ verifyQlPack ( "in-pack.ql" , packFS . fileContents ( "qlpack.yml" ) , "0.0.0" ) ;
251234
252235 // should have generated a correct qlpack file
253236 const qlpackContents : any = yaml . load (
@@ -261,10 +244,7 @@ describe("Remote queries", () => {
261244 const packNames = packFS . directoryContents ( libraryDir ) . sort ( ) ;
262245
263246 // check dependencies.
264- // 2.7.4 and earlier have ['javascript-all', 'javascript-upgrades']
265- // later only have ['javascript-all']. ensure this test can handle either
266- expect ( packNames . length ) . to . be . lessThan ( 3 ) . toBeGreaterThan ( 0 ) ;
267- expect ( packNames [ 0 ] ) . toEqual ( "javascript-all" ) ;
247+ expect ( packNames ) . toEqual ( [ "javascript-all" ] ) ;
268248 } ) ;
269249
270250 it ( "should run a remote query that is nested inside a qlpack" , async ( ) => {
@@ -309,7 +289,6 @@ describe("Remote queries", () => {
309289 "subfolder/in-pack.ql" ,
310290 packFS . fileContents ( "qlpack.yml" ) ,
311291 "0.0.0" ,
312- await pathSerializationBroken ( ) ,
313292 ) ;
314293
315294 // should have generated a correct qlpack file
@@ -324,10 +303,7 @@ describe("Remote queries", () => {
324303 const packNames = packFS . directoryContents ( libraryDir ) . sort ( ) ;
325304
326305 // check dependencies.
327- // 2.7.4 and earlier have ['javascript-all', 'javascript-upgrades']
328- // later only have ['javascript-all']. ensure this test can handle either
329- expect ( packNames . length ) . to . be . lessThan ( 3 ) . toBeGreaterThan ( 0 ) ;
330- expect ( packNames [ 0 ] ) . toEqual ( "javascript-all" ) ;
306+ expect ( packNames ) . toEqual ( [ "javascript-all" ] ) ;
331307 } ) ;
332308
333309 it ( "should cancel a run before uploading" , async ( ) => {
@@ -349,15 +325,9 @@ describe("Remote queries", () => {
349325 queryPath : string ,
350326 contents : Buffer ,
351327 packVersion : string ,
352- pathSerializationBroken : boolean ,
353328 ) {
354329 const qlPack = yaml . load ( contents . toString ( "utf-8" ) ) as QlPack ;
355330
356- if ( pathSerializationBroken ) {
357- // the path serialization is broken, so we force it to be the path in the pack to be same as the query path
358- qlPack . defaultSuite ! [ 1 ] . query = queryPath ;
359- }
360-
361331 // don't check the build metadata since it is variable
362332 delete ( qlPack as any ) . buildMetadata ;
363333
@@ -379,15 +349,6 @@ describe("Remote queries", () => {
379349 } ) ;
380350 }
381351
382- /**
383- * In version 2.7.2 and earlier, relative paths were not serialized correctly inside the qlpack.yml file.
384- * So, ignore part of the test for these versions.
385- *
386- * @returns true if path serialization is broken in this run
387- */
388- async function pathSerializationBroken ( ) {
389- return lte ( await cli . getVersion ( ) , "2.7.2" ) && os . platform ( ) === "win32" ;
390- }
391352 function getFile ( file : string ) : Uri {
392353 return Uri . file ( path . join ( baseDir , file ) ) ;
393354 }
0 commit comments