Skip to content

Commit c3c5a2b

Browse files
committed
Use safeDel rather than del
1 parent 2056c7b commit c3c5a2b

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { expect } from 'chai';
2-
import * as del from 'del';
32
import * as path from 'path';
43
import * as fs from 'fs-extra';
54
import * as sinon from 'sinon';
@@ -160,20 +159,18 @@ describe('query-results', () => {
160159
describe('interpretResultsSarif', () => {
161160
let mockServer: CodeQLCliServer;
162161
let spy: Sinon.SinonExpectation;
163-
let interpretedResultsPath: string;
164162
const metadata = {
165163
kind: 'my-kind',
166164
id: 'my-id' as string | undefined,
167165
scored: undefined
168166
};
169167
const resultsPath = '123';
170-
168+
const interpretedResultsPath = path.join(tmpDir.name, 'interpreted.json');
171169
const sourceInfo = {};
172170

173171
beforeEach(() => {
174172
spy = sandbox.mock();
175173
spy.returns({ a: '1234' });
176-
interpretedResultsPath = path.join(tmpDir.name, 'interpreted.json');
177174

178175
mockServer = {
179176
interpretBqrsSarif: spy
@@ -182,7 +179,7 @@ describe('query-results', () => {
182179

183180
afterEach(async () => {
184181
sandbox.restore();
185-
await del(interpretedResultsPath);
182+
await safeDel(interpretedResultsPath);
186183
});
187184

188185
it('should interpretResultsSarif', async function() {
@@ -499,4 +496,12 @@ describe('query-results', () => {
499496
}
500497
return fqi;
501498
}
499+
500+
function safeDel(file: string) {
501+
try {
502+
fs.unlinkSync(file);
503+
} catch (e) {
504+
// ignore
505+
}
506+
}
502507
});

0 commit comments

Comments
 (0)