Remove error handling for now

This commit is contained in:
marcnjaramillo
2021-11-17 13:55:34 -08:00
parent 63129236d0
commit a666619289
4 changed files with 3 additions and 46 deletions

View File

@@ -4,7 +4,6 @@ import * as fs from 'fs-extra';
import * as path from 'path';
import { parser } from 'stream-json';
import { pick } from 'stream-json/filters/Pick';
import { verifier } from 'stream-json/utils/Verifier';
import Assembler = require('stream-json/Assembler');
import { chain } from 'stream-chain';
import * as sarif from 'sarif';
@@ -591,7 +590,6 @@ export class CodeQLCliServer implements Disposable {
fs.createReadStream(interpretedResultsPath),
p,
pick({filter: 'runs.0.results'}),
verifier()
]);
// Creates JavaScript objects from the token stream
@@ -599,10 +597,7 @@ export class CodeQLCliServer implements Disposable {
// Returns a constructed Log object with the results or an empty array if no results were found.
// If the parser fails for any reason, it will reject the promise.
return await new Promise((resolve, reject) => {
pipeline.on('error', (error) => {
reject(error);
});
return await new Promise((resolve) => {
asm.on('done', (asm) => {

View File

@@ -14,11 +14,6 @@ describe.only('cliServerTests', () => {
it('should return an empty array if there are no results', async () => {
const result = await CodeQLCliServer.parseSarif(__dirname + '/data/sarif/emptyResultsSarif.sarif');
expect(result.runs[0].results?.length).to.eq(0);
});
it('should throw an error if the file fails to parse', async () => {
const result = await CodeQLCliServer.parseSarif(__dirname + '/data/sarif/invalidSarif.sarif');
await expect(result).to.rejectedWith(/Error: Parsing output of interpretation failed: /);
expect(result.runs[0].results).to.be.empty;
});
});

View File

@@ -28,7 +28,7 @@
}
}
],
"results": [],
"results": []
]
}
]

View File

@@ -1,33 +0,0 @@
{
"version": "2.1.0",
"$schema": "http://json.schemastore.org/sarif-2.1.0-rtm.4",
"runs": [
{
"tool": {
"driver": {
"name": "ESLint",
"informationUri": "https://eslint.org",
"rules": [
{
"id": "no-unused-vars",
"shortDescription": {
"text": "disallow unused variables"
},
"helpUri": "https://eslint.org/docs/rules/no-unused-vars",
"properties": {
"category": "Variables"
}
}
]
}
},
"artifacts": [
{
"location": {
"uri": "file:///C:/dev/sarif/sarif-tutorials/samples/Introduction/simple-example.js"
}
}
],
}
]
}