mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 02:28:34 +01:00
Smoke tests - run each suite in its own user-data-dir (#125670)
* 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
This commit is contained in:
@@ -3,7 +3,9 @@
|
||||
* 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++) {
|
||||
@@ -16,3 +18,25 @@ export function itRepeat(n: number, description: string, callback: (this: Contex
|
||||
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();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user