Skip to content

Commit a3bf9f1

Browse files
committed
Handle different dependencies in remote queries tests
Starting in CLI 2.7.5, there will no longer be any `codeql/javascript-upgrades` pack. Change the test so that it passes using both old and new packs.
1 parent 72ff828 commit a3bf9f1

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

extensions/ql-vscode/src/vscode-tests/cli-integration/run-remote-query.test.ts

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,14 @@ describe('Remote queries', function() {
110110
expect(fs.existsSync(path.join(compiledPackDir, 'not-in-pack.ql'))).to.be.false;
111111
verifyQlPack(path.join(compiledPackDir, 'qlpack.yml'), 'in-pack.ql', '0.0.0', await pathSerializationBroken());
112112

113-
// dependencies
114113
const libraryDir = path.join(compiledPackDir, '.codeql/libraries/codeql');
115114
const packNames = fs.readdirSync(libraryDir).sort();
116-
expect(packNames).to.deep.equal(['javascript-all', 'javascript-upgrades']);
115+
116+
// check dependencies.
117+
// 2.7.4 and earlier have ['javascript-all', 'javascript-upgrades']
118+
// later only have ['javascript-all']. ensure this test can handle eitehr
119+
expect(packNames.length).to.be.lessThan(3).and.greaterThan(0);
120+
expect(packNames[0]).to.deep.equal('javascript-all');
117121
});
118122

119123
it('should run a remote query that is not part of a qlpack', async () => {
@@ -166,11 +170,15 @@ describe('Remote queries', function() {
166170
expect(qlpackContents.version).to.equal('0.0.0');
167171
expect(qlpackContents.dependencies?.['codeql/javascript-all']).to.equal('*');
168172

169-
// dependencies
170173
const libraryDir = path.join(compiledPackDir, '.codeql/libraries/codeql');
171174
printDirectoryContents(libraryDir);
172175
const packNames = fs.readdirSync(libraryDir).sort();
173-
expect(packNames).to.deep.equal(['javascript-all', 'javascript-upgrades']);
176+
177+
// check dependencies.
178+
// 2.7.4 and earlier have ['javascript-all', 'javascript-upgrades']
179+
// later only have ['javascript-all']. ensure this test can handle eitehr
180+
expect(packNames.length).to.be.lessThan(3).and.greaterThan(0);
181+
expect(packNames[0]).to.deep.equal('javascript-all');
174182
});
175183

176184
it('should run a remote query that is nested inside a qlpack', async () => {
@@ -222,11 +230,15 @@ describe('Remote queries', function() {
222230
expect(qlpackContents.version).to.equal('0.0.0');
223231
expect(qlpackContents.dependencies?.['codeql/javascript-all']).to.equal('*');
224232

225-
// dependencies
226233
const libraryDir = path.join(compiledPackDir, '.codeql/libraries/codeql');
227234
printDirectoryContents(libraryDir);
228235
const packNames = fs.readdirSync(libraryDir).sort();
229-
expect(packNames).to.deep.equal(['javascript-all', 'javascript-upgrades']);
236+
237+
// check dependencies.
238+
// 2.7.4 and earlier have ['javascript-all', 'javascript-upgrades']
239+
// later only have ['javascript-all']. ensure this test can handle eitehr
240+
expect(packNames.length).to.be.lessThan(3).and.greaterThan(0);
241+
expect(packNames[0]).to.deep.equal('javascript-all');
230242
});
231243

232244
it('should cancel a run before uploading', async () => {

0 commit comments

Comments
 (0)