diff --git a/sdk/schemaregistry/schema-registry/package.json b/sdk/schemaregistry/schema-registry/package.json index 51d56c6e8420..30886d91c153 100644 --- a/sdk/schemaregistry/schema-registry/package.json +++ b/sdk/schemaregistry/schema-registry/package.json @@ -17,15 +17,15 @@ "execute:samples": "dev-tool samples run samples-dev", "extract-api": "tsc -p . && api-extractor run --local", "format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"", - "integration-test:browser": "echo skipped", - "integration-test:node": "echo skipped", + "integration-test:browser": "karma start --single-run", + "integration-test:node": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 5000000 --full-trace \"dist-esm/test/{,!(browser)/**/}*.spec.js\"", "integration-test": "npm run integration-test:node && npm run integration-test:browser", "lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]", "lint": "eslint package.json api-extractor.json src test --ext .ts", "pack": "npm pack 2>&1", "test:browser": "npm run build:test && npm run integration-test:browser", "test:node": "npm run build:test && npm run integration-test:node", - "test": "npm run build:test && npm run unit-test && npm run integration-test", + "test": "npm run build:test && npm run unit-test", "unit-test:browser": "karma start --single-run", "unit-test:node": "mocha -r esm -r ts-node/register --timeout 50000 --reporter ../../../common/tools/mocha-multi-reporter.js --colors --exclude \"test/**/*.browser.ts\" \"test/**/*.ts\"", "unit-test": "npm run unit-test:node && npm run unit-test:browser", diff --git a/sdk/schemaregistry/schema-registry/test/schemaRegistry.spec.ts b/sdk/schemaregistry/schema-registry/test/public/schemaRegistry.spec.ts similarity index 92% rename from sdk/schemaregistry/schema-registry/test/schemaRegistry.spec.ts rename to sdk/schemaregistry/schema-registry/test/public/schemaRegistry.spec.ts index 8534cb12f220..b0cca118d3a1 100644 --- a/sdk/schemaregistry/schema-registry/test/schemaRegistry.spec.ts +++ b/sdk/schemaregistry/schema-registry/test/public/schemaRegistry.spec.ts @@ -1,19 +1,18 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { createRecordedClient, testEnv } from "./utils/recordedClient"; +import { createRecordedClient } from "./utils/recordedClient"; import { Context } from "mocha"; -import { Recorder } from "@azure-tools/test-recorder"; +import { Recorder, env } from "@azure-tools/test-recorder"; import { assert, use as chaiUse } from "chai"; import chaiPromises from "chai-as-promised"; chaiUse(chaiPromises); import { ClientSecretCredential } from "@azure/identity"; -import { SchemaRegistryClient, SchemaDescription, SchemaProperties } from "../src/index"; -import { FullOperationResponse, OperationOptions } from "@azure/core-client"; +import { SchemaRegistryClient, SchemaDescription, SchemaProperties } from "../../src"; -const options: OperationOptions = { - onResponse: (rawResponse: FullOperationResponse) => { +const options = { + onResponse: (rawResponse: { status: number }) => { assert.equal(rawResponse.status, 200); } }; @@ -46,7 +45,7 @@ describe("SchemaRegistryClient", function() { ({ client, recorder } = createRecordedClient(this)); schema = { name: "azsdk_js_test", - groupName: testEnv.SCHEMA_REGISTRY_GROUP, + groupName: env.SCHEMA_REGISTRY_GROUP, format: "avro", definition: JSON.stringify({ type: "record", @@ -136,7 +135,7 @@ describe("SchemaRegistryClient", function() { it("schema with whitespace", async () => { const schema2: SchemaDescription = { name: "azsdk_js_test2", - groupName: testEnv.SCHEMA_REGISTRY_GROUP, + groupName: env.SCHEMA_REGISTRY_GROUP, format: "avro", definition: "{\n" + diff --git a/sdk/schemaregistry/schema-registry/test/utils/recordedClient.ts b/sdk/schemaregistry/schema-registry/test/public/utils/recordedClient.ts similarity index 80% rename from sdk/schemaregistry/schema-registry/test/utils/recordedClient.ts rename to sdk/schemaregistry/schema-registry/test/public/utils/recordedClient.ts index ba364d040533..73f51ff34f3f 100644 --- a/sdk/schemaregistry/schema-registry/test/utils/recordedClient.ts +++ b/sdk/schemaregistry/schema-registry/test/public/utils/recordedClient.ts @@ -6,7 +6,7 @@ import { Context } from "mocha"; import { env, Recorder, record, RecorderEnvironmentSetup } from "@azure-tools/test-recorder"; import { ClientSecretCredential } from "@azure/identity"; -import { SchemaRegistryClient } from "../../src/index"; +import { SchemaRegistryClient } from "../../../src"; export interface RecordedClient { client: SchemaRegistryClient; @@ -21,12 +21,6 @@ const replaceableVariables: { [k: string]: string } = { SCHEMA_REGISTRY_GROUP: "group-1" }; -export const testEnv = new Proxy(replaceableVariables, { - get: (target, key: string) => { - return env[key] || target[key]; - } -}); - const environmentSetup: RecorderEnvironmentSetup = { replaceableVariables, customizationsOnRecordings: [ @@ -47,10 +41,10 @@ const environmentSetup: RecorderEnvironmentSetup = { export function createRecordedClient(context: Context): RecordedClient { const recorder = record(context, environmentSetup); const credential = new ClientSecretCredential( - testEnv.AZURE_TENANT_ID, - testEnv.AZURE_CLIENT_ID, - testEnv.AZURE_CLIENT_SECRET + env.AZURE_TENANT_ID, + env.AZURE_CLIENT_ID, + env.AZURE_CLIENT_SECRET ); - const client = new SchemaRegistryClient(testEnv.SCHEMA_REGISTRY_ENDPOINT, credential); + const client = new SchemaRegistryClient(env.SCHEMA_REGISTRY_ENDPOINT, credential); return { client, recorder }; } diff --git a/sdk/schemaregistry/schema-registry/tests.yml b/sdk/schemaregistry/schema-registry/tests.yml index f85e0d9accb4..050d34252117 100644 --- a/sdk/schemaregistry/schema-registry/tests.yml +++ b/sdk/schemaregistry/schema-registry/tests.yml @@ -5,8 +5,6 @@ stages: parameters: PackageName: "@azure/schema-registry" ServiceDirectory: schemaregistry - MatrixFilters: - - DependencyVersion=^$ EnvVars: AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id) AZURE_CLIENT_SECRET: $(aad-azure-sdk-test-client-secret)