Skip to content

Commit badbed9

Browse files
committed
Use safeDel rather than del
1 parent dcc51cc commit badbed9

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() {
@@ -493,4 +490,12 @@ describe('query-results', () => {
493490
}
494491
return fqi;
495492
}
493+
494+
function safeDel(file: string) {
495+
try {
496+
fs.unlinkSync(file);
497+
} catch (e) {
498+
// ignore
499+
}
500+
}
496501
});

0 commit comments

Comments
 (0)