Skip to content

Commit

Permalink
Fix suites when no lang server (#896)
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenWeatherford authored Aug 3, 2020
1 parent 4343489 commit 814c4b2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
12 changes: 6 additions & 6 deletions test/LinkedTemplates.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

import { isWin32 } from "../extension.bundle";
import { testDiagnostics, testDiagnosticsFromFile } from "./support/diagnostics";
import { testWithLog } from "./support/testWithLog";
import { testWithLanguageServer } from "./support/testWithLanguageServer";

suite("Linked templates", () => {
suite("variables and parameters inside templateLink object refer to the parent's scope", () => {
testWithLog('Regress #792: Regression from 0.10.0: top-level parameters not recognized in nested template properties', async () => {
testWithLanguageServer('Regress #792: Regression from 0.10.0: top-level parameters not recognized in nested template properties', async () => {
await testDiagnosticsFromFile(
'templates/linked-templates-scope.json',
{},
Expand All @@ -22,7 +22,7 @@ suite("Linked templates", () => {
});

suite('Regress #773: Regression from 0.10.0: top-level parameters not recognized in nested template properties', () => {
testWithLog("simple", async () => {
testWithLanguageServer("simple", async () => {
await testDiagnosticsFromFile(
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
Expand Down Expand Up @@ -52,7 +52,7 @@ suite("Linked templates", () => {
// Should be no errors
]);
});
testWithLog("linked-templates-scope.json", async () => {
testWithLanguageServer("linked-templates-scope.json", async () => {
await testDiagnosticsFromFile(
'templates/linked-templates-scope.json',
{
Expand All @@ -75,7 +75,7 @@ suite("Linked templates", () => {
// TODO: For some reason, these two tests are failing consistently in the
// Windows build pipeline, but not locally or on other platforms.
if (!isWin32) {
testWithLog("Nested template wrong param type", async () => {
testWithLanguageServer("Nested template wrong param type", async () => {
await testDiagnostics(
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
Expand Down Expand Up @@ -125,7 +125,7 @@ suite("Linked templates", () => {
);
});

testWithLog("Nested template missing properties", async () => {
testWithLanguageServer("Nested template missing properties", async () => {
await testDiagnostics(
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
Expand Down
3 changes: 2 additions & 1 deletion test/support/TestSnippets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { ITest, ITestCallbackContext } from 'mocha';
import * as path from 'path';
import { ext, SnippetManager } from "../../extension.bundle";
import { testLog } from './createTestLog';
import { RequiresLanguageServer } from './testWithLanguageServer';
import { ITestPreparation, ITestPreparationResult, testWithPrep } from './testWithPrep';

// By default we use the test snippets for tests
Expand Down Expand Up @@ -49,6 +50,6 @@ export class UseNoSnippets implements ITestPreparation {
export function testWithRealSnippets(expectation: string, callback?: (this: ITestCallbackContext) => Promise<unknown>): ITest {
return testWithPrep(
expectation,
[UseRealSnippets.instance],
[UseRealSnippets.instance, RequiresLanguageServer.instance], // Language server needed for format document
callback);
}
2 changes: 1 addition & 1 deletion test/support/testWithPrep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export function testWithPrep(expectation: string, preparations?: ITestPreparatio
throw error;
}

throw wrapError(parseError(error).message, ` \n=================== TESTLOG ===================\n\n${testLog.toString()}`);
throw wrapError(parseError(error).message, `\nTESTLOG:\n${testLog.toString()}`);
} finally {
deleteTestLog();
}
Expand Down

0 comments on commit 814c4b2

Please sign in to comment.