Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/base/test/node/zip/zip.test.ts
3296 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import * as fs from 'fs';
7
import assert from 'assert';
8
import { tmpdir } from 'os';
9
import { createCancelablePromise } from '../../../common/async.js';
10
import { FileAccess } from '../../../common/network.js';
11
import * as path from '../../../common/path.js';
12
import { Promises } from '../../../node/pfs.js';
13
import { extract } from '../../../node/zip.js';
14
import { ensureNoDisposablesAreLeakedInTestSuite } from '../../common/utils.js';
15
import { getRandomTestPath } from '../testUtils.js';
16
17
suite('Zip', () => {
18
19
ensureNoDisposablesAreLeakedInTestSuite();
20
21
test('extract should handle directories', async () => {
22
const testDir = getRandomTestPath(tmpdir(), 'vsctests', 'zip');
23
await fs.promises.mkdir(testDir, { recursive: true });
24
25
const fixtures = FileAccess.asFileUri('vs/base/test/node/zip/fixtures').fsPath;
26
const fixture = path.join(fixtures, 'extract.zip');
27
28
await createCancelablePromise(token => extract(fixture, testDir, {}, token));
29
const doesExist = await Promises.exists(path.join(testDir, 'extension'));
30
assert(doesExist);
31
32
await Promises.rm(testDir);
33
});
34
});
35
36