mirror of
https://github.com/Microsoft/vscode
synced 2024-10-06 03:17:00 +00:00
291ec03bc3
* Initial commit for isolated smoke tests * Do not wait for the explorer view when restarting * Debug failed localization test * User data path suffix length * Kill server when application exits * Do not run yarn install * Refactor application start/stop * Reverted some changes * Missed one * One more change to revert * Restored one more file * Pull request feedback
43 lines
1.5 KiB
TypeScript
43 lines
1.5 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
import minimist = require('minimist');
|
|
import { Suite, Context } from 'mocha';
|
|
import { Application, ApplicationOptions } from '../../automation';
|
|
|
|
export function describeRepeat(n: number, description: string, callback: (this: Suite) => void): void {
|
|
for (let i = 0; i < n; i++) {
|
|
describe(`${description} (iteration ${i})`, callback);
|
|
}
|
|
}
|
|
|
|
export function itRepeat(n: number, description: string, callback: (this: Context) => any): void {
|
|
for (let i = 0; i < n; i++) {
|
|
it(`${description} (iteration ${i})`, callback);
|
|
}
|
|
}
|
|
|
|
export function beforeSuite(opts: minimist.ParsedArgs) {
|
|
before(async function () {
|
|
// https://github.com/microsoft/vscode/issues/34988
|
|
const options = this.defaultOptions as ApplicationOptions;
|
|
const userDataPathSuffix = [...Array(8)].map(() => Math.random().toString(36)[3]).join('');
|
|
const userDataDir = options.userDataDir.concat(`-${userDataPathSuffix}`);
|
|
|
|
const app = new Application({ ...options, userDataDir });
|
|
await app!.start(opts.web ? false : undefined);
|
|
this.app = app;
|
|
});
|
|
}
|
|
|
|
export function afterSuite() {
|
|
after(async function () {
|
|
const app = this.app as Application;
|
|
if (app) {
|
|
await app.stop();
|
|
}
|
|
});
|
|
}
|