diff --git a/.azure-pipelines/common/test.yml b/.azure-pipelines/common/test.yml index 9df5d647e..103107288 100644 --- a/.azure-pipelines/common/test.yml +++ b/.azure-pipelines/common/test.yml @@ -17,6 +17,7 @@ steps: SERVICE_PRINCIPAL_SECRET: $(SERVICE_PRINCIPAL_SECRET) SERVICE_PRINCIPAL_DOMAIN: $(SERVICE_PRINCIPAL_DOMAIN) DISPLAY: :10 # Only necessary for linux tests + DISABLE_LANGUAGE_SERVER_TESTS: "true" # TODO: remove - task: PublishTestResults@2 displayName: 'Publish Test Results' diff --git a/test/formatDocument.test.ts b/test/formatDocument.test.ts index 5fd07d35e..5b4fc1bbd 100644 --- a/test/formatDocument.test.ts +++ b/test/formatDocument.test.ts @@ -16,6 +16,7 @@ import { armDeploymentLanguageId } from "../extension.bundle"; import { diagnosticsTimeout, testFolder } from "./support/diagnostics"; import { ensureLanguageServerAvailable } from "./support/ensureLanguageServerAvailable"; import { getTempFilePath } from "./support/getTempFilePath"; +import { DISABLE_LANGUAGE_SERVER_TESTS } from "./testConstants"; const formatDocumentCommand = 'editor.action.formatDocument'; const formatRangeCommand = 'editor.action.formatSelection'; @@ -23,6 +24,10 @@ const formatRangeCommand = 'editor.action.formatSelection'; suite("Format document", function (this: ISuiteCallbackContext): void { this.timeout(diagnosticsTimeout); + if (DISABLE_LANGUAGE_SERVER_TESTS) { + return; + } + function testFormat(testName: string, source: string, expected: string, range?: Range | RegExp): void { test(testName, async () => { await ensureLanguageServerAvailable(); diff --git a/test/functional/expressions.test.ts b/test/functional/expressions.test.ts index d4820ed11..411390591 100644 --- a/test/functional/expressions.test.ts +++ b/test/functional/expressions.test.ts @@ -5,9 +5,14 @@ // tslint:disable:no-unused-expression max-func-body-length promise-function-async max-line-length no-http-string no-suspicious-comment import { IDeploymentParameterDefinition, IDeploymentTemplate, sources, testDiagnostics } from "../support/diagnostics"; +import { DISABLE_LANGUAGE_SERVER_TESTS } from "../testConstants"; // Note: a lot of these come from TLE.test.ts, but this version goes through the vscode diagnostics and thus tests the language server suite("Expressions functional tests", () => { + if (DISABLE_LANGUAGE_SERVER_TESTS) { + return; + } + // testName defaults to expression if left blank function testExpression(testName: string, expression: string, expected: string[]): void { test(testName || expression, async () => { diff --git a/test/functional/validation.acceptance.ts b/test/functional/validation.acceptance.ts index 81a5f606d..3bab6f2f8 100644 --- a/test/functional/validation.acceptance.ts +++ b/test/functional/validation.acceptance.ts @@ -5,8 +5,13 @@ // tslint:disable:no-suspicious-comment import { minimalDeploymentTemplate, testDiagnostics, testDiagnosticsFromFile } from "../support/diagnostics"; +import { DISABLE_LANGUAGE_SERVER_TESTS } from "../testConstants"; suite("Acceptance validation tests (all sources)", () => { + if (DISABLE_LANGUAGE_SERVER_TESTS) { + return; + } + test("minimal deployment template - no errors", async () => { await testDiagnostics( minimalDeploymentTemplate, diff --git a/test/functional/validation.backend.test.ts b/test/functional/validation.backend.test.ts index e42fe1c8a..ab649f833 100644 --- a/test/functional/validation.backend.test.ts +++ b/test/functional/validation.backend.test.ts @@ -5,8 +5,13 @@ // tslint:disable:object-literal-key-quotes no-http-string import { sources, testDiagnostics } from "../support/diagnostics"; +import { DISABLE_LANGUAGE_SERVER_TESTS } from "../testConstants"; suite("Backend validation", () => { + if (DISABLE_LANGUAGE_SERVER_TESTS) { + return; + } + // tslint:disable-next-line: no-suspicious-comment test("missing required property 'resources'", async () => await testDiagnostics( diff --git a/test/functional/validation.expressions.test.ts b/test/functional/validation.expressions.test.ts index b8e64472d..b47e898c8 100644 --- a/test/functional/validation.expressions.test.ts +++ b/test/functional/validation.expressions.test.ts @@ -5,8 +5,13 @@ // tslint:disable:no-suspicious-comment import { sources, testDiagnosticsFromFile } from "../support/diagnostics"; +import { DISABLE_LANGUAGE_SERVER_TESTS } from "../testConstants"; suite("Expression validation", () => { + if (DISABLE_LANGUAGE_SERVER_TESTS) { + return; + } + test( 'templates/new-vm.jsonc', async () => diff --git a/test/functional/validation.json.test.ts b/test/functional/validation.json.test.ts index 068006ad0..5d71f6d31 100644 --- a/test/functional/validation.json.test.ts +++ b/test/functional/validation.json.test.ts @@ -1,10 +1,15 @@ import { sources, testDiagnostics } from "../support/diagnostics"; +import { DISABLE_LANGUAGE_SERVER_TESTS } from "../testConstants"; // ---------------------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. // ---------------------------------------------------------------------------- suite("JSON validation", () => { + if (DISABLE_LANGUAGE_SERVER_TESTS) { + return; + } + test("no closing brace", async () => await testDiagnostics( `{ "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", diff --git a/test/functional/validation.schema.test.ts b/test/functional/validation.schema.test.ts index eec446b75..f5657b6cd 100644 --- a/test/functional/validation.schema.test.ts +++ b/test/functional/validation.schema.test.ts @@ -5,8 +5,13 @@ // tslint:disable:object-literal-key-quotes no-http-string max-func-body-length import { sources, testDiagnostics, testDiagnosticsFromFile } from "../support/diagnostics"; +import { DISABLE_LANGUAGE_SERVER_TESTS } from "../testConstants"; suite("Schema validation", () => { + if (DISABLE_LANGUAGE_SERVER_TESTS) { + return; + } + test("missing required property 'resources'", async () => await testDiagnostics( { diff --git a/test/testConstants.ts b/test/testConstants.ts new file mode 100644 index 000000000..695d7ccda --- /dev/null +++ b/test/testConstants.ts @@ -0,0 +1,9 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See LICENSE.md in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +// tslint:disable-next-line: no-suspicious-comment +// TODO: Remove when language server available for build +// tslint:disable-next-line: strict-boolean-expressions export-name +export const DISABLE_LANGUAGE_SERVER_TESTS: boolean = /^(true|1)?$/i.test(process.env.DISABLE_LANGUAGE_SERVER_TESTS || '');