Skip to content

Commit 9369f77

Browse files
Finish tests
1 parent ee652d3 commit 9369f77

File tree

4 files changed

+42
-5
lines changed

4 files changed

+42
-5
lines changed

extensions/ql-vscode/src/cli.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -589,16 +589,19 @@ export class CodeQLCliServer implements Disposable {
589589
const pipeline = chain([
590590
fs.createReadStream(interpretedResultsPath),
591591
p,
592-
pick({filter: 'runs.0.results'}),
592+
pick({filter: 'runs.0.results'})
593593
]);
594594

595595
// Creates JavaScript objects from the token stream
596596
const asm = Assembler.connectTo(pipeline);
597597

598598
// Returns a constructed Log object with the results or an empty array if no results were found.
599599
// If the parser fails for any reason, it will reject the promise.
600-
return await new Promise((resolve) => {
601-
600+
return await new Promise((resolve, reject) => {
601+
pipeline.on('error', (error) => {
602+
reject(error);
603+
});
604+
602605
asm.on('done', (asm) => {
603606

604607
const log : sarif.Log = {

extensions/ql-vscode/src/vscode-tests/no-workspace/cli.test.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ import { CodeQLCliServer } from '../../cli';
66
chai.use(chaiAsPromised);
77
const expect = chai.expect;
88

9-
describe.only('cliServerTests', () => {
9+
describe.only('cliServerTests', function() {
10+
this.timeout(10000);
11+
1012
it('should parse a valid SARIF file', async () => {
1113
const result = await CodeQLCliServer.parseSarif(__dirname + '/data/sarif/validSarif.sarif');
1214
expect(result.runs.length).to.eq(1);

extensions/ql-vscode/src/vscode-tests/no-workspace/data/sarif/emptyResultsSarif.sarif

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
}
3030
],
3131
"results": []
32-
]
3332
}
3433
]
3534
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"version": "2.1.0",
3+
"$schema": "http://json.schemastore.org/sarif-2.1.0-rtm.4",
4+
"runs": [
5+
{
6+
"tool": {
7+
"driver": {
8+
"name": "ESLint",
9+
"informationUri": "https://eslint.org",
10+
"rules": [
11+
{
12+
"id": "no-unused-vars",
13+
"shortDescription": {
14+
"text": "disallow unused variables"
15+
},
16+
"helpUri": "https://eslint.org/docs/rules/no-unused-vars",
17+
"properties": {
18+
"category": "Variables"
19+
}
20+
}
21+
]
22+
}
23+
},
24+
"artifacts": [
25+
{
26+
"location": {
27+
"uri": "file:///C:/dev/sarif/sarif-tutorials/samples/Introduction/simple-example.js"
28+
}
29+
}
30+
]
31+
}
32+
]
33+
}

0 commit comments

Comments
 (0)