mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-24 09:35:37 -05:00
Merge VS Code 1.23.1 (#1520)
This commit is contained in:
31
src/vs/base/test/node/utils.ts
Normal file
31
src/vs/base/test/node/utils.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { join } from 'path';
|
||||
import { tmpdir } from 'os';
|
||||
import { mkdirp, del } from 'vs/base/node/pfs';
|
||||
|
||||
export interface ITestFileResult {
|
||||
testFile: string;
|
||||
cleanUp: () => TPromise<void>;
|
||||
}
|
||||
|
||||
export function testFile(folder: string, file: string): TPromise<ITestFileResult> {
|
||||
const id = generateUuid();
|
||||
const parentDir = join(tmpdir(), 'vsctests', id);
|
||||
const newDir = join(parentDir, 'config', id);
|
||||
const testFile = join(newDir, 'config.json');
|
||||
|
||||
return mkdirp(newDir, 493).then(() => {
|
||||
return {
|
||||
testFile,
|
||||
cleanUp: () => del(parentDir, tmpdir())
|
||||
} as ITestFileResult;
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user