Skip to content

Commit 02a7628

Browse files
Drop utils/fs.getSubDirectories().
1 parent d0c4d87 commit 02a7628

File tree

2 files changed

+3
-26
lines changed

2 files changed

+3
-26
lines changed

src/client/common/utils/fs.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,8 @@
33

44
'use strict';
55

6-
import * as fs from 'fs';
7-
import * as path from 'path';
86
import * as tmp from 'tmp';
97

10-
export function getSubDirectories(rootDir: string): Promise<string[]> {
11-
return new Promise<string[]>(resolve => {
12-
fs.readdir(rootDir, (error, files) => {
13-
if (error) {
14-
return resolve([]);
15-
}
16-
const subDirs: string[] = [];
17-
files.forEach(name => {
18-
const fullPath = path.join(rootDir, name);
19-
try {
20-
if (fs.statSync(fullPath).isDirectory()) {
21-
subDirs.push(fullPath);
22-
}
23-
}
24-
// tslint:disable-next-line:no-empty one-line
25-
catch (ex) { }
26-
});
27-
resolve(subDirs);
28-
});
29-
});
30-
}
31-
328
export function createTemporaryFile(extension: string, temporaryDirectory?: string): Promise<{ filePath: string; cleanupCallback: Function }> {
339
// tslint:disable-next-line:no-any
3410
const options: any = { postfix: extension };

src/client/testing/common/managers/testConfigurationManager.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import * as path from 'path';
22
import { OutputChannel, QuickPickItem, Uri } from 'vscode';
33
import { IApplicationShell } from '../../../common/application/types';
4+
import { IFileSystem } from '../../../common/platform/types';
45
import { IInstaller, ILogger, IOutputChannel } from '../../../common/types';
56
import { createDeferred } from '../../../common/utils/async';
6-
import { getSubDirectories } from '../../../common/utils/fs';
77
import { IServiceContainer } from '../../../ioc/types';
88
import { ITestConfigSettingsService, ITestConfigurationManager } from '../../types';
99
import { TEST_OUTPUT_CHANNEL, UNIT_TEST_PRODUCTS } from '../constants';
@@ -101,7 +101,8 @@ export abstract class TestConfigurationManager implements ITestConfigurationMana
101101
return def.promise;
102102
}
103103
protected getTestDirs(rootDir: string): Promise<string[]> {
104-
return getSubDirectories(rootDir).then(subDirs => {
104+
const fs = this.serviceContainer.get<IFileSystem>(IFileSystem);
105+
return fs.getSubDirectories(rootDir).then(subDirs => {
105106
subDirs.sort();
106107

107108
// Find out if there are any dirs with the name test and place them on the top.

0 commit comments

Comments
 (0)