Skip to content

Commit

Permalink
[identity] Various test fixes (#31764)
Browse files Browse the repository at this point in the history
A few fixes as a result of the identity ESM migration:

1. Missing `ctx` parameter that's now fixed
2. Default vitest config excludes managed identity tests. Adding a
separate vitest config for managed identity test runs fixes this
  • Loading branch information
maorleger authored Nov 14, 2024
1 parent 35680de commit a6b5a36
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sdk/identity/identity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"integration-test:browser": "echo skipped",
"integration-test:managed-identity": "dev-tool run test:vitest -- --test-timeout 180000 'test/integration/**/*.spec.ts'",
"integration-test:managed-identity": "dev-tool run test:vitest -- --test-timeout 180000 --config ./vitest.managed-identity.config.ts",
"integration-test:node": "dev-tool run test:vitest -- --test-timeout 180000 'test/public/node/*.spec.ts' 'test/internal/node/*.spec.ts'",
"lint": "eslint package.json api-extractor.json src test",
"lint:fix": "eslint package.json api-extractor.json src test --fix --fix-type [problem,suggestion]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.
import { execSync } from "child_process";
import { isLiveMode } from "@azure-tools/test-recorder";
import { describe, it, assert, expect, vi, beforeEach, afterEach, beforeAll } from "vitest";
import { describe, it, assert, beforeEach } from "vitest";

describe("Azure Kubernetes Integration test", function () {
let podOutput: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { env } from "@azure-tools/test-recorder";
import { createHttpHeaders, createPipelineRequest } from "@azure/core-rest-pipeline";
import { ClientSecretCredential } from "../../../src/credentials/clientSecretCredential.js";
import { IdentityClient } from "../../../src/client/identityClient.js";
import { describe, it, assert, expect, vi, beforeEach, afterEach } from "vitest";
import { describe, it, assert, beforeEach, afterEach } from "vitest";

describe("MultiTenantAuthentication", function () {
let cleanup: MsalTestCleanup;
Expand All @@ -24,7 +24,7 @@ describe("MultiTenantAuthentication", function () {
await cleanup();
});

it("supports calling graph with client secret", async function () {
it("supports calling graph with client secret", async function (ctx) {
const [tenantId, clientId, clientSecret] = [
env.AZURE_IDENTITY_MULTI_TENANT_TENANT_ID,
env.AZURE_IDENTITY_MULTI_TENANT_CLIENT_ID,
Expand Down
14 changes: 14 additions & 0 deletions sdk/identity/identity/vitest.managed-identity.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { defineConfig, mergeConfig } from "vitest/config";
import viteConfig from "../../../vitest.shared.config.ts";

export default mergeConfig(
viteConfig,
defineConfig({
test: {
include: ["test/integration/**/*.spec.ts"],
},
}),
);

0 comments on commit a6b5a36

Please sign in to comment.