diff --git a/test/smoke/src/areas/workbench/data-migration.test.ts b/test/smoke/src/areas/workbench/data-migration.test.ts index d95a7c3e3a2..d0a158d2207 100644 --- a/test/smoke/src/areas/workbench/data-migration.test.ts +++ b/test/smoke/src/areas/workbench/data-migration.test.ts @@ -4,11 +4,10 @@ *--------------------------------------------------------------------------------------------*/ import { Application, ApplicationOptions, Quality } from '../../../../automation'; -import { join } from 'path'; import { ParsedArgs } from 'minimist'; -import { afterSuite, startApp } from '../../utils'; +import { afterSuite, getRandomUserDataDir, startApp } from '../../utils'; -export function setup(opts: ParsedArgs, testDataPath: string) { +export function setup(opts: ParsedArgs) { describe('Data Migration (insiders -> insiders)', () => { @@ -90,7 +89,7 @@ export function setup(opts: ParsedArgs, testDataPath: string) { this.retries(2); } - const userDataDir = join(testDataPath, 'd2'); // different data dir from the other tests + const userDataDir = getRandomUserDataDir(this.defaultOptions); const stableOptions: ApplicationOptions = Object.assign({}, this.defaultOptions); stableOptions.codePath = stableCodePath; @@ -133,7 +132,7 @@ export function setup(opts: ParsedArgs, testDataPath: string) { this.skip(); } - const userDataDir = join(testDataPath, 'd3'); // different data dir from the other tests + const userDataDir = getRandomUserDataDir(this.defaultOptions); const stableOptions: ApplicationOptions = Object.assign({}, this.defaultOptions); stableOptions.codePath = stableCodePath; diff --git a/test/smoke/src/main.ts b/test/smoke/src/main.ts index fa6989e8b9d..f526eb19bf4 100644 --- a/test/smoke/src/main.ts +++ b/test/smoke/src/main.ts @@ -353,7 +353,7 @@ after(async function () { }); describe(`VSCode Smoke Tests (${opts.web ? 'Web' : 'Electron'})`, () => { - if (!opts.web) { setupDataMigrationTests(opts, testDataPath); } + if (!opts.web) { setupDataMigrationTests(opts); } if (!opts.web) { setupPreferencesTests(opts); } setupSearchTests(opts); setupNotebookTests(opts); diff --git a/test/smoke/src/utils.ts b/test/smoke/src/utils.ts index d4300a74be5..01f26878f93 100644 --- a/test/smoke/src/utils.ts +++ b/test/smoke/src/utils.ts @@ -30,11 +30,11 @@ export async function startApp(args: minimist.ParsedArgs, options: ApplicationOp options = await optionsTransform({ ...options }); } - // https://github.com/microsoft/vscode/issues/34988 - const userDataPathSuffix = [...Array(8)].map(() => Math.random().toString(36)[3]).join(''); - const userDataDir = options.userDataDir.concat(`-${userDataPathSuffix}`); + const app = new Application({ + ...options, + userDataDir: getRandomUserDataDir(options) + }); - const app = new Application({ ...options, userDataDir }); await app.start(); if (args.log) { @@ -45,6 +45,16 @@ export async function startApp(args: minimist.ParsedArgs, options: ApplicationOp return app; } +export function getRandomUserDataDir(options: ApplicationOptions): string { + + // Pick a random user data dir suffix that is not + // too long to not run into max path length issues + // https://github.com/microsoft/vscode/issues/34988 + const userDataPathSuffix = [...Array(8)].map(() => Math.random().toString(36)[3]).join(''); + + return options.userDataDir.concat(`-${userDataPathSuffix}`); +} + export function afterSuite(opts: minimist.ParsedArgs, appFn?: () => Application | undefined, joinFn?: () => Promise) { after(async function () { const app: Application = appFn?.() ?? this.app;