diff --git a/build/azure-pipelines/linux/product-build-linux.yml b/build/azure-pipelines/linux/product-build-linux.yml index 8181083d1f2..297c40ac28c 100644 --- a/build/azure-pipelines/linux/product-build-linux.yml +++ b/build/azure-pipelines/linux/product-build-linux.yml @@ -48,7 +48,7 @@ steps: - task: Cache@2 inputs: - key: 'nodeModules | $(Agent.OS) | .build/yarnlockhash' + key: "nodeModules | $(Agent.OS) | .build/yarnlockhash" path: .build/node_modules_cache cacheHitVar: NODE_MODULES_RESTORED displayName: Restore node_modules cache @@ -131,14 +131,14 @@ steps: - script: | set -e - DISPLAY=:10 ./scripts/test.sh --build --tfs "Unit Tests" + ./scripts/test.sh --build --tfs "Unit Tests" displayName: Run unit tests (Electron) timeoutInMinutes: 7 condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false')) - script: | set -e - DISPLAY=:10 yarn test-browser --build --browser chromium --tfs "Browser Unit Tests" + yarn test-browser --build --browser chromium --tfs "Browser Unit Tests" displayName: Run unit tests (Browser) timeoutInMinutes: 7 condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false')) @@ -159,7 +159,7 @@ steps: INTEGRATION_TEST_APP_NAME="$APP_NAME" \ INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME" \ VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-linux-$(VSCODE_ARCH)" \ - DISPLAY=:10 ./scripts/test-integration.sh --build --tfs "Integration Tests" + ./scripts/test-integration.sh --build --tfs "Integration Tests" displayName: Run integration tests (Electron) timeoutInMinutes: 10 condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false')) @@ -167,7 +167,7 @@ steps: - script: | set -e VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-web-linux-$(VSCODE_ARCH)" \ - DISPLAY=:10 ./resources/server/test/test-web-integration.sh --browser chromium + ./resources/server/test/test-web-integration.sh --browser chromium displayName: Run integration tests (Browser) timeoutInMinutes: 10 condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false')) @@ -179,11 +179,42 @@ steps: INTEGRATION_TEST_APP_NAME="$APP_NAME" \ INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME" \ VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-linux-$(VSCODE_ARCH)" \ - DISPLAY=:10 ./resources/server/test/test-remote-integration.sh + ./resources/server/test/test-remote-integration.sh displayName: Run remote integration tests (Electron) timeoutInMinutes: 7 condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false')) + - script: | + set -e + yarn --cwd test/smoke compile + displayName: Compile smoke tests + condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false')) + + - script: | + set -e + APP_PATH=$(agent.builddirectory)/VSCode-linux-$(VSCODE_ARCH) + yarn smoketest-no-compile --build "$APP_PATH" --electronArgs="--disable-setuid-sandbox --disable-dev-shm-usage --use-gl=swiftshader" + timeoutInMinutes: 5 + displayName: Run smoke tests (Electron) + condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false')) + + - script: | + set -e + APP_PATH=$(agent.builddirectory)/VSCode-linux-$(VSCODE_ARCH) + VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-linux-$(VSCODE_ARCH)" \ + yarn smoketest-no-compile --build "$APP_PATH" --remote --electronArgs="--disable-setuid-sandbox --disable-dev-shm-usage --use-gl=swiftshader" + timeoutInMinutes: 5 + displayName: Run smoke tests (Remote) + condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false')) + + - script: | + set -e + VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-web-linux-$(VSCODE_ARCH)" \ + yarn smoketest-no-compile --web --headless --electronArgs="--disable-setuid-sandbox --disable-dev-shm-usage --use-gl=swiftshader" + timeoutInMinutes: 5 + displayName: Run smoke tests (Browser) + condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false')) + - task: PublishPipelineArtifact@0 inputs: artifactName: "crash-dump-linux-$(VSCODE_ARCH)" diff --git a/build/azure-pipelines/product-build.yml b/build/azure-pipelines/product-build.yml index 2c475b9dedd..341e5d5dc46 100644 --- a/build/azure-pipelines/product-build.yml +++ b/build/azure-pipelines/product-build.yml @@ -176,6 +176,7 @@ stages: variables: VSCODE_ARCH: x64 NPM_ARCH: x64 + DISPLAY: ":10" steps: - template: linux/product-build-linux.yml diff --git a/test/automation/package.json b/test/automation/package.json index 823dfa5027d..59c7da43bf2 100644 --- a/test/automation/package.json +++ b/test/automation/package.json @@ -31,7 +31,7 @@ "npm-run-all": "^4.1.5", "tmp": "0.1.0", "tree-kill": "1.2.2", - "typescript": "3.7.5", + "typescript": "^4.3.2", "vscode-uri": "^2.0.3", "watch": "^1.0.2" } diff --git a/test/automation/src/application.ts b/test/automation/src/application.ts index 800660efb36..1747f3d872f 100644 --- a/test/automation/src/application.ts +++ b/test/automation/src/application.ts @@ -123,17 +123,8 @@ export class Application { private async startApplication(extraArgs: string[] = []): Promise { this._code = await spawn({ - codePath: this.options.codePath, - workspacePath: this.workspacePathOrFolder, - userDataDir: this.userDataPath, - extensionsPath: this.options.extensionsPath, - logger: this.options.logger, - verbose: this.options.verbose, - log: this.options.log, - extraArgs, - remote: this.options.remote, - web: this.options.web, - browser: this.options.browser + ...this.options, + extraArgs: [...(this.options.extraArgs || []), ...extraArgs], }); this._workbench = new Workbench(this._code, this.userDataPath); diff --git a/test/automation/src/code.ts b/test/automation/src/code.ts index ed64781f1cf..a4370526b07 100644 --- a/test/automation/src/code.ts +++ b/test/automation/src/code.ts @@ -128,7 +128,7 @@ export async function spawn(options: SpawnOptions): Promise { return connect(connectDriver, child, '', handle, options.logger); } - const env = process.env; + const env = { ...process.env }; const codePath = options.codePath; const outPath = codePath ? getBuildOutPath(codePath) : getDevOutPath(); @@ -236,7 +236,7 @@ async function poll( } else { lastError = 'Did not pass accept function'; } - } catch (e) { + } catch (e: any) { lastError = Array.isArray(e.stack) ? e.stack.join(os.EOL) : e.stack; } diff --git a/test/automation/yarn.lock b/test/automation/yarn.lock index 71d52ecb42f..255c3ef3402 100644 --- a/test/automation/yarn.lock +++ b/test/automation/yarn.lock @@ -659,10 +659,10 @@ tree-kill@1.2.2: resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.2.tgz#4ca09a9092c88b73a7cdc5e8a01b507b0790a0cc" integrity sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A== -typescript@3.7.5: - version "3.7.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.5.tgz#0692e21f65fd4108b9330238aac11dd2e177a1ae" - integrity sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw== +typescript@^4.3.2: + version "4.3.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.2.tgz#399ab18aac45802d6f2498de5054fcbbe716a805" + integrity sha512-zZ4hShnmnoVnAHpVHWpTcxdv7dWP60S2FsydQLV8V5PbS3FifjWFFRiHSWpDJahly88PRyV5teTSLoq4eG7mKw== universalify@^2.0.0: version "2.0.0" diff --git a/test/smoke/package.json b/test/smoke/package.json index 2b917791f7f..9982eea55db 100644 --- a/test/smoke/package.json +++ b/test/smoke/package.json @@ -25,7 +25,7 @@ "rimraf": "^2.6.1", "strip-json-comments": "^2.0.1", "tmp": "0.0.33", - "typescript": "3.7.5", + "typescript": "^4.3.2", "watch": "^1.0.2" } } diff --git a/test/smoke/src/areas/multiroot/multiroot.test.ts b/test/smoke/src/areas/multiroot/multiroot.test.ts index 3707047d808..9fa052498e8 100644 --- a/test/smoke/src/areas/multiroot/multiroot.test.ts +++ b/test/smoke/src/areas/multiroot/multiroot.test.ts @@ -38,16 +38,9 @@ async function createWorkspaceFile(workspacePath: string): Promise { export function setup(opts: minimist.ParsedArgs) { describe('Multiroot', () => { - beforeSuite(opts); - - before(async function () { - const app = this.app as Application; - - const workspaceFilePath = await createWorkspaceFile(app.workspacePathOrFolder); - - // restart with preventing additional windows from restoring - // to ensure the window after restart is the multi-root workspace - await app.restart({ workspaceOrFolder: workspaceFilePath }); + beforeSuite(opts, async opts => { + const workspacePath = await createWorkspaceFile(opts.workspacePath); + return { ...opts, workspacePath }; }); afterSuite(); diff --git a/test/smoke/src/areas/notebook/notebook.test.ts b/test/smoke/src/areas/notebook/notebook.test.ts index 65859d3004b..f2970209f36 100644 --- a/test/smoke/src/areas/notebook/notebook.test.ts +++ b/test/smoke/src/areas/notebook/notebook.test.ts @@ -8,13 +8,8 @@ import minimist = require('minimist'); import { Application } from '../../../../automation'; import { afterSuite, beforeSuite } from '../../utils'; -// function wait(ms: number): Promise { -// return new Promise(r => setTimeout(r, ms)); -// } - - export function setup(opts: minimist.ParsedArgs) { - describe('Notebooks', () => { + describe.skip('Notebooks', () => { beforeSuite(opts); afterEach(async function () { diff --git a/test/smoke/src/main.ts b/test/smoke/src/main.ts index b5b41438632..f4c4db339f3 100644 --- a/test/smoke/src/main.ts +++ b/test/smoke/src/main.ts @@ -47,7 +47,8 @@ const opts = minimist(args, { 'wait-time', 'test-repo', 'screenshots', - 'log' + 'log', + 'electronArgs' ], boolean: [ 'verbose', @@ -236,6 +237,7 @@ function createOptions(): ApplicationOptions { loggers.push(new FileLogger(opts.log)); log = 'trace'; } + return { quality, codePath: opts.build, @@ -249,7 +251,8 @@ function createOptions(): ApplicationOptions { screenshotsPath, remote: opts.remote, web: opts.web, - browser: opts.browser + browser: opts.browser, + extraArgs: (opts.electronArgs || '').split(' ').map(a => a.trim()).filter(a => !!a) }; } diff --git a/test/smoke/src/utils.ts b/test/smoke/src/utils.ts index 72b928ae0cf..d0141fcd104 100644 --- a/test/smoke/src/utils.ts +++ b/test/smoke/src/utils.ts @@ -19,10 +19,15 @@ export function itRepeat(n: number, description: string, callback: (this: Contex } } -export function beforeSuite(opts: minimist.ParsedArgs) { +export function beforeSuite(opts: minimist.ParsedArgs, optionsTransform?: (opts: ApplicationOptions) => Promise) { before(async function () { + let options: ApplicationOptions = { ...this.defaultOptions }; + + if (optionsTransform) { + options = await optionsTransform(options); + } + // 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}`); diff --git a/test/smoke/yarn.lock b/test/smoke/yarn.lock index 52cf3d0d960..02f622e50c7 100644 --- a/test/smoke/yarn.lock +++ b/test/smoke/yarn.lock @@ -680,10 +680,10 @@ tmp@0.0.33: dependencies: os-tmpdir "~1.0.2" -typescript@3.7.5: - version "3.7.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.5.tgz#0692e21f65fd4108b9330238aac11dd2e177a1ae" - integrity sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw== +typescript@^4.3.2: + version "4.3.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.2.tgz#399ab18aac45802d6f2498de5054fcbbe716a805" + integrity sha512-zZ4hShnmnoVnAHpVHWpTcxdv7dWP60S2FsydQLV8V5PbS3FifjWFFRiHSWpDJahly88PRyV5teTSLoq4eG7mKw== util-deprecate@^1.0.1: version "1.0.2"