From 4c2ff90352c05e2b9f51ff923c7afa14cebd4225 Mon Sep 17 00:00:00 2001 From: deyaaeldeen Date: Mon, 22 Mar 2021 18:09:31 +0000 Subject: [PATCH 1/9] Use @this to satisfy ESLint's no-invalid-this --- .../test/anomalydetector.spec.ts | 3 +- .../test/public/attestationTests.spec.ts | 3 +- .../test/public/policyGetSetTests.spec.ts | 3 +- .../policyManagementGetSetTests.spec.ts | 3 +- .../test/public/tokenCertTests.spec.ts | 3 +- .../public/containerRegistryClient.spec.ts | 3 +- .../container-registry/tsdoc.json | 4 ++ .../core-http/test/defaultHttpClientTests.ts | 3 +- sdk/core/core-lro/test/utils/testOperation.ts | 4 +- sdk/core/logger/src/debug.ts | 4 +- sdk/cosmosdb/cosmos/test/.eslintrc.json | 1 - .../cosmos/test/internal/session.spec.ts | 4 +- .../cosmos/test/internal/unit/auth.spec.ts | 2 +- .../public/functional/authorization.spec.ts | 2 +- .../test/public/functional/client.spec.ts | 2 +- .../test/public/functional/conflict.spec.ts | 2 +- .../test/public/functional/container.spec.ts | 2 +- .../test/public/functional/database.spec.ts | 2 +- .../public/functional/databaseaccount.spec.ts | 4 +- .../test/public/functional/item.spec.ts | 2 +- .../test/public/functional/offer.spec.ts | 4 +- .../test/public/functional/permission.spec.ts | 2 +- .../test/public/functional/query.spec.ts | 6 +-- .../test/public/functional/spatial.spec.ts | 2 +- .../test/public/functional/sproc.spec.ts | 6 +-- .../test/public/functional/trigger.spec.ts | 2 +- .../cosmos/test/public/functional/ttl.spec.ts | 2 +- .../cosmos/test/public/functional/udf.spec.ts | 2 +- .../test/public/functional/user.spec.ts | 2 +- .../public/integration/aggregateQuery.spec.ts | 2 +- .../public/integration/authorization.spec.ts | 2 +- .../public/integration/changeFeed.spec.ts | 2 +- .../public/integration/crossPartition.spec.ts | 2 +- .../test/public/integration/encoding.spec.ts | 2 +- .../public/integration/multiregion.spec.ts | 2 +- .../test/public/integration/proxy.spec.ts | 2 +- .../test/public/integration/query.spec.ts | 6 +-- sdk/cosmosdb/cosmos/test/tsdoc.json | 4 ++ .../eventgrid/test/eventGridClient.spec.ts | 15 +++--- .../browser/formrecognizerclient.spec.ts | 3 +- .../test/public/formtrainingclient.spec.ts | 4 +- .../public/node/formrecognizerclient.spec.ts | 3 +- .../test/internal/identityClient.spec.ts | 3 +- sdk/keyvault/keyvault-admin/.eslintrc.json | 1 - .../keyvault-certificates/.eslintrc.json | 1 - ...challengeBasedAuthenticationPolicy.spec.ts | 6 +-- .../test/internal/userAgent.spec.ts | 2 +- .../test/public/CRUD.spec.ts | 46 ++++++++-------- .../test/public/list.spec.ts | 16 +++--- .../test/public/lro.create.spec.ts | 6 +-- .../test/public/lro.delete.spec.ts | 6 +-- .../test/public/lro.operation.spec.ts | 6 +-- .../test/public/lro.recover.spec.ts | 8 +-- .../test/public/mergeAndImport.spec.ts | 8 +-- .../test/public/recoverBackupRestore.spec.ts | 10 ++-- .../test/utils/lro/restore/operation.ts | 2 + sdk/keyvault/keyvault-keys/.eslintrc.json | 1 - .../test/internal/aesCryptography.spec.ts | 16 +++--- ...challengeBasedAuthenticationPolicy.spec.ts | 6 +-- .../test/internal/crypto.spec.ts | 12 ++--- .../test/internal/userAgent.spec.ts | 2 +- .../test/public/CRUD.hsm.spec.ts | 4 +- .../keyvault-keys/test/public/CRUD.spec.ts | 52 +++++++++---------- .../test/public/crypto.hsm.spec.ts | 6 +-- .../keyvault-keys/test/public/crypto.spec.ts | 28 +++++----- .../keyvault-keys/test/public/import.spec.ts | 4 +- .../keyvault-keys/test/public/list.spec.ts | 20 +++---- .../test/public/localCryptography.spec.ts | 14 ++--- .../test/public/lro.delete.spec.ts | 6 +-- .../test/public/lro.recoverDelete.spec.ts | 8 +-- .../test/public/recoverBackupRestore.spec.ts | 14 ++--- .../test/utils/lro/restore/operation.ts | 2 + sdk/keyvault/keyvault-secrets/.eslintrc.json | 1 - ...challengeBasedAuthenticationPolicy.spec.ts | 6 +-- .../test/internal/userAgent.spec.ts | 2 +- .../keyvault-secrets/test/public/CRUD.spec.ts | 38 +++++++------- .../keyvault-secrets/test/public/list.spec.ts | 22 ++++---- .../test/public/lro.delete.spec.ts | 8 +-- .../test/public/lro.recover.spec.ts | 8 +-- .../test/public/recoverBackupRestore.spec.ts | 16 +++--- .../test/utils/lro/restore/operation.ts | 2 + .../test/public/adminclient.spec.ts | 12 ++--- .../test/public/advisorclient.spec.ts | 3 +- .../test/public/datafeed.spec.ts | 19 +++---- .../test/public/hookTests.spec.ts | 3 +- .../test/mixedRealityStsClient.spec.ts | 3 +- .../test/schemaRegistry.spec.ts | 3 +- sdk/schemaregistry/schema-registry/tsdoc.json | 4 ++ .../test/public/node/searchClient.spec.ts | 6 +-- .../public/node/searchIndexClient.spec.ts | 5 +- .../public/node/searchIndexerClient.spec.ts | 5 +- .../test/integration/batch.spec.ts | 3 +- .../test/integration/tableclient.spec.ts | 6 +-- .../integration/tableserviceclient.spec.ts | 9 ++-- .../test/unit/sharedKeyCredential.spec.ts | 3 +- .../data-tables/test/unit/utils.spec.ts | 3 +- .../test/public/configurationClient.spec.ts | 3 +- sdk/template/template/tsdoc.json | 4 ++ .../test/public/apiKey.spec.ts | 12 ++--- .../test/public/textAnalyticsClient.spec.ts | 12 ++--- tsdoc.json | 4 ++ 101 files changed, 326 insertions(+), 348 deletions(-) create mode 100644 sdk/containerregistry/container-registry/tsdoc.json create mode 100644 sdk/cosmosdb/cosmos/test/tsdoc.json create mode 100644 sdk/schemaregistry/schema-registry/tsdoc.json create mode 100644 sdk/template/template/tsdoc.json diff --git a/sdk/anomalydetector/ai-anomaly-detector/test/anomalydetector.spec.ts b/sdk/anomalydetector/ai-anomaly-detector/test/anomalydetector.spec.ts index 0205a936d87c..260bd2cd68e8 100644 --- a/sdk/anomalydetector/ai-anomaly-detector/test/anomalydetector.spec.ts +++ b/sdk/anomalydetector/ai-anomaly-detector/test/anomalydetector.spec.ts @@ -19,8 +19,7 @@ describe("AnomalyDetectorClient", () => { let recorder: Recorder; const apiKey = new AzureKeyCredential(testEnv.ANOMALY_DETECTOR_API_KEY); - beforeEach(function() { - // eslint-disable-next-line no-invalid-this + beforeEach(/** @this*/ function() { ({ recorder, client } = createRecordedAnomalyDetectorClient(this, apiKey)); }); diff --git a/sdk/attestation/attestation/test/public/attestationTests.spec.ts b/sdk/attestation/attestation/test/public/attestationTests.spec.ts index a98319589dd2..b1f971334bbd 100644 --- a/sdk/attestation/attestation/test/public/attestationTests.spec.ts +++ b/sdk/attestation/attestation/test/public/attestationTests.spec.ts @@ -14,8 +14,7 @@ import { verifyAttestationToken } from "../utils/helpers"; describe("[AAD] Attestation Client", function() { let recorder: Recorder; - beforeEach(function() { - // eslint-disable-next-line no-invalid-this + beforeEach(/** @this*/ function() { recorder = createRecorder(this); }); diff --git a/sdk/attestation/attestation/test/public/policyGetSetTests.spec.ts b/sdk/attestation/attestation/test/public/policyGetSetTests.spec.ts index cb26556db09a..7909551356c7 100644 --- a/sdk/attestation/attestation/test/public/policyGetSetTests.spec.ts +++ b/sdk/attestation/attestation/test/public/policyGetSetTests.spec.ts @@ -14,8 +14,7 @@ import { verifyAttestationToken } from "../utils/helpers"; describe("PolicyGetSetTests ", function() { let recorder: Recorder; - beforeEach(function() { - // eslint-disable-next-line no-invalid-this + beforeEach(/** @this*/ function() { recorder = createRecorder(this); }); diff --git a/sdk/attestation/attestation/test/public/policyManagementGetSetTests.spec.ts b/sdk/attestation/attestation/test/public/policyManagementGetSetTests.spec.ts index fa9e9081aac7..a7a096fcbec0 100644 --- a/sdk/attestation/attestation/test/public/policyManagementGetSetTests.spec.ts +++ b/sdk/attestation/attestation/test/public/policyManagementGetSetTests.spec.ts @@ -13,8 +13,7 @@ import { verifyAttestationToken } from "../utils/helpers"; describe("PolicyManagementTests ", function() { let recorder: Recorder; - beforeEach(function() { - // eslint-disable-next-line no-invalid-this + beforeEach(/** @this*/ function() { recorder = createRecorder(this); }); diff --git a/sdk/attestation/attestation/test/public/tokenCertTests.spec.ts b/sdk/attestation/attestation/test/public/tokenCertTests.spec.ts index c2b0ad00e2d6..beb23dbe575b 100644 --- a/sdk/attestation/attestation/test/public/tokenCertTests.spec.ts +++ b/sdk/attestation/attestation/test/public/tokenCertTests.spec.ts @@ -13,8 +13,7 @@ import { Buffer } from "../utils/Buffer"; describe("TokenCertTests", function() { let recorder: Recorder; - beforeEach(function() { - // eslint-disable-next-line no-invalid-this + beforeEach(/** @this*/ function() { recorder = createRecorder(this); }); diff --git a/sdk/containerregistry/container-registry/test/public/containerRegistryClient.spec.ts b/sdk/containerregistry/container-registry/test/public/containerRegistryClient.spec.ts index fc57fdcd622c..b8822d566b6d 100644 --- a/sdk/containerregistry/container-registry/test/public/containerRegistryClient.spec.ts +++ b/sdk/containerregistry/container-registry/test/public/containerRegistryClient.spec.ts @@ -50,11 +50,10 @@ describe.skip("ContainerRegistryClient functional tests", function() { // NOTE: use of "function" and not ES6 arrow-style functions with the // beforeEach hook is IMPORTANT due to the use of `this` in the function // body. - beforeEach(function(this: Context) { + beforeEach(/** @this*/ function(this: Context) { // The recorder has some convenience methods, and we need to store a // reference to it so that we can `stop()` the recorder later in the // `afterEach` hook. - // eslint-disable-next-line no-invalid-this recorder = record(this, { // == Recorder Environment Setup == Add the replaceable variables from // above diff --git a/sdk/containerregistry/container-registry/tsdoc.json b/sdk/containerregistry/container-registry/tsdoc.json new file mode 100644 index 000000000000..81c5a8a2aa2f --- /dev/null +++ b/sdk/containerregistry/container-registry/tsdoc.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json", + "extends": ["../../../tsdoc.json"] +} diff --git a/sdk/core/core-http/test/defaultHttpClientTests.ts b/sdk/core/core-http/test/defaultHttpClientTests.ts index 1bd1a76c1a97..01e6c23412df 100644 --- a/sdk/core/core-http/test/defaultHttpClientTests.ts +++ b/sdk/core/core-http/test/defaultHttpClientTests.ts @@ -236,9 +236,8 @@ describe("defaultHttpClient", function() { } }); - it("should give a graceful error for nonexistent hosts", async function() { + it("should give a graceful error for nonexistent hosts", /** @this*/ async function() { // Increase timeout to give the request time to fail - // eslint-disable-next-line no-invalid-this this.timeout(10000); const requestUrl = "http://fake.domain"; const request = new WebResource(requestUrl, "GET"); diff --git a/sdk/core/core-lro/test/utils/testOperation.ts b/sdk/core/core-lro/test/utils/testOperation.ts index 00cc3ffa617d..1e7783cd0ac4 100644 --- a/sdk/core/core-lro/test/utils/testOperation.ts +++ b/sdk/core/core-lro/test/utils/testOperation.ts @@ -1,6 +1,5 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -/* eslint-disable no-invalid-this */ import { HttpOperationResponse, RequestOptionsBase } from "@azure/core-http"; import { AbortSignalLike } from "@azure/abort-controller"; @@ -22,6 +21,7 @@ export interface TestOperationState extends PollOperationState { export interface TestOperation extends PollOperation {} +/** @this*/ async function update( this: TestOperation, options: { @@ -70,6 +70,7 @@ async function update( return makeOperation(newState); } +/** @this*/ async function cancel( this: TestOperation, options: { abortSignal?: AbortSignal } = {} @@ -100,6 +101,7 @@ async function cancel( }); } +/** @this*/ function toString(this: TestOperation): string { return JSON.stringify({ state: this.state diff --git a/sdk/core/logger/src/debug.ts b/sdk/core/logger/src/debug.ts index 07165617e242..e56f09b5a875 100644 --- a/sdk/core/logger/src/debug.ts +++ b/sdk/core/logger/src/debug.ts @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -/* eslint-disable no-invalid-this */ - import { log } from "./log"; /** @@ -157,6 +155,7 @@ function createDebugger(namespace: string): Debugger { return newDebugger; } +/** @this*/ function destroy(this: Debugger): boolean { const index = debuggers.indexOf(this); if (index >= 0) { @@ -166,6 +165,7 @@ function destroy(this: Debugger): boolean { return false; } +/** @this*/ function extend(this: Debugger, namespace: string): Debugger { const newDebugger = createDebugger(`${this.namespace}:${namespace}`); newDebugger.log = this.log; diff --git a/sdk/cosmosdb/cosmos/test/.eslintrc.json b/sdk/cosmosdb/cosmos/test/.eslintrc.json index 150383183916..485795008a39 100644 --- a/sdk/cosmosdb/cosmos/test/.eslintrc.json +++ b/sdk/cosmosdb/cosmos/test/.eslintrc.json @@ -2,7 +2,6 @@ "extends": ["../.eslintrc.json"], "rules": { "no-console": "off", - "no-invalid-this": "off", "space-before-function-paren": "off" } } diff --git a/sdk/cosmosdb/cosmos/test/internal/session.spec.ts b/sdk/cosmosdb/cosmos/test/internal/session.spec.ts index a6e93d6978b6..85e6d4d2f680 100644 --- a/sdk/cosmosdb/cosmos/test/internal/session.spec.ts +++ b/sdk/cosmosdb/cosmos/test/internal/session.spec.ts @@ -28,7 +28,7 @@ function getCollection2TokenMap( return (sessionContainer as any).collectionResourceIdToSessionTokens; } -describe("Session Token", function() { +describe("Session Token", /** @this*/ function() { this.timeout(process.env.MOCHA_TIMEOUT || 20000); const containerId = "sessionTestColl"; @@ -304,7 +304,7 @@ describe("Session Token", function() { spy.restore(); }); - it("validate 'lsn not caught up' error for higher lsn and clearing session token", async function() { + it("validate 'lsn not caught up' error for higher lsn and clearing session token", /** @this*/ async function() { this.retries(2); const database = await getTestDatabase("session test", client); diff --git a/sdk/cosmosdb/cosmos/test/internal/unit/auth.spec.ts b/sdk/cosmosdb/cosmos/test/internal/unit/auth.spec.ts index 8625c5fe6b53..5ca1c23454a3 100644 --- a/sdk/cosmosdb/cosmos/test/internal/unit/auth.spec.ts +++ b/sdk/cosmosdb/cosmos/test/internal/unit/auth.spec.ts @@ -4,7 +4,7 @@ import { getAuthorizationTokenUsingResourceTokens } from "../../../src/auth"; import assert from "assert"; -describe("NodeJS CRUD Tests", function() { +describe("NodeJS CRUD Tests", /** @this*/ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); it("should find exact match", async function() { diff --git a/sdk/cosmosdb/cosmos/test/public/functional/authorization.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/authorization.spec.ts index 1de9580ce23e..5a8f6722d714 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/authorization.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/authorization.spec.ts @@ -11,7 +11,7 @@ import { removeAllDatabases } from "../common/TestHelpers"; -describe("NodeJS CRUD Tests", function() { +describe("NodeJS CRUD Tests", /** @this*/ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); beforeEach(async function() { await removeAllDatabases(); diff --git a/sdk/cosmosdb/cosmos/test/public/functional/client.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/client.spec.ts index 70f223dff25d..c8ab759377bb 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/client.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/client.spec.ts @@ -13,7 +13,7 @@ import { import AbortController from "node-abort-controller"; import { UsernamePasswordCredential } from "@azure/identity"; -describe("NodeJS CRUD Tests", function() { +describe("NodeJS CRUD Tests", /** @this*/ function() { this.timeout(process.env.MOCHA_TIMEOUT || 20000); describe("Validate client request timeout", function() { diff --git a/sdk/cosmosdb/cosmos/test/public/functional/conflict.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/conflict.spec.ts index 3df4ff8cb451..987e6b69c7fa 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/conflict.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/conflict.spec.ts @@ -3,7 +3,7 @@ import assert from "assert"; import { removeAllDatabases, getTestContainer } from "../common/TestHelpers"; -describe("Conflicts", function() { +describe("Conflicts", /** @this*/ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); beforeEach(async function() { await removeAllDatabases(); diff --git a/sdk/cosmosdb/cosmos/test/public/functional/container.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/container.spec.ts index 3a959edc72db..a792e54e9084 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/container.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/container.spec.ts @@ -14,7 +14,7 @@ import { import { SpatialType } from "../../../src"; import { GeospatialType } from "../../../src"; -describe("Containers", function() { +describe("Containers", /** @this*/ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); beforeEach(async function() { await removeAllDatabases(); diff --git a/sdk/cosmosdb/cosmos/test/public/functional/database.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/database.spec.ts index 4c74176cc248..42b7f7a8a6be 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/database.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/database.spec.ts @@ -13,7 +13,7 @@ import { DatabaseRequest } from "../../../src"; const client = new CosmosClient({ endpoint, key: masterKey }); -describe("NodeJS CRUD Tests", function() { +describe("NodeJS CRUD Tests", /** @this*/ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); beforeEach(async function() { await removeAllDatabases(); diff --git a/sdk/cosmosdb/cosmos/test/public/functional/databaseaccount.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/databaseaccount.spec.ts index 8797d8f28f19..30f67fed47a6 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/databaseaccount.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/databaseaccount.spec.ts @@ -6,9 +6,9 @@ import { endpoint, masterKey } from "../common/_testConfig"; const client = new CosmosClient({ endpoint, key: masterKey }); -describe("NodeJS CRUD Tests", function() { +describe("NodeJS CRUD Tests", /** @this*/ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); - beforeEach(async function() { + beforeEach(/** @this*/ async function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); }); diff --git a/sdk/cosmosdb/cosmos/test/public/functional/item.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/item.spec.ts index 0d383bd8100b..e3fdaae79fda 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/item.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/item.spec.ts @@ -26,7 +26,7 @@ interface TestItem { replace?: string; } -describe("Item CRUD", function() { +describe("Item CRUD", /** @this*/ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); beforeEach(async function() { await removeAllDatabases(); diff --git a/sdk/cosmosdb/cosmos/test/public/functional/offer.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/offer.spec.ts index 0357bbe1a01d..dc205d5add3c 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/offer.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/offer.spec.ts @@ -15,10 +15,10 @@ const validateOfferResponseBody = function(offer: any): void { assert(offer._self.indexOf(offer.id) !== -1, "Offer id not contained in offer self link."); }; -describe("NodeJS CRUD Tests", function() { +describe("NodeJS CRUD Tests", /** @this*/ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); - beforeEach(async function() { + beforeEach(/** @this*/ async function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); await removeAllDatabases(); }); diff --git a/sdk/cosmosdb/cosmos/test/public/functional/permission.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/permission.spec.ts index 91b4c2e7b67e..721a960fe535 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/permission.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/permission.spec.ts @@ -10,7 +10,7 @@ import { replaceOrUpsertPermission } from "../common/TestHelpers"; -describe("NodeJS CRUD Tests", function() { +describe("NodeJS CRUD Tests", /** @this*/ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); beforeEach(async function() { await removeAllDatabases(); diff --git a/sdk/cosmosdb/cosmos/test/public/functional/query.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/query.spec.ts index d5b46e1053ae..c73d3494d833 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/query.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/query.spec.ts @@ -14,7 +14,7 @@ if (!Symbol || !Symbol.asyncIterator) { (Symbol as any).asyncIterator = Symbol.for("Symbol.asyncIterator"); } -describe("Queries", function() { +describe("Queries", /** @this*/ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); before(async function() { await removeAllDatabases(); @@ -47,7 +47,7 @@ describe("Queries", function() { }); }); - describe("QueryIterator", function() { + describe("QueryIterator", /** @this*/ function() { this.timeout(process.env.MOCHA_TIMEOUT || 30000); let resources: { container: Container; doc1: any; doc2: any; doc3: any }; @@ -143,7 +143,7 @@ describe("Queries", function() { } }); - describe("SUM query iterator", function() { + describe("SUM query iterator", /** @this*/ function() { this.timeout(process.env.MOCHA_TIMEOUT || 30000); it("returns undefined sum with null value in aggregator", async function() { diff --git a/sdk/cosmosdb/cosmos/test/public/functional/spatial.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/spatial.spec.ts index 4b27ca78113f..4d2b71df7073 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/spatial.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/spatial.spec.ts @@ -4,7 +4,7 @@ import assert from "assert"; import { Database, DataType, IndexKind } from "../../../src"; import { createOrUpsertItem, getTestDatabase, removeAllDatabases } from "../common/TestHelpers"; -describe("Spatial Indexes", function() { +describe("Spatial Indexes", /** @this*/ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); beforeEach(async function() { await removeAllDatabases(); diff --git a/sdk/cosmosdb/cosmos/test/public/functional/sproc.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/sproc.spec.ts index 69f4c9c0f8a6..1921db6fe46b 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/sproc.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/sproc.spec.ts @@ -13,14 +13,14 @@ import { // Used for sproc declare let getContext: any; -describe("NodeJS CRUD Tests", function() { +describe("NodeJS CRUD Tests", /** @this*/ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); beforeEach(async function() { await removeAllDatabases(); }); describe("Validate sproc CRUD", function() { let container: Container; - beforeEach(async function() { + beforeEach(/** @this*/ async function() { container = await getTestContainer(this.test.fullTitle()); }); @@ -92,7 +92,7 @@ describe("NodeJS CRUD Tests", function() { describe("Validate stored procedure functionality", function() { let container: Container; - beforeEach(async function() { + beforeEach(/** @this*/ async function() { container = await getTestContainer(this.test.fullTitle()); }); diff --git a/sdk/cosmosdb/cosmos/test/public/functional/trigger.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/trigger.spec.ts index 4a1f4ad875e5..b53dfc254515 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/trigger.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/trigger.spec.ts @@ -10,7 +10,7 @@ const notFoundErrorCode = 404; // Mock for trigger function bodies declare let getContext: any; -describe("NodeJS CRUD Tests", function() { +describe("NodeJS CRUD Tests", /** @this*/ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); let container: Container; diff --git a/sdk/cosmosdb/cosmos/test/public/functional/ttl.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/ttl.spec.ts index 9da4ffe80eb7..37b0872d55e3 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/ttl.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/ttl.spec.ts @@ -11,7 +11,7 @@ async function sleep(time: number): Promise { }); } -describe("Container TTL", function() { +describe("Container TTL", /** @this*/ function() { this.timeout(process.env.MOCHA_TIMEOUT || 600000); beforeEach(async function() { await removeAllDatabases(); diff --git a/sdk/cosmosdb/cosmos/test/public/functional/udf.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/udf.spec.ts index 59cccd991a3e..1feb70bddcd9 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/udf.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/udf.spec.ts @@ -4,7 +4,7 @@ import assert from "assert"; import { UserDefinedFunctionDefinition, Container } from "../../../src"; import { removeAllDatabases, getTestContainer } from "../common/TestHelpers"; -describe("User Defined Function", function() { +describe("User Defined Function", /** @this*/ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); let container: Container; diff --git a/sdk/cosmosdb/cosmos/test/public/functional/user.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/user.spec.ts index df242aa00330..297cf1fb9332 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/user.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/user.spec.ts @@ -4,7 +4,7 @@ import assert from "assert"; import { UserDefinition } from "../../../src"; import { createOrUpsertUser, getTestDatabase, removeAllDatabases } from "../common/TestHelpers"; -describe("NodeJS CRUD Tests", function() { +describe("NodeJS CRUD Tests", /** @this*/ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); beforeEach(async function() { await removeAllDatabases(); diff --git a/sdk/cosmosdb/cosmos/test/public/integration/aggregateQuery.spec.ts b/sdk/cosmosdb/cosmos/test/public/integration/aggregateQuery.spec.ts index 6074fe39b8f1..42519b8d513d 100644 --- a/sdk/cosmosdb/cosmos/test/public/integration/aggregateQuery.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/integration/aggregateQuery.spec.ts @@ -9,7 +9,7 @@ import { FeedOptions } from "../../../src"; import { TestData } from "../common/TestData"; import { bulkInsertItems, getTestContainer, removeAllDatabases } from "../common/TestHelpers"; -describe("Aggregate Query", function() { +describe("Aggregate Query", /** @this*/ function() { this.timeout(process.env.MOCHA_TIMEOUT || 20000); const partitionKey = "key"; const uniquePartitionKey = "uniquePartitionKey"; diff --git a/sdk/cosmosdb/cosmos/test/public/integration/authorization.spec.ts b/sdk/cosmosdb/cosmos/test/public/integration/authorization.spec.ts index 5da7a287fe0a..f384a5b86011 100644 --- a/sdk/cosmosdb/cosmos/test/public/integration/authorization.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/integration/authorization.spec.ts @@ -6,7 +6,7 @@ import { Database } from "../../../src"; import { endpoint } from "../common/_testConfig"; import { getTestContainer, removeAllDatabases } from "../common/TestHelpers"; -describe("Authorization", function() { +describe("Authorization", /** @this*/ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); // TODO: should have types for all these things diff --git a/sdk/cosmosdb/cosmos/test/public/integration/changeFeed.spec.ts b/sdk/cosmosdb/cosmos/test/public/integration/changeFeed.spec.ts index ba91ff3bdb86..c49bd6d7be1e 100644 --- a/sdk/cosmosdb/cosmos/test/public/integration/changeFeed.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/integration/changeFeed.spec.ts @@ -5,7 +5,7 @@ import { RequestOptions } from "../../../src"; import { Container, ContainerDefinition } from "../../../src"; import { getTestContainer, removeAllDatabases } from "../common/TestHelpers"; -describe("Change Feed Iterator", function() { +describe("Change Feed Iterator", /** @this*/ function() { this.timeout(process.env.MOCHA_TIMEOUT || 20000); // delete all databases and create sample database diff --git a/sdk/cosmosdb/cosmos/test/public/integration/crossPartition.spec.ts b/sdk/cosmosdb/cosmos/test/public/integration/crossPartition.spec.ts index 171b6333e4fa..1646dbe633ae 100644 --- a/sdk/cosmosdb/cosmos/test/public/integration/crossPartition.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/integration/crossPartition.spec.ts @@ -26,7 +26,7 @@ function compare(key: string) { }; } -describe("Cross Partition", function() { +describe("Cross Partition", /** @this*/ function() { this.timeout(process.env.MOCHA_TIMEOUT || "30000"); describe("Validate Query", function() { diff --git a/sdk/cosmosdb/cosmos/test/public/integration/encoding.spec.ts b/sdk/cosmosdb/cosmos/test/public/integration/encoding.spec.ts index 10642368a6a3..44906d9a7e79 100644 --- a/sdk/cosmosdb/cosmos/test/public/integration/encoding.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/integration/encoding.spec.ts @@ -10,7 +10,7 @@ const testDoc = { "€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€" }; -describe("Create And Read Validation", function() { +describe("Create And Read Validation", /** @this*/ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); const dateTime = new Date(); diff --git a/sdk/cosmosdb/cosmos/test/public/integration/multiregion.spec.ts b/sdk/cosmosdb/cosmos/test/public/integration/multiregion.spec.ts index baf89f5c9853..99d5713b774b 100644 --- a/sdk/cosmosdb/cosmos/test/public/integration/multiregion.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/integration/multiregion.spec.ts @@ -107,7 +107,7 @@ const collectionResponse = { code: 200 }; -describe("Multi-region tests", function() { +describe("Multi-region tests", /** @this*/ function() { this.timeout(process.env.MOCHA_TIMEOUT || "30000"); it("Preferred locations should be honored for readEndpoint", async function() { diff --git a/sdk/cosmosdb/cosmos/test/public/integration/proxy.spec.ts b/sdk/cosmosdb/cosmos/test/public/integration/proxy.spec.ts index 236accade1e5..2e423186cd32 100644 --- a/sdk/cosmosdb/cosmos/test/public/integration/proxy.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/integration/proxy.spec.ts @@ -52,7 +52,7 @@ if (!isBrowser()) { }); }); - it("nativeApi Client Should execute request in error while the proxy setting is not correct", async function() { + it("nativeApi Client Should execute request in error while the proxy setting is not correct", /** @this*/ async function() { this.timeout(process.env.MOCHA_TIMEOUT || 30000); return new Promise((resolve, reject) => { proxy.listen(proxyPort + 1, "127.0.0.1", async () => { diff --git a/sdk/cosmosdb/cosmos/test/public/integration/query.spec.ts b/sdk/cosmosdb/cosmos/test/public/integration/query.spec.ts index 11f9f1821b2d..27b7a9c0dcce 100644 --- a/sdk/cosmosdb/cosmos/test/public/integration/query.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/integration/query.spec.ts @@ -6,7 +6,7 @@ import { getTestContainer, getTestDatabase, removeAllDatabases } from "../common const doc = { id: "myId", pk: "pk" }; -describe("ResourceLink Trimming of leading and trailing slashes", function() { +describe("ResourceLink Trimming of leading and trailing slashes", /** @this*/ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); const containerId = "testcontainer"; @@ -39,7 +39,7 @@ describe("ResourceLink Trimming of leading and trailing slashes", function() { }); }); -describe("Test Query Metrics", function() { +describe("Test Query Metrics", /** @this*/ function() { this.timeout(process.env.MOCHA_TIMEOUT || 20000); const collectionId = "testCollection2"; @@ -84,7 +84,7 @@ describe("Test Query Metrics", function() { }); }); -describe("Partition key in FeedOptions", function() { +describe("Partition key in FeedOptions", /** @this*/ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); beforeEach(async function() { diff --git a/sdk/cosmosdb/cosmos/test/tsdoc.json b/sdk/cosmosdb/cosmos/test/tsdoc.json new file mode 100644 index 000000000000..76f784c0fb5c --- /dev/null +++ b/sdk/cosmosdb/cosmos/test/tsdoc.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json", + "extends": ["../../../../tsdoc.json"] +} diff --git a/sdk/eventgrid/eventgrid/test/eventGridClient.spec.ts b/sdk/eventgrid/eventgrid/test/eventGridClient.spec.ts index 57bdc840281a..e72c59b329b6 100644 --- a/sdk/eventgrid/eventgrid/test/eventGridClient.spec.ts +++ b/sdk/eventgrid/eventgrid/test/eventGridClient.spec.ts @@ -1,6 +1,5 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -/* eslint-disable no-invalid-this */ import { assert } from "chai"; @@ -19,7 +18,7 @@ import { import { FullOperationResponse } from "@azure/core-client"; import { RestError } from "@azure/core-rest-pipeline"; -describe("EventGridPublisherClient", function() { +describe("EventGridPublisherClient", /** @this*/ function() { let recorder: Recorder; let res: FullOperationResponse | undefined; @@ -32,7 +31,7 @@ describe("EventGridPublisherClient", function() { describe("#send (EventGrid schema)", function() { let client: EventGridPublisherClient<"EventGrid">; - beforeEach(function() { + beforeEach(/** @this*/ function() { ({ client, recorder } = createRecordedClient( this, testEnv.EVENT_GRID_EVENT_GRID_SCHEMA_ENDPOINT, @@ -99,7 +98,7 @@ describe("EventGridPublisherClient", function() { describe("#send error cases (EventGrid schema)", function() { let client: EventGridPublisherClient<"EventGrid">; - beforeEach(function() { + beforeEach(/** @this*/ function() { ({ client, recorder } = createRecordedClient( this, removeApiEventsSuffix(testEnv.EVENT_GRID_CUSTOM_SCHEMA_ENDPOINT), @@ -142,7 +141,7 @@ describe("EventGridPublisherClient", function() { describe("#send (CloudEvent schema)", function() { let client: EventGridPublisherClient<"CloudEvent">; - beforeEach(function() { + beforeEach(/** @this*/ function() { ({ client, recorder } = createRecordedClient( this, testEnv.EVENT_GRID_CLOUD_EVENT_SCHEMA_ENDPOINT, @@ -251,7 +250,7 @@ describe("EventGridPublisherClient", function() { describe("#send error cases (CloudEvent schema)", function() { let client: EventGridPublisherClient<"CloudEvent">; - beforeEach(function() { + beforeEach(/** @this*/ function() { ({ client, recorder } = createRecordedClient( this, removeApiEventsSuffix(testEnv.EVENT_GRID_CLOUD_EVENT_SCHEMA_ENDPOINT), @@ -292,7 +291,7 @@ describe("EventGridPublisherClient", function() { describe("#send (Custom Event Schema)", function() { let client: EventGridPublisherClient<"Custom">; - beforeEach(function() { + beforeEach(/** @this*/ function() { ({ client, recorder } = createRecordedClient( this, testEnv.EVENT_GRID_CUSTOM_SCHEMA_ENDPOINT, @@ -353,7 +352,7 @@ describe("EventGridPublisherClient", function() { describe("#send error cases (Custom Event Schema)", function() { let client: EventGridPublisherClient<"Custom">; - beforeEach(function() { + beforeEach(/** @this*/ function() { ({ client, recorder } = createRecordedClient( this, removeApiEventsSuffix(testEnv.EVENT_GRID_CUSTOM_SCHEMA_ENDPOINT), diff --git a/sdk/formrecognizer/ai-form-recognizer/test/public/browser/formrecognizerclient.spec.ts b/sdk/formrecognizer/ai-form-recognizer/test/public/browser/formrecognizerclient.spec.ts index 34ff37fbd453..fb17d3526118 100644 --- a/sdk/formrecognizer/ai-form-recognizer/test/public/browser/formrecognizerclient.spec.ts +++ b/sdk/formrecognizer/ai-form-recognizer/test/public/browser/formrecognizerclient.spec.ts @@ -16,8 +16,7 @@ describe("FormRecognizerClient browser only", () => { let recorder: Recorder; const apiKey = new AzureKeyCredential(testEnv.FORM_RECOGNIZER_API_KEY); - beforeEach(function() { - // eslint-disable-next-line no-invalid-this + beforeEach(/** @this*/ function() { ({ recorder, client } = createRecordedRecognizerClient(this, apiKey)); }); diff --git a/sdk/formrecognizer/ai-form-recognizer/test/public/formtrainingclient.spec.ts b/sdk/formrecognizer/ai-form-recognizer/test/public/formtrainingclient.spec.ts index e270e294cb15..1d41aa17f5a1 100644 --- a/sdk/formrecognizer/ai-form-recognizer/test/public/formtrainingclient.spec.ts +++ b/sdk/formrecognizer/ai-form-recognizer/test/public/formtrainingclient.spec.ts @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -/* eslint-disable no-invalid-this */ - import { assert } from "chai"; import { Context } from "mocha"; @@ -29,7 +27,7 @@ matrix([[true, false]] as const, async (useAad) => { describe(`[${useAad ? "AAD" : "API Key"}] FormTrainingClient`, () => { let recorder: Recorder; - beforeEach(function(this: Context) { + beforeEach(/** @this*/ function(this: Context) { recorder = createRecorder(this); }); diff --git a/sdk/formrecognizer/ai-form-recognizer/test/public/node/formrecognizerclient.spec.ts b/sdk/formrecognizer/ai-form-recognizer/test/public/node/formrecognizerclient.spec.ts index 33cf1eeb2ee8..e3ed74e833b7 100644 --- a/sdk/formrecognizer/ai-form-recognizer/test/public/node/formrecognizerclient.spec.ts +++ b/sdk/formrecognizer/ai-form-recognizer/test/public/node/formrecognizerclient.spec.ts @@ -28,8 +28,7 @@ matrix([[true, false]] as const, async (useAad) => { let client: FormRecognizerClient; let recorder: Recorder; - beforeEach(function() { - // eslint-disable-next-line no-invalid-this + beforeEach(/** @this*/ function() { recorder = createRecorder(this); client = new FormRecognizerClient(endpoint(), makeCredential(useAad)); }); diff --git a/sdk/identity/identity/test/internal/identityClient.spec.ts b/sdk/identity/identity/test/internal/identityClient.spec.ts index f3b2188a8e05..fabafd29b565 100644 --- a/sdk/identity/identity/test/internal/identityClient.spec.ts +++ b/sdk/identity/identity/test/internal/identityClient.spec.ts @@ -77,9 +77,8 @@ describe("IdentityClient", function() { ); }); - it("throws an exception when an Env AZURE_AUTHORITY_HOST using 'http' is provided", async function() { + it("throws an exception when an Env AZURE_AUTHORITY_HOST using 'http' is provided", /** @this*/ async function() { if (!isNode) { - // eslint-disable-next-line no-invalid-this return this.skip(); } process.env.AZURE_AUTHORITY_HOST = "http://totallyinsecure.lol"; diff --git a/sdk/keyvault/keyvault-admin/.eslintrc.json b/sdk/keyvault/keyvault-admin/.eslintrc.json index aa4842f828a5..03b4c28d1be5 100644 --- a/sdk/keyvault/keyvault-admin/.eslintrc.json +++ b/sdk/keyvault/keyvault-admin/.eslintrc.json @@ -4,7 +4,6 @@ "ignorePatterns": ["src/generated"], "rules": { "@typescript-eslint/no-this-alias": "off", - "no-invalid-this": "off", "@azure/azure-sdk/ts-package-json-module": "warn", "no-use-before-define": "warn" } diff --git a/sdk/keyvault/keyvault-certificates/.eslintrc.json b/sdk/keyvault/keyvault-certificates/.eslintrc.json index 903cedb0fb82..dda4b269063f 100644 --- a/sdk/keyvault/keyvault-certificates/.eslintrc.json +++ b/sdk/keyvault/keyvault-certificates/.eslintrc.json @@ -4,7 +4,6 @@ "ignorePatterns": ["src/core"], "rules": { "@typescript-eslint/no-this-alias": "off", - "no-invalid-this": "off", "@azure/azure-sdk/ts-package-json-module": "warn", "no-use-before-define": "warn" } diff --git a/sdk/keyvault/keyvault-certificates/test/internal/challengeBasedAuthenticationPolicy.spec.ts b/sdk/keyvault/keyvault-certificates/test/internal/challengeBasedAuthenticationPolicy.spec.ts index 5922a3d59a53..a1bd850fbb4f 100644 --- a/sdk/keyvault/keyvault-certificates/test/internal/challengeBasedAuthenticationPolicy.spec.ts +++ b/sdk/keyvault/keyvault-certificates/test/internal/challengeBasedAuthenticationPolicy.spec.ts @@ -32,7 +32,7 @@ describe("Challenge based authentication tests", () => { subject: "cn=MyCert" }; - beforeEach(async function() { + beforeEach(/** @this */ async function() { const authentication = await authenticate(this); certificateSuffix = authentication.suffix; client = authentication.client; @@ -46,7 +46,7 @@ describe("Challenge based authentication tests", () => { // The tests follow - it("Authentication should work for parallel requests", async function() { + it("Authentication should work for parallel requests", /** @this */ async function() { const certificateName = testClient.formatName( `${certificatePrefix}-${this!.test!.title}-${certificateSuffix}` ); @@ -84,7 +84,7 @@ describe("Challenge based authentication tests", () => { sandbox.restore(); }); - it("Once authenticated, new requests should not authenticate again", async function() { + it("Once authenticated, new requests should not authenticate again", /** @this */ async function() { // Our goal is to intercept how our pipelines are storing the challenge. // The first network call should indeed set the challenge in memory. // Subsequent network calls should not set new challenges. diff --git a/sdk/keyvault/keyvault-certificates/test/internal/userAgent.spec.ts b/sdk/keyvault/keyvault-certificates/test/internal/userAgent.spec.ts index 993c96794dcc..63ce689de280 100644 --- a/sdk/keyvault/keyvault-certificates/test/internal/userAgent.spec.ts +++ b/sdk/keyvault/keyvault-certificates/test/internal/userAgent.spec.ts @@ -13,7 +13,7 @@ describe("Certificates client's user agent (only in Node, because of fs)", () => assert.equal(SDK_VERSION, packageVersion); }); - it("the version should also match with the one available in the package.json (only in Node, because of fs)", async function() { + it("the version should also match with the one available in the package.json (only in Node, because of fs)", /** @this */ async function() { if (!isNode) { this.skip(); return; diff --git a/sdk/keyvault/keyvault-certificates/test/public/CRUD.spec.ts b/sdk/keyvault/keyvault-certificates/test/public/CRUD.spec.ts index 8a104af66f33..bfda575d2222 100644 --- a/sdk/keyvault/keyvault-certificates/test/public/CRUD.spec.ts +++ b/sdk/keyvault/keyvault-certificates/test/public/CRUD.spec.ts @@ -32,7 +32,7 @@ describe("Certificates client - create, read, update and delete", () => { subject: "cn=MyCert" }; - beforeEach(async function() { + beforeEach(/** @this */ async function() { const authentication = await authenticate(this); suffix = authentication.suffix; client = authentication.client; @@ -49,7 +49,7 @@ describe("Certificates client - create, read, update and delete", () => { // The tests follow - it("can create a certificate", async function() { + it("can create a certificate", /** @this */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); const poller = await client.beginCreateCertificate( certificateName, @@ -65,7 +65,7 @@ describe("Certificates client - create, read, update and delete", () => { await testClient.flushCertificate(certificateName); }); - it("can abort creating a certificate", async function() { + it("can abort creating a certificate", /** @this */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); const controller = new AbortController(); @@ -80,7 +80,7 @@ describe("Certificates client - create, read, update and delete", () => { }); // On playback mode, the tests happen too fast for the timeout to work - in browsers - it("can create a certificate with requestOptions timeout", async function() { + it("can create a certificate with requestOptions timeout", /** @this */ async function() { recorder.skip("browser", "Timeout tests don't work on playback mode."); const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); @@ -114,7 +114,7 @@ describe("Certificates client - create, read, update and delete", () => { ); }); - it("can update the tags of a certificate", async function() { + it("can update the tags of a certificate", /** @this */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); await client.beginCreateCertificate( @@ -137,7 +137,7 @@ describe("Certificates client - create, read, update and delete", () => { await testClient.flushCertificate(certificateName); }); - it("can disable a certificate", async function() { + it("can disable a certificate", /** @this */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); const poller = await client.beginCreateCertificate( @@ -160,7 +160,7 @@ describe("Certificates client - create, read, update and delete", () => { await testClient.flushCertificate(certificateName); }); - it("can disable a certificate version", async function() { + it("can disable a certificate version", /** @this */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); const poller = await client.beginCreateCertificate( @@ -186,7 +186,7 @@ describe("Certificates client - create, read, update and delete", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can update certificate with requestOptions timeout", async function() { + it("can update certificate with requestOptions timeout", /** @this */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); @@ -207,7 +207,7 @@ describe("Certificates client - create, read, update and delete", () => { }); }); - it("can get a certificate", async function() { + it("can get a certificate", /** @this */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); await client.beginCreateCertificate( certificateName, @@ -223,7 +223,7 @@ describe("Certificates client - create, read, update and delete", () => { await testClient.flushCertificate(certificateName); }); - it("can get a certificate's secret in PKCS 12 format", async function() { + it("can get a certificate's secret in PKCS 12 format", /** @this */ async function() { recorder.skip("browser", "This test uses the file system."); // Skipping this test from the live browser test runs, because we use the file system. if (!isNode) { @@ -272,7 +272,7 @@ describe("Certificates client - create, read, update and delete", () => { await testClient.flushCertificate(certificateName); }); - it("can get a certificate's secret in PEM format", async function() { + it("can get a certificate's secret in PEM format", /** @this */ async function() { recorder.skip("browser", "This test uses the file system."); // Skipping this test from the live browser test runs, because we use the file system. if (!isNode) { @@ -308,7 +308,7 @@ describe("Certificates client - create, read, update and delete", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can get a certificate with requestOptions timeout", async function() { + it("can get a certificate with requestOptions timeout", /** @this */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); await client.beginCreateCertificate( @@ -321,7 +321,7 @@ describe("Certificates client - create, read, update and delete", () => { }); }); - it("can retrieve the latest version of a certificate value", async function() { + it("can retrieve the latest version of a certificate value", /** @this */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); await client.beginCreateCertificate( certificateName, @@ -339,7 +339,7 @@ describe("Certificates client - create, read, update and delete", () => { await testClient.flushCertificate(certificateName); }); - it("can get a certificate (Non Existing)", async function() { + it("can get a certificate (Non Existing)", /** @this */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); let error; try { @@ -352,7 +352,7 @@ describe("Certificates client - create, read, update and delete", () => { assert.equal(error.statusCode, 404); }); - it("can delete a certificate", async function() { + it("can delete a certificate", /** @this */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); await client.beginCreateCertificate( certificateName, @@ -382,7 +382,7 @@ describe("Certificates client - create, read, update and delete", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can delete a certificate with requestOptions timeout", async function() { + it("can delete a certificate with requestOptions timeout", /** @this */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); await client.beginCreateCertificate( @@ -400,7 +400,7 @@ describe("Certificates client - create, read, update and delete", () => { }); }); - it("can delete a certificate (Non Existing)", async function() { + it("can delete a certificate (Non Existing)", /** @this */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); let error; try { @@ -414,7 +414,7 @@ describe("Certificates client - create, read, update and delete", () => { }); describe("can get a deleted certificate", () => { - it("using beginDeleteCertificate's poller", async function() { + it("using beginDeleteCertificate's poller", /** @this */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); await client.beginCreateCertificate( certificateName, @@ -436,7 +436,7 @@ describe("Certificates client - create, read, update and delete", () => { await testClient.purgeCertificate(certificateName); }); - it("using getDeletedCertificate", async function() { + it("using getDeletedCertificate", /** @this */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); await client.beginCreateCertificate( certificateName, @@ -460,7 +460,7 @@ describe("Certificates client - create, read, update and delete", () => { await testClient.purgeCertificate(certificateName); }); - it("can not get a certificate that never existed", async function() { + it("can not get a certificate that never existed", /** @this */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); let error; try { @@ -474,7 +474,7 @@ describe("Certificates client - create, read, update and delete", () => { }); }); - it("can create, read, and delete a certificate issuer", async function() { + it("can create, read, and delete a certificate issuer", /** @this */ async function() { const issuerName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); @@ -540,7 +540,7 @@ describe("Certificates client - create, read, update and delete", () => { await testClient.flushCertificate(certificateName); }); - it("can update a certificate's policy", async function() { + it("can update a certificate's policy", /** @this */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); await client.beginCreateCertificate( @@ -562,7 +562,7 @@ describe("Certificates client - create, read, update and delete", () => { await testClient.flushCertificate(certificateName); }); - it("can read, cancel and delete a certificate's operation", async function() { + it("can read, cancel and delete a certificate's operation", /** @this */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); await client.beginCreateCertificate( certificateName, diff --git a/sdk/keyvault/keyvault-certificates/test/public/list.spec.ts b/sdk/keyvault/keyvault-certificates/test/public/list.spec.ts index b0cc4699b45e..a43412deef0c 100644 --- a/sdk/keyvault/keyvault-certificates/test/public/list.spec.ts +++ b/sdk/keyvault/keyvault-certificates/test/public/list.spec.ts @@ -26,7 +26,7 @@ describe("Certificates client - list certificates in various ways", () => { subject: "cn=MyCert" }; - beforeEach(async function() { + beforeEach(/** @this */ async function() { const authentication = await authenticate(this); suffix = authentication.suffix; client = authentication.client; @@ -43,7 +43,7 @@ describe("Certificates client - list certificates in various ways", () => { // Use this while recording to make sure the target keyvault is clean. // The next tests will produce a more consistent output. // This test is only useful while developing locally. - it("can purge all certificates", async function(): Promise { + it("can purge all certificates", /** @this */ async function(): Promise { // WARNING: When TEST_MODE equals "record", all of the certificates in the indicated KEYVAULT_NAME will be deleted as part of this test. if (!isRecordMode()) { return this.skip(); @@ -66,7 +66,7 @@ describe("Certificates client - list certificates in various ways", () => { } }); - it("can list certificates", async function() { + it("can list certificates", /** @this */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); const certificateNames = [`${certificateName}0`, `${certificateName}1`]; for (const name of certificateNames) { @@ -92,7 +92,7 @@ describe("Certificates client - list certificates in various ways", () => { } }); - it("can list deleted certificates", async function() { + it("can list deleted certificates", /** @this */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); const certificateNames = [`${certificateName}0`, `${certificateName}1`]; for (const name of certificateNames) { @@ -122,7 +122,7 @@ describe("Certificates client - list certificates in various ways", () => { } }); - it("can list certificates by page", async function() { + it("can list certificates by page", /** @this */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); const certificateNames = [`${certificateName}0`, `${certificateName}1`]; for (const name of certificateNames) { @@ -159,7 +159,7 @@ describe("Certificates client - list certificates in various ways", () => { }); } - it("can list deleted certificates by page", async function() { + it("can list deleted certificates by page", /** @this */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); const certificateNames = [`${certificateName}0`, `${certificateName}1`]; for (const name of certificateNames) { @@ -198,7 +198,7 @@ describe("Certificates client - list certificates in various ways", () => { }); }); - it("can retrieve all versions of a certificate", async function() { + it("can retrieve all versions of a certificate", /** @this */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); const certificateTags = ["tag01", "tag02", "tag03"]; @@ -255,7 +255,7 @@ describe("Certificates client - list certificates in various ways", () => { }); }); - it("can list certificate versions (non existing)", async function() { + it("can list certificate versions (non existing)", /** @this */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); let totalVersions = 0; for await (const page of client.listPropertiesOfCertificateVersions(certificateName).byPage()) { diff --git a/sdk/keyvault/keyvault-certificates/test/public/lro.create.spec.ts b/sdk/keyvault/keyvault-certificates/test/public/lro.create.spec.ts index 0319285aff35..f6f21eba0fc7 100644 --- a/sdk/keyvault/keyvault-certificates/test/public/lro.create.spec.ts +++ b/sdk/keyvault/keyvault-certificates/test/public/lro.create.spec.ts @@ -17,7 +17,7 @@ describe("Certificates client - LRO - create", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(async function() { + beforeEach(/** @this */ async function() { const authentication = await authenticate(this); certificateSuffix = authentication.suffix; client = authentication.client; @@ -31,7 +31,7 @@ describe("Certificates client - LRO - create", () => { // The tests follow - it("can wait until a certificate is created", async function() { + it("can wait until a certificate is created", /** @this */ async function() { const certificateName = testClient.formatName( `${certificatePrefix}-${this!.test!.title}-${certificateSuffix}` ); @@ -55,7 +55,7 @@ describe("Certificates client - LRO - create", () => { await testClient.flushCertificate(certificateName); }); - it("can resume from a stopped poller", async function() { + it("can resume from a stopped poller", /** @this */ async function() { const certificateName = testClient.formatName( `${certificatePrefix}-${this!.test!.title}-${certificateSuffix}` ); diff --git a/sdk/keyvault/keyvault-certificates/test/public/lro.delete.spec.ts b/sdk/keyvault/keyvault-certificates/test/public/lro.delete.spec.ts index fdc67af0149b..9377770ecec1 100644 --- a/sdk/keyvault/keyvault-certificates/test/public/lro.delete.spec.ts +++ b/sdk/keyvault/keyvault-certificates/test/public/lro.delete.spec.ts @@ -17,7 +17,7 @@ describe("Certificates client - lro - delete", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(async function() { + beforeEach(/** @this */ async function() { const authentication = await authenticate(this); certificateSuffix = authentication.suffix; client = authentication.client; @@ -31,7 +31,7 @@ describe("Certificates client - lro - delete", () => { // The tests follow - it("can wait until a certificate is deleted", async function() { + it("can wait until a certificate is deleted", /** @this */ async function() { const certificateName = testClient.formatName( `${certificatePrefix}-${this!.test!.title}-${certificateSuffix}` ); @@ -61,7 +61,7 @@ describe("Certificates client - lro - delete", () => { await testClient.purgeCertificate(certificateName); }); - it("can resume from a stopped poller", async function() { + it("can resume from a stopped poller", /** @this */ async function() { const certificateName = testClient.formatName( `${certificatePrefix}-${this!.test!.title}-${certificateSuffix}` ); diff --git a/sdk/keyvault/keyvault-certificates/test/public/lro.operation.spec.ts b/sdk/keyvault/keyvault-certificates/test/public/lro.operation.spec.ts index 3f617de0025b..85e5f9666d24 100644 --- a/sdk/keyvault/keyvault-certificates/test/public/lro.operation.spec.ts +++ b/sdk/keyvault/keyvault-certificates/test/public/lro.operation.spec.ts @@ -21,7 +21,7 @@ describe("Certificates client - LRO - certificate operation", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(async function() { + beforeEach(/** @this */ async function() { const authentication = await authenticate(this); certificateSuffix = authentication.suffix; client = authentication.client; @@ -35,7 +35,7 @@ describe("Certificates client - LRO - certificate operation", () => { // The tests follow - it("can wait until a certificate is created by getting the poller from getCertificateOperation", async function() { + it("can wait until a certificate is created by getting the poller from getCertificateOperation", /** @this */ async function() { const certificateName = testClient.formatName( `${certificatePrefix}-${this!.test!.title}-${certificateSuffix}` ); @@ -64,7 +64,7 @@ describe("Certificates client - LRO - certificate operation", () => { await testClient.flushCertificate(certificateName); }); - it("can resume from a stopped poller", async function() { + it("can resume from a stopped poller", /** @this */ async function() { const certificateName = testClient.formatName( `${certificatePrefix}-${this!.test!.title}-${certificateSuffix}` ); diff --git a/sdk/keyvault/keyvault-certificates/test/public/lro.recover.spec.ts b/sdk/keyvault/keyvault-certificates/test/public/lro.recover.spec.ts index 4f615e7d8024..a7e0d74ff1e8 100644 --- a/sdk/keyvault/keyvault-certificates/test/public/lro.recover.spec.ts +++ b/sdk/keyvault/keyvault-certificates/test/public/lro.recover.spec.ts @@ -18,7 +18,7 @@ describe("Certificates client - LRO - recoverDelete", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(async function() { + beforeEach(/** @this */ async function() { const authentication = await authenticate(this); certificateSuffix = authentication.suffix; client = authentication.client; @@ -32,7 +32,7 @@ describe("Certificates client - LRO - recoverDelete", () => { // The tests follow - it("can wait until a certificate is recovered", async function() { + it("can wait until a certificate is recovered", /** @this */ async function() { const certificateName = testClient.formatName( `${certificatePrefix}-${this!.test!.title}-${certificateSuffix}` ); @@ -65,7 +65,7 @@ describe("Certificates client - LRO - recoverDelete", () => { await testClient.flushCertificate(certificateName); }); - it("can resume from a stopped poller", async function() { + it("can resume from a stopped poller", /** @this */ async function() { const certificateName = testClient.formatName( `${certificatePrefix}-${this!.test!.title}-${certificateSuffix}` ); @@ -112,7 +112,7 @@ describe("Certificates client - LRO - recoverDelete", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can recover a deleted certificate with requestOptions timeout", async function() { + it("can recover a deleted certificate with requestOptions timeout", /** @this */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const certificateName = testClient.formatName( `${certificatePrefix}-${this!.test!.title}-${certificateSuffix}` diff --git a/sdk/keyvault/keyvault-certificates/test/public/mergeAndImport.spec.ts b/sdk/keyvault/keyvault-certificates/test/public/mergeAndImport.spec.ts index 2c28b8328f82..a423f6692dbb 100644 --- a/sdk/keyvault/keyvault-certificates/test/public/mergeAndImport.spec.ts +++ b/sdk/keyvault/keyvault-certificates/test/public/mergeAndImport.spec.ts @@ -24,7 +24,7 @@ describe("Certificates client - merge and import certificates", () => { let credential: ClientSecretCredential; let secretClient: SecretClient; - beforeEach(async function() { + beforeEach(/** @this */ async function() { const authentication = await authenticate(this); suffix = authentication.suffix; client = authentication.client; @@ -41,7 +41,7 @@ describe("Certificates client - merge and import certificates", () => { // The tests follow - it("can import a certificate from a certificate's non base64 secret value", async function() { + it("can import a certificate from a certificate's non base64 secret value", /** @this */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); const certificateNames = [`${certificateName}0`, `${certificateName}1`]; const createPoller = await client.beginCreateCertificate( @@ -65,7 +65,7 @@ describe("Certificates client - merge and import certificates", () => { } }); - it("can import a certificate from a certificate's base64 secret value", async function() { + it("can import a certificate from a certificate's base64 secret value", /** @this */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); const certificateNames = [`${certificateName}0`, `${certificateName}1`]; const createPoller = await client.beginCreateCertificate( @@ -95,7 +95,7 @@ describe("Certificates client - merge and import certificates", () => { // The signed certificate will never be the same, so we can't play it back. // This test is only designed to work on NodeJS, since we use child_process to interact with openssl. - it("can merge a self signed certificate", async function(): Promise { + it("can merge a self signed certificate", /** @this */ async function(): Promise { recorder.skip( undefined, "The signed certificate will never be the same, so we can't play it back." diff --git a/sdk/keyvault/keyvault-certificates/test/public/recoverBackupRestore.spec.ts b/sdk/keyvault/keyvault-certificates/test/public/recoverBackupRestore.spec.ts index 4fb5d7f28462..5c1dad27952c 100644 --- a/sdk/keyvault/keyvault-certificates/test/public/recoverBackupRestore.spec.ts +++ b/sdk/keyvault/keyvault-certificates/test/public/recoverBackupRestore.spec.ts @@ -23,7 +23,7 @@ describe("Certificates client - restore certificates and recover backups", () => subject: "cn=MyCert" }; - beforeEach(async function() { + beforeEach(/** @this */ async function() { const authentication = await authenticate(this); suffix = authentication.suffix; client = authentication.client; @@ -37,7 +37,7 @@ describe("Certificates client - restore certificates and recover backups", () => // The tests follow - it("can recover a deleted certificate", async function() { + it("can recover a deleted certificate", /** @this */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); const createPoller = await client.beginCreateCertificate( certificateName, @@ -65,7 +65,7 @@ describe("Certificates client - restore certificates and recover backups", () => await testClient.flushCertificate(certificateName); }); - it("can recover a deleted certificate (non existing)", async function() { + it("can recover a deleted certificate (non existing)", /** @this */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); let error; try { @@ -81,7 +81,7 @@ describe("Certificates client - restore certificates and recover backups", () => if (isRecordMode() || isPlaybackMode()) { // This test can't run live, // since the purge operation currently can't be expected to finish anytime soon. - it("can restore a certificate", async function() { + it("can restore a certificate", /** @this */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); const createPoller = await client.beginCreateCertificate( certificateName, @@ -141,7 +141,7 @@ describe("Certificates client - restore certificates and recover backups", () => if (isNode && !isPlaybackMode()) { // On playback mode, the tests happen too fast for the timeout to work - it("can restore a key with requestOptions timeout", async function() { + it("can restore a key with requestOptions timeout", /** @this */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); const createPoller = await client.beginCreateCertificate( certificateName, diff --git a/sdk/keyvault/keyvault-certificates/test/utils/lro/restore/operation.ts b/sdk/keyvault/keyvault-certificates/test/utils/lro/restore/operation.ts index fc950e86d3b8..357da1323045 100644 --- a/sdk/keyvault/keyvault-certificates/test/utils/lro/restore/operation.ts +++ b/sdk/keyvault/keyvault-certificates/test/utils/lro/restore/operation.ts @@ -54,6 +54,7 @@ export interface RestoreCertificateBackupPollOperation /** * Reaches to the service and updates the restore certificate's poll operation. * @param options - The optional parameters, which are an abortSignal from \@azure/abort-controller and a function that triggers the poller's onProgress function. + * @this */ async function update( this: RestoreCertificateBackupPollOperation, @@ -92,6 +93,7 @@ async function cancel(this: RestoreCertificateBackupPollOperation): Promise { describe("local-only tests", async function() { - it("encrypts and decrypts locally", async function() { + it("encrypts and decrypts locally", /** @this */ async function() { const text = this.test!.title; const encryptResult = await cryptoClient.encrypt({ algorithm: encryptionAlgorithm, @@ -75,7 +75,7 @@ describe("AesCryptographyProvider internal tests", function() { assert.equal(uint8ArrayToString(decryptResult.result), text); }); - it("validates the key type", async function() { + it("validates the key type", /** @this */ async function() { const text = this.test!.title; jwk.kty = "RSA"; @@ -98,7 +98,7 @@ describe("AesCryptographyProvider internal tests", function() { ); }); - it("validates the key length", async function() { + it("validates the key length", /** @this */ async function() { const text = this.test!.title; jwk.k = getKey((keySize >> 3) - 1); @@ -132,7 +132,7 @@ describe("AesCryptographyProvider internal tests", function() { let keyVaultKey: KeyVaultKey; let remoteProvider: RemoteCryptographyProvider; - beforeEach(async function() { + beforeEach(/** @this */ async function() { const authentication = await authenticate(this); recorder = authentication.recorder; @@ -152,7 +152,7 @@ describe("AesCryptographyProvider internal tests", function() { await recorder.stop(); }); - it("encrypts locally and decrypts remotely", async function() { + it("encrypts locally and decrypts remotely", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this.test!.title}-${keySuffix}`); keyVaultKey = await client.importKey(keyName, jwk, {}); remoteProvider = new RemoteCryptographyProvider(keyVaultKey, credential); @@ -174,7 +174,7 @@ describe("AesCryptographyProvider internal tests", function() { await testClient.flushKey(keyName); }); - it("encrypts remotely and decrypts locally", async function() { + it("encrypts remotely and decrypts locally", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this.test!.title}-${keySuffix}`); keyVaultKey = await client.importKey(keyName, jwk, {}); remoteProvider = new RemoteCryptographyProvider(keyVaultKey, credential); diff --git a/sdk/keyvault/keyvault-keys/test/internal/challengeBasedAuthenticationPolicy.spec.ts b/sdk/keyvault/keyvault-keys/test/internal/challengeBasedAuthenticationPolicy.spec.ts index a9be2e0db0ce..37397a355650 100644 --- a/sdk/keyvault/keyvault-keys/test/internal/challengeBasedAuthenticationPolicy.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/internal/challengeBasedAuthenticationPolicy.spec.ts @@ -26,7 +26,7 @@ describe("Challenge based authentication tests", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(async function() { + beforeEach(/** @this */ async function() { const authentication = await authenticate(this); keySuffix = authentication.keySuffix; client = authentication.client; @@ -40,7 +40,7 @@ describe("Challenge based authentication tests", () => { // The tests follow - it("Authentication should work for parallel requests", async function() { + it("Authentication should work for parallel requests", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const keyNames = [`${keyName}-0`, `${keyName}-1`]; @@ -71,7 +71,7 @@ describe("Challenge based authentication tests", () => { sandbox.restore(); }); - it("Once authenticated, new requests should not authenticate again", async function() { + it("Once authenticated, new requests should not authenticate again", /** @this */ async function() { // Our goal is to intercept how our pipelines are storing the challenge. // The first network call should indeed set the challenge in memory. // Subsequent network calls should not set new challenges. diff --git a/sdk/keyvault/keyvault-keys/test/internal/crypto.spec.ts b/sdk/keyvault/keyvault-keys/test/internal/crypto.spec.ts index 0a2da2002ab6..bf97df4bf012 100644 --- a/sdk/keyvault/keyvault-keys/test/internal/crypto.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/internal/crypto.spec.ts @@ -135,7 +135,7 @@ describe("internal crypto tests", () => { }); describe("Encrypt parameter mapping", async function() { - it("maps parameters correctly when using the previous API", async function() { + it("maps parameters correctly when using the previous API", /** @this */ async function() { const text = stringToUint8Array(this.test!.title!); await client.encrypt("RSA1_5", text, { requestOptions: { timeout: 5 } }); @@ -146,7 +146,7 @@ describe("internal crypto tests", () => { ); }); - it("maps parameters correctly when using the current API", async function() { + it("maps parameters correctly when using the current API", /** @this */ async function() { const text = stringToUint8Array(this.test!.title!); await client.encrypt( @@ -163,7 +163,7 @@ describe("internal crypto tests", () => { }); describe("Decrypt parameter mapping", async function() { - it("maps parameters correctly when using the previous API", async function() { + it("maps parameters correctly when using the previous API", /** @this */ async function() { const text = stringToUint8Array(this.test!.title!); await client.decrypt("RSA1_5", text, { requestOptions: { timeout: 5 } }); @@ -174,7 +174,7 @@ describe("internal crypto tests", () => { ); }); - it("maps parameters correctly when using the current API", async function() { + it("maps parameters correctly when using the current API", /** @this */ async function() { const text = stringToUint8Array(this.test!.title!); await client.decrypt( @@ -192,7 +192,7 @@ describe("internal crypto tests", () => { }); describe("RSA local cryptography tests", function() { - it("throws a validation error when the key is invalid", function() { + it("throws a validation error when the key is invalid", /** @this */ function() { if (!isNode) { // Local cryptography is not supported in the browser this.skip(); @@ -204,7 +204,7 @@ describe("internal crypto tests", () => { ); }); - it("uses the browser replacement when running in the browser", function() { + it("uses the browser replacement when running in the browser", /** @this */ function() { if (isNode) { this.skip(); } diff --git a/sdk/keyvault/keyvault-keys/test/internal/userAgent.spec.ts b/sdk/keyvault/keyvault-keys/test/internal/userAgent.spec.ts index 6571b5891ffe..c4583b3176ba 100644 --- a/sdk/keyvault/keyvault-keys/test/internal/userAgent.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/internal/userAgent.spec.ts @@ -13,7 +13,7 @@ describe("Keys client's user agent (only in Node, because of fs)", () => { assert.equal(SDK_VERSION, packageVersion); }); - it("the version should also match with the one available in the package.json (only in Node, because of fs)", async function() { + it("the version should also match with the one available in the package.json (only in Node, because of fs)", /** @this */ async function() { if (!isNode) { this.skip(); return; diff --git a/sdk/keyvault/keyvault-keys/test/public/CRUD.hsm.spec.ts b/sdk/keyvault/keyvault-keys/test/public/CRUD.hsm.spec.ts index 89d926d862c2..bacafd27e446 100644 --- a/sdk/keyvault/keyvault-keys/test/public/CRUD.hsm.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/public/CRUD.hsm.spec.ts @@ -16,7 +16,7 @@ describe("Keys client - create, read, update and delete operations for managed H let testClient: TestClient; let recorder: Recorder; - beforeEach(async function() { + beforeEach(/** @this */ async function() { const authentication = await authenticate(this); recorder = authentication.recorder; @@ -35,7 +35,7 @@ describe("Keys client - create, read, update and delete operations for managed H await recorder.stop(); }); - it("can create an OCT key with options", async function() { + it("can create an OCT key with options", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const options: CreateOctKeyOptions = { hsm: true diff --git a/sdk/keyvault/keyvault-keys/test/public/CRUD.spec.ts b/sdk/keyvault/keyvault-keys/test/public/CRUD.spec.ts index c1515e588bff..8f67e611136e 100644 --- a/sdk/keyvault/keyvault-keys/test/public/CRUD.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/public/CRUD.spec.ts @@ -24,7 +24,7 @@ describe("Keys client - create, read, update and delete operations", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(async function() { + beforeEach(/** @this */ async function() { const authentication = await authenticate(this); keySuffix = authentication.keySuffix; client = authentication.client; @@ -38,7 +38,7 @@ describe("Keys client - create, read, update and delete operations", () => { // The tests follow - it("can create a key while giving a manual type", async function() { + it("can create a key while giving a manual type", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const result = await client.createKey(keyName, "RSA"); assert.equal(result.name, keyName, "Unexpected key name in result from createKey()."); @@ -46,7 +46,7 @@ describe("Keys client - create, read, update and delete operations", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can abort creating a key", async function() { + it("can abort creating a key", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const controller = new AbortController(); @@ -60,7 +60,7 @@ describe("Keys client - create, read, update and delete operations", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can create a key with requestOptions timeout", async function() { + it("can create a key with requestOptions timeout", /** @this */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await assertThrowsAbortError(async () => { @@ -88,14 +88,14 @@ describe("Keys client - create, read, update and delete operations", () => { ); }); - it("can create a RSA key", async function() { + it("can create a RSA key", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const result = await client.createRsaKey(keyName); assert.equal(result.name, keyName, "Unexpected key name in result from createKey()."); await testClient.flushKey(keyName); }); - it("can create a RSA key with size", async function() { + it("can create a RSA key with size", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const options = { keySize: 2048 @@ -105,7 +105,7 @@ describe("Keys client - create, read, update and delete operations", () => { await testClient.flushKey(keyName); }); - it("can create a RSA key with public exponent", async function() { + it("can create a RSA key with public exponent", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const options = { publicExponent: 3 @@ -116,7 +116,7 @@ describe("Keys client - create, read, update and delete operations", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can create a RSA key with requestOptions timeout", async function() { + it("can create a RSA key with requestOptions timeout", /** @this */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); @@ -129,14 +129,14 @@ describe("Keys client - create, read, update and delete operations", () => { }); }); - it("can create an EC key", async function() { + it("can create an EC key", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const result = await client.createEcKey(keyName); assert.equal(result.name, keyName, "Unexpected key name in result from createKey()."); await testClient.flushKey(keyName); }); - it("can create an EC key with curve", async function() { + it("can create an EC key with curve", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const options: CreateEcKeyOptions = { curve: "P-256" @@ -147,7 +147,7 @@ describe("Keys client - create, read, update and delete operations", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can create an EC key with requestOptions timeout", async function() { + it("can create an EC key with requestOptions timeout", /** @this */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await assertThrowsAbortError(async () => { @@ -159,7 +159,7 @@ describe("Keys client - create, read, update and delete operations", () => { }); }); - it("can create a disabled key", async function() { + it("can create a disabled key", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const options = { enabled: false @@ -169,7 +169,7 @@ describe("Keys client - create, read, update and delete operations", () => { await testClient.flushKey(keyName); }); - it("can create a key with notBefore", async function() { + it("can create a key with notBefore", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const date = new Date("2019-01-01"); const notBefore = new Date(date.getTime() + 5000); // 5 seconds later @@ -187,7 +187,7 @@ describe("Keys client - create, read, update and delete operations", () => { await testClient.flushKey(keyName); }); - it("can create a key with expires", async function() { + it("can create a key with expires", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const date = new Date("2019-01-01"); const expiresOn = new Date(date.getTime() + 5000); // 5 seconds later @@ -205,7 +205,7 @@ describe("Keys client - create, read, update and delete operations", () => { await testClient.flushKey(keyName); }); - it("can update key", async function() { + it("can update key", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const { version } = (await client.createRsaKey(keyName)).properties; const options: UpdateKeyPropertiesOptions = { enabled: false }; @@ -214,7 +214,7 @@ describe("Keys client - create, read, update and delete operations", () => { await testClient.flushKey(keyName); }); - it("can update a disabled key", async function() { + it("can update a disabled key", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const createOptions = { enabled: false @@ -233,7 +233,7 @@ describe("Keys client - create, read, update and delete operations", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can update key with requestOptions timeout", async function() { + it("can update key with requestOptions timeout", /** @this */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const { version } = (await client.createRsaKey(keyName)).properties; @@ -246,7 +246,7 @@ describe("Keys client - create, read, update and delete operations", () => { }); }); - it("can delete a key", async function() { + it("can delete a key", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await client.createKey(keyName, "RSA"); const poller = await client.beginDeleteKey(keyName, testPollerProperties); @@ -267,7 +267,7 @@ describe("Keys client - create, read, update and delete operations", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can delete a key with requestOptions timeout", async function() { + it("can delete a key with requestOptions timeout", /** @this */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await client.createKey(keyName, "RSA"); @@ -281,7 +281,7 @@ describe("Keys client - create, read, update and delete operations", () => { }); }); - it("delete nonexisting key", async function() { + it("delete nonexisting key", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); try { await client.getKey(keyName); @@ -296,7 +296,7 @@ describe("Keys client - create, read, update and delete operations", () => { } }); - it("can get a key", async function() { + it("can get a key", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await client.createKey(keyName, "RSA"); const getResult = await client.getKey(keyName); @@ -305,7 +305,7 @@ describe("Keys client - create, read, update and delete operations", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can get a key with requestOptions timeout", async function() { + it("can get a key with requestOptions timeout", /** @this */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await client.createKey(keyName, "RSA"); @@ -314,7 +314,7 @@ describe("Keys client - create, read, update and delete operations", () => { }); }); - it("can get a specific version of a key", async function() { + it("can get a specific version of a key", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const { version } = (await client.createKey(keyName, "RSA")).properties; const options: GetKeyOptions = { version }; @@ -327,7 +327,7 @@ describe("Keys client - create, read, update and delete operations", () => { await testClient.flushKey(keyName); }); - it("can get a deleted key", async function() { + it("can get a deleted key", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await client.createKey(keyName, "RSA"); const poller = await client.beginDeleteKey(keyName, testPollerProperties); @@ -348,7 +348,7 @@ describe("Keys client - create, read, update and delete operations", () => { await testClient.purgeKey(keyName); }); - it("can't get a deleted key that doesn't exist", async function() { + it("can't get a deleted key that doesn't exist", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); let error; try { @@ -362,7 +362,7 @@ describe("Keys client - create, read, update and delete operations", () => { assert.equal(error.statusCode, 404); }); - it("can purge a deleted key", async function() { + it("can purge a deleted key", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await client.createKey(keyName, "RSA"); const poller = await client.beginDeleteKey(keyName, testPollerProperties); diff --git a/sdk/keyvault/keyvault-keys/test/public/crypto.hsm.spec.ts b/sdk/keyvault/keyvault-keys/test/public/crypto.hsm.spec.ts index 824fd839a5b0..a577fa0877a1 100644 --- a/sdk/keyvault/keyvault-keys/test/public/crypto.hsm.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/public/crypto.hsm.spec.ts @@ -20,7 +20,7 @@ describe("CryptographyClient for managed HSM (skipped if MHSM is not deployed)", let keyVaultKey: KeyVaultKey; let keySuffix: string; - beforeEach(async function() { + beforeEach(/** @this */ async function() { const authentication = await authenticate(this); recorder = authentication.recorder; @@ -43,7 +43,7 @@ describe("CryptographyClient for managed HSM (skipped if MHSM is not deployed)", }); describe("with AES crypto algorithms", async function() { - it("encrypts and decrypts using AES-GCM", async function() { + it("encrypts and decrypts using AES-GCM", /** @this */ async function() { keyVaultKey = await hsmClient.createKey(keyName, "AES", { keySize: 256 }); cryptoClient = new CryptographyClient(keyVaultKey.id!, credential); const text = this.test!.title; @@ -63,7 +63,7 @@ describe("CryptographyClient for managed HSM (skipped if MHSM is not deployed)", assert.equal(text, uint8ArrayToString(decryptResult.result)); }); - it("encrypts and decrypts using AES-CBC", async function() { + it("encrypts and decrypts using AES-CBC", /** @this */ async function() { keyVaultKey = await hsmClient.createKey(keyName, "AES", { keySize: 256 }); cryptoClient = new CryptographyClient(keyVaultKey.id!, credential); const text = this.test!.title; diff --git a/sdk/keyvault/keyvault-keys/test/public/crypto.spec.ts b/sdk/keyvault/keyvault-keys/test/public/crypto.spec.ts index db100bfe9e97..424745389788 100644 --- a/sdk/keyvault/keyvault-keys/test/public/crypto.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/public/crypto.spec.ts @@ -29,7 +29,7 @@ describe("CryptographyClient (all decrypts happen remotely)", () => { return; } - beforeEach(async function() { + beforeEach(/** @this */ async function() { const authentication = await authenticate(this); client = authentication.client; recorder = authentication.recorder; @@ -41,7 +41,7 @@ describe("CryptographyClient (all decrypts happen remotely)", () => { cryptoClient = new CryptographyClient(keyVaultKey.id!, credential); }); - afterEach(async function() { + afterEach(/** @this */ async function() { if (!this.currentTest?.isPending()) { await testClient.flushKey(keyName); } @@ -51,7 +51,7 @@ describe("CryptographyClient (all decrypts happen remotely)", () => { // The tests follow if (!isPlaybackMode()) { - it("encrypt & decrypt with RSA1_5", async function() { + it("encrypt & decrypt with RSA1_5", /** @this */ async function() { const text = this.test!.title; const encryptResult = await cryptoClient.encrypt({ algorithm: "RSA1_5", @@ -65,7 +65,7 @@ describe("CryptographyClient (all decrypts happen remotely)", () => { assert.equal(text, decryptedText); }); - it("manually encrypt locally and decrypt remotely, both with RSA1_5", async function() { + it("manually encrypt locally and decrypt remotely, both with RSA1_5", /** @this */ async function() { const text = this.test!.title; const localProvider = new RsaCryptographyProvider(keyVaultKey.key!); const encryptResult = await localProvider.encrypt({ @@ -80,7 +80,7 @@ describe("CryptographyClient (all decrypts happen remotely)", () => { assert.equal(text, decryptedText); }); - it("encrypt & decrypt with RSA-OAEP", async function() { + it("encrypt & decrypt with RSA-OAEP", /** @this */ async function() { const text = this.test!.title; const encryptResult = await cryptoClient.encrypt( { @@ -97,7 +97,7 @@ describe("CryptographyClient (all decrypts happen remotely)", () => { assert.equal(text, decryptedText); }); - it("manually encrypt locally and decrypt remotely, both with RSA-OAEP", async function() { + it("manually encrypt locally and decrypt remotely, both with RSA-OAEP", /** @this */ async function() { const text = this.test!.title; const localProvider = new RsaCryptographyProvider(keyVaultKey.key!); const encryptResult = await localProvider.encrypt({ @@ -112,7 +112,7 @@ describe("CryptographyClient (all decrypts happen remotely)", () => { assert.equal(text, decryptedText); }); - it("the CryptographyClient can be created from a full KeyVaultKey object", async function() { + it("the CryptographyClient can be created from a full KeyVaultKey object", /** @this */ async function() { const customKeyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const customKeyVaultKey = await client.createKey(customKeyName, "RSA"); const cryptoClientFromKey = new CryptographyClient(customKeyVaultKey, credential); @@ -162,7 +162,7 @@ describe("CryptographyClient (all decrypts happen remotely)", () => { assert.equal("RSA1_5", unwrappedResult.algorithm); }); - it("wrap and unwrap with RSA-OAEP", async function() { + it("wrap and unwrap with RSA-OAEP", /** @this */ async function() { recorder.skip( undefined, "Wrapping and unwrapping don't cause a repeatable pattern, so these tests can only run in playback mode" @@ -176,7 +176,7 @@ describe("CryptographyClient (all decrypts happen remotely)", () => { }); if (!isPlaybackMode()) { - it("encrypt & decrypt with an RSA-HSM key and the RSA-OAEP algorithm", async function() { + it("encrypt & decrypt with an RSA-HSM key and the RSA-OAEP algorithm", /** @this */ async function() { const hsmKeyName = keyName + "2"; const hsmKey = await client.createKey(hsmKeyName, "RSA-HSM"); const hsmCryptoClient = new CryptographyClient(hsmKey.id!, credential); @@ -188,7 +188,7 @@ describe("CryptographyClient (all decrypts happen remotely)", () => { await testClient.flushKey(hsmKeyName); }); - it("encrypt & decrypt with an RSA-HSM key and the RSA1_5 algorithm", async function() { + it("encrypt & decrypt with an RSA-HSM key and the RSA1_5 algorithm", /** @this */ async function() { const hsmKeyName = keyName + "2"; const hsmKey = await client.createKey(hsmKeyName, "RSA-HSM"); const hsmCryptoClient = new CryptographyClient(hsmKey.id!, credential); @@ -201,7 +201,7 @@ describe("CryptographyClient (all decrypts happen remotely)", () => { }); } - it("wrap and unwrap with RSA-OAEP on a RSA-HSM key", async function() { + it("wrap and unwrap with RSA-OAEP on a RSA-HSM key", /** @this */ async function() { recorder.skip( undefined, "Wrapping and unwrapping don't cause a repeatable pattern, so this test can only run live" @@ -217,7 +217,7 @@ describe("CryptographyClient (all decrypts happen remotely)", () => { await testClient.flushKey(hsmKeyName); }); - it("wrap and unwrap with RSA1_5 on a RSA-HSM key", async function() { + it("wrap and unwrap with RSA1_5 on a RSA-HSM key", /** @this */ async function() { recorder.skip( undefined, "Wrapping and unwrapping don't cause a repeatable pattern, so this test can only run live" @@ -233,7 +233,7 @@ describe("CryptographyClient (all decrypts happen remotely)", () => { await testClient.flushKey(hsmKeyName); }); - it("sign and verify with RS256 through an RSA-HSM key", async function(): Promise { + it("sign and verify with RS256 through an RSA-HSM key", /** @this */ async function(): Promise { const hsmKeyName = keyName + "2"; const hsmKey = await client.createKey(hsmKeyName, "RSA-HSM"); const hsmCryptoClient = new CryptographyClient(hsmKey.id!, credential); @@ -264,7 +264,7 @@ describe("CryptographyClient (all decrypts happen remotely)", () => { await testClient.flushKey(hsmKeyName); }); - it("sign and verify with RS384 through an RSA-HSM key", async function(): Promise { + it("sign and verify with RS384 through an RSA-HSM key", /** @this */ async function(): Promise { const hsmKeyName = keyName + "2"; const hsmKey = await client.createKey(hsmKeyName, "RSA-HSM"); const hsmCryptoClient = new CryptographyClient(hsmKey.id!, credential); diff --git a/sdk/keyvault/keyvault-keys/test/public/import.spec.ts b/sdk/keyvault/keyvault-keys/test/public/import.spec.ts index 2788491f14f5..94dfe4da58d4 100644 --- a/sdk/keyvault/keyvault-keys/test/public/import.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/public/import.spec.ts @@ -16,7 +16,7 @@ describe("Keys client - import keys", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(async function() { + beforeEach(/** @this */ async function() { const authentication = await authenticate(this); suffix = authentication.keySuffix; client = authentication.client; @@ -30,7 +30,7 @@ describe("Keys client - import keys", () => { // The tests follow - it("can import a key", async function() { + it("can import a key", /** @this */ async function() { const keyName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); function toBytes(hex: string): Uint8Array { if (hex.length % 2) { diff --git a/sdk/keyvault/keyvault-keys/test/public/list.spec.ts b/sdk/keyvault/keyvault-keys/test/public/list.spec.ts index c077dcfa82e4..9bdefa3da8bc 100644 --- a/sdk/keyvault/keyvault-keys/test/public/list.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/public/list.spec.ts @@ -20,7 +20,7 @@ versionsToTest(serviceApiVersions, {}, (serviceVersion, onVersions) => { let testClient: TestClient; let recorder: Recorder; - beforeEach(async function() { + beforeEach(/** @this */ async function() { const authentication = await authenticate(this, serviceVersion); keySuffix = authentication.keySuffix; client = authentication.client; @@ -37,7 +37,7 @@ versionsToTest(serviceApiVersions, {}, (serviceVersion, onVersions) => { // Use this while recording to make sure the target keyvault is clean. // The next tests will produce a more consistent output. // This test is only useful while developing locally. - it("can purge all keys", async function(): Promise { + it("can purge all keys", /** @this */ async function(): Promise { // WARNING: When TEST_MODE equals "record", all of the keys in the indicated KEYVAULT_URI will be deleted as part of this test. if (!isRecordMode()) { return this.skip(); @@ -58,7 +58,7 @@ versionsToTest(serviceApiVersions, {}, (serviceVersion, onVersions) => { } }); - it("can get the versions of a key", async function() { + it("can get the versions of a key", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await client.createKey(keyName, "RSA"); let totalVersions = 0; @@ -85,7 +85,7 @@ versionsToTest(serviceApiVersions, {}, (serviceVersion, onVersions) => { }); }); - it("can get the versions of a key (paged)", async function() { + it("can get the versions of a key (paged)", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await client.createKey(keyName, "RSA"); let totalVersions = 0; @@ -103,7 +103,7 @@ versionsToTest(serviceApiVersions, {}, (serviceVersion, onVersions) => { await testClient.flushKey(keyName); }); - it("list 0 versions of a non-existing key", async function() { + it("list 0 versions of a non-existing key", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); let totalVersions = 0; for await (const version of client.listPropertiesOfKeyVersions(keyName)) { @@ -117,7 +117,7 @@ versionsToTest(serviceApiVersions, {}, (serviceVersion, onVersions) => { assert.equal(totalVersions, 0, `Unexpected total versions for key ${keyName}`); }); - it("list 0 versions of a non-existing key (paged)", async function() { + it("list 0 versions of a non-existing key (paged)", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); let totalVersions = 0; for await (const page of client.listPropertiesOfKeyVersions(keyName).byPage()) { @@ -133,7 +133,7 @@ versionsToTest(serviceApiVersions, {}, (serviceVersion, onVersions) => { assert.equal(totalVersions, 0, `Unexpected total versions for key ${keyName}`); }); - it("can get several inserted keys", async function() { + it("can get several inserted keys", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const keyNames = [`${keyName}-0`, `${keyName}-1`]; for (const name of keyNames) { @@ -164,7 +164,7 @@ versionsToTest(serviceApiVersions, {}, (serviceVersion, onVersions) => { }); }); - it("can get several inserted keys (paged)", async function() { + it("can get several inserted keys (paged)", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const keyNames = [`${keyName}-0`, `${keyName}-1`]; for (const name of keyNames) { @@ -187,7 +187,7 @@ versionsToTest(serviceApiVersions, {}, (serviceVersion, onVersions) => { } }); - it("list deleted keys", async function() { + it("list deleted keys", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const keyNames = [`${keyName}-0`, `${keyName}-1`]; for (const name of keyNames) { @@ -221,7 +221,7 @@ versionsToTest(serviceApiVersions, {}, (serviceVersion, onVersions) => { }); }); - it("list deleted keys (paged)", async function() { + it("list deleted keys (paged)", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const keyNames = [`${keyName}-0`, `${keyName}-1`]; for (const name of keyNames) { diff --git a/sdk/keyvault/keyvault-keys/test/public/localCryptography.spec.ts b/sdk/keyvault/keyvault-keys/test/public/localCryptography.spec.ts index 8444cb2e4863..1a84cf301ff2 100644 --- a/sdk/keyvault/keyvault-keys/test/public/localCryptography.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/public/localCryptography.spec.ts @@ -33,7 +33,7 @@ describe("Local cryptography public tests", () => { return; } - beforeEach(async function() { + beforeEach(/** @this */ async function() { const authentication = await authenticate(this); client = authentication.client; recorder = authentication.recorder; @@ -51,7 +51,7 @@ describe("Local cryptography public tests", () => { let customKeyVaultKey: KeyVaultKey; let cryptoClientFromKey: CryptographyClient; - beforeEach(async function() { + beforeEach(/** @this */ async function() { customKeyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); customKeyVaultKey = await client.createKey(customKeyName, "RSA"); cryptoClientFromKey = new CryptographyClient(customKeyVaultKey.key!); @@ -123,7 +123,7 @@ describe("Local cryptography public tests", () => { }); }); - it("encrypt & decrypt RSA1_5", async function() { + it("encrypt & decrypt RSA1_5", /** @this */ async function() { recorder.skip(undefined, "Local encryption can't be tested on playback"); const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const keyVaultKey = await client.createKey(keyName, "RSA"); @@ -137,7 +137,7 @@ describe("Local cryptography public tests", () => { await testClient.flushKey(keyName); }); - it("encrypt & decrypt RSA-OAEP", async function() { + it("encrypt & decrypt RSA-OAEP", /** @this */ async function() { recorder.skip(undefined, "Local encryption can't be tested on playback"); const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const keyVaultKey = await client.createKey(keyName, "RSA"); @@ -151,7 +151,7 @@ describe("Local cryptography public tests", () => { await testClient.flushKey(keyName); }); - it("wrapKey & unwrapKey RSA1_5", async function() { + it("wrapKey & unwrapKey RSA1_5", /** @this */ async function() { recorder.skip(undefined, "Local encryption can't be tested on playback"); const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const keyVaultKey = await client.createKey(keyName, "RSA"); @@ -168,7 +168,7 @@ describe("Local cryptography public tests", () => { await testClient.flushKey(keyName); }); - it("wrapKey & unwrapKey RSA-OAEP", async function() { + it("wrapKey & unwrapKey RSA-OAEP", /** @this */ async function() { recorder.skip(undefined, "Local encryption can't be tested on playback"); const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const keyVaultKey = await client.createKey(keyName, "RSA"); @@ -190,7 +190,7 @@ describe("Local cryptography public tests", () => { const localSupportedAlgorithmNames = Object.keys(rsaProvider.signatureAlgorithmToHashAlgorithm); for (const localAlgorithmName of localSupportedAlgorithmNames) { - it(localAlgorithmName, async function(): Promise { + it(localAlgorithmName, /** @this */ async function(): Promise { recorder.skip( "browser", `Local sign of algorithm ${localAlgorithmName} is only supported in NodeJS` diff --git a/sdk/keyvault/keyvault-keys/test/public/lro.delete.spec.ts b/sdk/keyvault/keyvault-keys/test/public/lro.delete.spec.ts index 0ed4ab39d9a0..2ad1daa9e276 100644 --- a/sdk/keyvault/keyvault-keys/test/public/lro.delete.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/public/lro.delete.spec.ts @@ -17,7 +17,7 @@ describe("Keys client - Long Running Operations - delete", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(async function() { + beforeEach(/** @this */ async function() { const authentication = await authenticate(this); keySuffix = authentication.keySuffix; client = authentication.client; @@ -31,7 +31,7 @@ describe("Keys client - Long Running Operations - delete", () => { // The tests follow - it("can wait until a key is deleted", async function() { + it("can wait until a key is deleted", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await client.createKey(keyName, "RSA"); const poller = await client.beginDeleteKey(keyName, testPollerProperties); @@ -50,7 +50,7 @@ describe("Keys client - Long Running Operations - delete", () => { await testClient.purgeKey(keyName); }); - it("can resume from a stopped poller", async function() { + it("can resume from a stopped poller", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await client.createKey(keyName, "RSA"); const poller = await client.beginDeleteKey(keyName, testPollerProperties); diff --git a/sdk/keyvault/keyvault-keys/test/public/lro.recoverDelete.spec.ts b/sdk/keyvault/keyvault-keys/test/public/lro.recoverDelete.spec.ts index 315d3d0fa0fe..92c486317827 100644 --- a/sdk/keyvault/keyvault-keys/test/public/lro.recoverDelete.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/public/lro.recoverDelete.spec.ts @@ -18,7 +18,7 @@ describe("Keys client - Long Running Operations - recoverDelete", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(async function() { + beforeEach(/** @this */ async function() { const authentication = await authenticate(this); keySuffix = authentication.keySuffix; client = authentication.client; @@ -32,7 +32,7 @@ describe("Keys client - Long Running Operations - recoverDelete", () => { // The tests follow - it("can wait until a key is recovered", async function() { + it("can wait until a key is recovered", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await client.createKey(keyName, "RSA"); @@ -55,7 +55,7 @@ describe("Keys client - Long Running Operations - recoverDelete", () => { await testClient.flushKey(keyName); }); - it("can resume from a stopped poller", async function() { + it("can resume from a stopped poller", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await client.createKey(keyName, "RSA"); const deletePoller = await client.beginDeleteKey(keyName, testPollerProperties); @@ -92,7 +92,7 @@ describe("Keys client - Long Running Operations - recoverDelete", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can recover a deleted key with requestOptions timeout", async function() { + it("can recover a deleted key with requestOptions timeout", /** @this */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await client.createKey(keyName, "RSA"); diff --git a/sdk/keyvault/keyvault-keys/test/public/recoverBackupRestore.spec.ts b/sdk/keyvault/keyvault-keys/test/public/recoverBackupRestore.spec.ts index 9ad2b2582cff..40c9ba49008b 100644 --- a/sdk/keyvault/keyvault-keys/test/public/recoverBackupRestore.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/public/recoverBackupRestore.spec.ts @@ -17,7 +17,7 @@ describe("Keys client - restore keys and recover backups", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(async function() { + beforeEach(/** @this */ async function() { const authentication = await authenticate(this); keySuffix = authentication.keySuffix; client = authentication.client; @@ -31,7 +31,7 @@ describe("Keys client - restore keys and recover backups", () => { // The tests follow - it("can recover a deleted key", async function() { + it("can recover a deleted key", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await client.createKey(keyName, "RSA"); const deletePoller = await client.beginDeleteKey(keyName, testPollerProperties); @@ -52,7 +52,7 @@ describe("Keys client - restore keys and recover backups", () => { await testClient.flushKey(keyName); }); - it("fails if one tries to recover a non-existing deleted key", async function() { + it("fails if one tries to recover a non-existing deleted key", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); let error; try { @@ -66,7 +66,7 @@ describe("Keys client - restore keys and recover backups", () => { assert.equal(error.statusCode, 404); }); - it("can generate a backup of a key", async function() { + it("can generate a backup of a key", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await client.createKey(keyName, "RSA"); const result = await client.backupKey(keyName); @@ -87,7 +87,7 @@ describe("Keys client - restore keys and recover backups", () => { }); }); - it("fails to generate a backup of a non-existing key", async function() { + it("fails to generate a backup of a non-existing key", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); let error; try { @@ -103,7 +103,7 @@ describe("Keys client - restore keys and recover backups", () => { if (isRecordMode() || isPlaybackMode()) { // This test can't run live, // since the purge operation currently can't be expected to finish anytime soon. - it("can restore a key with a given backup", async function() { + it("can restore a key with a given backup", /** @this */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await client.createKey(keyName, "RSA"); const backup = await client.backupKey(keyName); @@ -126,7 +126,7 @@ describe("Keys client - restore keys and recover backups", () => { } // On playback mode, the tests happen too fast for the timeout to work - it("can restore a key with requestOptions timeout", async function() { + it("can restore a key with requestOptions timeout", /** @this */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await client.createKey(keyName, "RSA"); diff --git a/sdk/keyvault/keyvault-keys/test/utils/lro/restore/operation.ts b/sdk/keyvault/keyvault-keys/test/utils/lro/restore/operation.ts index 1e91f24e96c5..9b22551393af 100644 --- a/sdk/keyvault/keyvault-keys/test/utils/lro/restore/operation.ts +++ b/sdk/keyvault/keyvault-keys/test/utils/lro/restore/operation.ts @@ -53,6 +53,7 @@ export interface RestoreKeyBackupPollOperation /** * Reaches to the service and updates the restore key's poll operation. * @param options - The optional parameters, which are an abortSignal from \@azure/abort-controller and a function that triggers the poller's onProgress function. + * @this */ async function update( this: RestoreKeyBackupPollOperation, @@ -91,6 +92,7 @@ async function cancel(this: RestoreKeyBackupPollOperation): Promise { /** * Serializes the create key's poll operation + * @this */ function toString(this: RestoreKeyBackupPollOperation): string { return JSON.stringify({ diff --git a/sdk/keyvault/keyvault-secrets/.eslintrc.json b/sdk/keyvault/keyvault-secrets/.eslintrc.json index 903cedb0fb82..dda4b269063f 100644 --- a/sdk/keyvault/keyvault-secrets/.eslintrc.json +++ b/sdk/keyvault/keyvault-secrets/.eslintrc.json @@ -4,7 +4,6 @@ "ignorePatterns": ["src/core"], "rules": { "@typescript-eslint/no-this-alias": "off", - "no-invalid-this": "off", "@azure/azure-sdk/ts-package-json-module": "warn", "no-use-before-define": "warn" } diff --git a/sdk/keyvault/keyvault-secrets/test/internal/challengeBasedAuthenticationPolicy.spec.ts b/sdk/keyvault/keyvault-secrets/test/internal/challengeBasedAuthenticationPolicy.spec.ts index 62410d2a7d36..cace21516386 100644 --- a/sdk/keyvault/keyvault-secrets/test/internal/challengeBasedAuthenticationPolicy.spec.ts +++ b/sdk/keyvault/keyvault-secrets/test/internal/challengeBasedAuthenticationPolicy.spec.ts @@ -26,7 +26,7 @@ describe("Challenge based authentication tests", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(async function() { + beforeEach(/** @this */ async function() { const authentication = await authenticate(this); secretSuffix = authentication.secretSuffix; client = authentication.client; @@ -40,7 +40,7 @@ describe("Challenge based authentication tests", () => { // The tests follow - it("Authentication should work for parallel requests", async function() { + it("Authentication should work for parallel requests", /** @this */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -73,7 +73,7 @@ describe("Challenge based authentication tests", () => { sandbox.restore(); }); - it("Once authenticated, new requests should not authenticate again", async function() { + it("Once authenticated, new requests should not authenticate again", /** @this */ async function() { // Our goal is to intercept how our pipelines are storing the challenge. // The first network call should indeed set the challenge in memory. // Subsequent network calls should not set new challenges. diff --git a/sdk/keyvault/keyvault-secrets/test/internal/userAgent.spec.ts b/sdk/keyvault/keyvault-secrets/test/internal/userAgent.spec.ts index a599906cc5c2..6f3788fb2c07 100644 --- a/sdk/keyvault/keyvault-secrets/test/internal/userAgent.spec.ts +++ b/sdk/keyvault/keyvault-secrets/test/internal/userAgent.spec.ts @@ -13,7 +13,7 @@ describe("Secrets client's user agent (only in Node, because of fs)", () => { assert.equal(SDK_VERSION, packageVersion); }); - it("the version should also match with the one available in the package.json (only in Node, because of fs)", async function() { + it("the version should also match with the one available in the package.json (only in Node, because of fs)", /** @this */ async function() { if (!isNode) { this.skip(); return; diff --git a/sdk/keyvault/keyvault-secrets/test/public/CRUD.spec.ts b/sdk/keyvault/keyvault-secrets/test/public/CRUD.spec.ts index ddd9c6ab29eb..e98e47926894 100644 --- a/sdk/keyvault/keyvault-secrets/test/public/CRUD.spec.ts +++ b/sdk/keyvault/keyvault-secrets/test/public/CRUD.spec.ts @@ -19,7 +19,7 @@ describe("Secret client - create, read, update and delete operations", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(async function() { + beforeEach(/** @this */ async function() { const authentication = await authenticate(this); secretSuffix = authentication.secretSuffix; client = authentication.client; @@ -33,7 +33,7 @@ describe("Secret client - create, read, update and delete operations", () => { // The tests follow - it("can add a secret", async function() { + it("can add a secret", /** @this */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -45,7 +45,7 @@ describe("Secret client - create, read, update and delete operations", () => { // If this test is not skipped in the browser's playback, no other test will be played back. // This is a bug related to the browser features of the recorder. - it("can abort adding a secret", async function() { + it("can abort adding a secret", /** @this */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -59,7 +59,7 @@ describe("Secret client - create, read, update and delete operations", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can timeout adding a secret", async function() { + it("can timeout adding a secret", /** @this */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` @@ -89,7 +89,7 @@ describe("Secret client - create, read, update and delete operations", () => { ); }); - it("can set a secret with Empty Value", async function() { + it("can set a secret with Empty Value", /** @this */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -104,7 +104,7 @@ describe("Secret client - create, read, update and delete operations", () => { await testClient.flushSecret(secretName); }); - it("can set a secret with attributes", async function() { + it("can set a secret with attributes", /** @this */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -120,7 +120,7 @@ describe("Secret client - create, read, update and delete operations", () => { await testClient.flushSecret(secretName); }); - it("can update a secret", async function() { + it("can update a secret", /** @this */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -142,7 +142,7 @@ describe("Secret client - create, read, update and delete operations", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can timeout updating a secret", async function() { + it("can timeout updating a secret", /** @this */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` @@ -161,7 +161,7 @@ describe("Secret client - create, read, update and delete operations", () => { }); }); - it("can update a disabled secret", async function() { + it("can update a disabled secret", /** @this */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -182,7 +182,7 @@ describe("Secret client - create, read, update and delete operations", () => { await testClient.flushSecret(secretName); }); - it("can get a secret", async function() { + it("can get a secret", /** @this */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -194,7 +194,7 @@ describe("Secret client - create, read, update and delete operations", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can timeout getting a secret", async function() { + it("can timeout getting a secret", /** @this */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` @@ -209,7 +209,7 @@ describe("Secret client - create, read, update and delete operations", () => { }); }); - it("can't get a disabled secret", async function() { + it("can't get a disabled secret", /** @this */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -234,7 +234,7 @@ describe("Secret client - create, read, update and delete operations", () => { await testClient.flushSecret(secretName); }); - it("can retrieve the latest version of a secret value", async function() { + it("can retrieve the latest version of a secret value", /** @this */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -247,7 +247,7 @@ describe("Secret client - create, read, update and delete operations", () => { await testClient.flushSecret(secretName); }); - it("can get a secret (Non Existing)", async function() { + it("can get a secret (Non Existing)", /** @this */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -262,7 +262,7 @@ describe("Secret client - create, read, update and delete operations", () => { assert.equal(error.statusCode, 404); }); - it("can delete a secret", async function() { + it("can delete a secret", /** @this */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -293,7 +293,7 @@ describe("Secret client - create, read, update and delete operations", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can timeout deleting a secret", async function() { + it("can timeout deleting a secret", /** @this */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` @@ -309,7 +309,7 @@ describe("Secret client - create, read, update and delete operations", () => { }); }); - it("can delete a secret (Non Existing)", async function() { + it("can delete a secret (Non Existing)", /** @this */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -324,7 +324,7 @@ describe("Secret client - create, read, update and delete operations", () => { assert.equal(error.statusCode, 404); }); - it("can get a deleted secret", async function() { + it("can get a deleted secret", /** @this */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -351,7 +351,7 @@ describe("Secret client - create, read, update and delete operations", () => { await testClient.purgeSecret(secretName); }); - it("can get a deleted secret (Non Existing)", async function() { + it("can get a deleted secret (Non Existing)", /** @this */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); diff --git a/sdk/keyvault/keyvault-secrets/test/public/list.spec.ts b/sdk/keyvault/keyvault-secrets/test/public/list.spec.ts index 20a6ccb4ed8e..7340287e4b5a 100644 --- a/sdk/keyvault/keyvault-secrets/test/public/list.spec.ts +++ b/sdk/keyvault/keyvault-secrets/test/public/list.spec.ts @@ -21,7 +21,7 @@ describe("Secret client - list secrets in various ways", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(async function() { + beforeEach(/** @this */ async function() { const authentication = await authenticate(this); secretSuffix = authentication.secretSuffix; client = authentication.client; @@ -38,7 +38,7 @@ describe("Secret client - list secrets in various ways", () => { // Use this while recording to make sure the target keyvault is clean. // The next tests will produce a more consistent output. // This test is only useful while developing locally. - it("can purge all secrets", async function(): Promise { + it("can purge all secrets", /** @this */ async function(): Promise { // WARNING: When TEST_MODE equals "record", all of the secrets in the indicated KEYVAULT_URI will be deleted as part of this test. if (!isRecordMode()) { return this.skip(); @@ -59,7 +59,7 @@ describe("Secret client - list secrets in various ways", () => { } }); - it("can list secret properties", async function() { + it("can list secret properties", /** @this */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -83,7 +83,7 @@ describe("Secret client - list secrets in various ways", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can get secret properties with requestOptions timeout", async function() { + it("can get secret properties with requestOptions timeout", /** @this */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const iter = client.listPropertiesOfSecrets({ requestOptions: { timeout: 1 } @@ -93,7 +93,7 @@ describe("Secret client - list secrets in various ways", () => { }); }); - it("can list deleted secrets", async function() { + it("can list deleted secrets", /** @this */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -132,7 +132,7 @@ describe("Secret client - list secrets in various ways", () => { }); }); - it("can retrieve all versions of a secret", async function() { + it("can retrieve all versions of a secret", /** @this */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` @@ -175,7 +175,7 @@ describe("Secret client - list secrets in various ways", () => { }); }); - it("can list secret versions (non existing)", async function() { + it("can list secret versions (non existing)", /** @this */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -191,7 +191,7 @@ describe("Secret client - list secrets in various ways", () => { assert.equal(totalVersions, 0, `Unexpected total versions for secret ${secretName}`); }); - it("can list secrets by page", async function() { + it("can list secrets by page", /** @this */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -213,7 +213,7 @@ describe("Secret client - list secrets in various ways", () => { } }); - it("can list deleted secrets by page", async function() { + it("can list deleted secrets by page", /** @this */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -240,7 +240,7 @@ describe("Secret client - list secrets in various ways", () => { } }); - it("can retrieve all versions of a secret by page", async function() { + it("can retrieve all versions of a secret by page", /** @this */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -273,7 +273,7 @@ describe("Secret client - list secrets in various ways", () => { await testClient.flushSecret(secretName); }); - it("can list secret versions by page (non existing)", async function() { + it("can list secret versions by page (non existing)", /** @this */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); diff --git a/sdk/keyvault/keyvault-secrets/test/public/lro.delete.spec.ts b/sdk/keyvault/keyvault-secrets/test/public/lro.delete.spec.ts index dd1aa09114e0..efb438535b22 100644 --- a/sdk/keyvault/keyvault-secrets/test/public/lro.delete.spec.ts +++ b/sdk/keyvault/keyvault-secrets/test/public/lro.delete.spec.ts @@ -18,7 +18,7 @@ describe("Secrets client - Long Running Operations - delete", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(async function() { + beforeEach(/** @this */ async function() { const authentication = await authenticate(this); secretSuffix = authentication.secretSuffix; client = authentication.client; @@ -32,7 +32,7 @@ describe("Secrets client - Long Running Operations - delete", () => { // The tests follow - it("can wait until a secret is deleted", async function() { + it("can wait until a secret is deleted", /** @this */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -53,7 +53,7 @@ describe("Secrets client - Long Running Operations - delete", () => { await testClient.purgeSecret(secretName); }); - it("can resume from a stopped poller", async function() { + it("can resume from a stopped poller", /** @this */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -87,7 +87,7 @@ describe("Secrets client - Long Running Operations - delete", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can attempt to delete a secret with requestOptions timeout", async function() { + it("can attempt to delete a secret with requestOptions timeout", /** @this */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` diff --git a/sdk/keyvault/keyvault-secrets/test/public/lro.recover.spec.ts b/sdk/keyvault/keyvault-secrets/test/public/lro.recover.spec.ts index 87d222faa074..8ea8bbb7ba43 100644 --- a/sdk/keyvault/keyvault-secrets/test/public/lro.recover.spec.ts +++ b/sdk/keyvault/keyvault-secrets/test/public/lro.recover.spec.ts @@ -18,7 +18,7 @@ describe("Secrets client - Long Running Operations - recoverDelete", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(async function() { + beforeEach(/** @this */ async function() { const authentication = await authenticate(this); secretSuffix = authentication.secretSuffix; client = authentication.client; @@ -32,7 +32,7 @@ describe("Secrets client - Long Running Operations - recoverDelete", () => { // The tests follow - it("can wait until a secret is recovered", async function() { + it("can wait until a secret is recovered", /** @this */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -57,7 +57,7 @@ describe("Secrets client - Long Running Operations - recoverDelete", () => { await testClient.flushSecret(secretName); }); - it("can resume from a stopped poller", async function() { + it("can resume from a stopped poller", /** @this */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -96,7 +96,7 @@ describe("Secrets client - Long Running Operations - recoverDelete", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can attempt to recover a deleted secret with requestOptions timeout", async function() { + it("can attempt to recover a deleted secret with requestOptions timeout", /** @this */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` diff --git a/sdk/keyvault/keyvault-secrets/test/public/recoverBackupRestore.spec.ts b/sdk/keyvault/keyvault-secrets/test/public/recoverBackupRestore.spec.ts index 9287c6766db7..38fb09f254d0 100644 --- a/sdk/keyvault/keyvault-secrets/test/public/recoverBackupRestore.spec.ts +++ b/sdk/keyvault/keyvault-secrets/test/public/recoverBackupRestore.spec.ts @@ -18,7 +18,7 @@ describe("Secret client - restore secrets and recover backups", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(async function() { + beforeEach(/** @this */ async function() { const authentication = await authenticate(this); secretSuffix = authentication.secretSuffix; client = authentication.client; @@ -32,7 +32,7 @@ describe("Secret client - restore secrets and recover backups", () => { // The tests follow - it("can recover a deleted secret", async function() { + it("can recover a deleted secret", /** @this */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -62,7 +62,7 @@ describe("Secret client - restore secrets and recover backups", () => { await testClient.flushSecret(secretName); }); - it("can recover a deleted secret (non existing)", async function() { + it("can recover a deleted secret (non existing)", /** @this */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -83,7 +83,7 @@ describe("Secret client - restore secrets and recover backups", () => { if (isNode && !isPlaybackMode()) { // On playback mode, the tests happen too fast for the timeout to work - it("can recover a deleted a secret with requestOptions timeout", async function() { + it("can recover a deleted a secret with requestOptions timeout", /** @this */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -101,7 +101,7 @@ describe("Secret client - restore secrets and recover backups", () => { }); } - it("can backup a secret", async function() { + it("can backup a secret", /** @this */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -119,7 +119,7 @@ describe("Secret client - restore secrets and recover backups", () => { await testClient.flushSecret(secretName); }); - it("can backup a secret (non existing)", async function() { + it("can backup a secret (non existing)", /** @this */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -137,7 +137,7 @@ describe("Secret client - restore secrets and recover backups", () => { if (isRecordMode() || isPlaybackMode()) { // This test can't run live, // since the purge operation currently can't be expected to finish anytime soon. - it("can restore a secret", async function() { + it("can restore a secret", /** @this */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -182,7 +182,7 @@ describe("Secret client - restore secrets and recover backups", () => { if (isNode && !isPlaybackMode()) { // On playback mode, the tests happen too fast for the timeout to work - it("can timeout deleting a secret", async function() { + it("can timeout deleting a secret", /** @this */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); diff --git a/sdk/keyvault/keyvault-secrets/test/utils/lro/restore/operation.ts b/sdk/keyvault/keyvault-secrets/test/utils/lro/restore/operation.ts index 4d141cbdf33b..cfef7d26394c 100644 --- a/sdk/keyvault/keyvault-secrets/test/utils/lro/restore/operation.ts +++ b/sdk/keyvault/keyvault-secrets/test/utils/lro/restore/operation.ts @@ -54,6 +54,7 @@ export interface RestoreSecretBackupPollOperation /** * Reaches to the service and updates the restore secret's poll operation. * @param options - The optional parameters, which are an abortSignal from \@azure/abort-controller and a function that triggers the poller's onProgress function. + * @this */ async function update( this: RestoreSecretBackupPollOperation, @@ -92,6 +93,7 @@ async function cancel(this: RestoreSecretBackupPollOperation): Promise { /** * Serializes the create secret's poll operation + * @this */ function toString(this: RestoreSecretBackupPollOperation): string { return JSON.stringify({ diff --git a/sdk/metricsadvisor/ai-metrics-advisor/test/public/adminclient.spec.ts b/sdk/metricsadvisor/ai-metrics-advisor/test/public/adminclient.spec.ts index e74e9c1a994d..bdcb0b653221 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/test/public/adminclient.spec.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/test/public/adminclient.spec.ts @@ -19,8 +19,7 @@ matrix([[true, false]] as const, async (useAad) => { let client: MetricsAdvisorAdministrationClient; let recorder: Recorder; - beforeEach(function() { - // eslint-disable-next-line no-invalid-this + beforeEach(/** @this*/ function() { ({ recorder, client } = createRecordedAdminClient(this, makeCredential(useAad))); }); @@ -78,7 +77,7 @@ matrix([[true, false]] as const, async (useAad) => { assert.ok(result.latestActiveTimestamp, "Expecting valid latest active timestamp"); }); - it("refreshes ingesetion status", async function() { + it("refreshes ingesetion status", /** @this*/ async function() { const iterator = client.listDataFeedIngestionStatus( testEnv.METRICS_ADVISOR_AZURE_SQLSERVER_DATAFEED_ID, new Date(Date.UTC(2020, 7, 22)), @@ -101,7 +100,6 @@ matrix([[true, false]] as const, async (useAad) => { const result2 = await iterator2.next(); assert.notEqual(result2.value.status, "Succeeded"); } else { - // eslint-disable-next-line no-invalid-this this.skip(); } }); @@ -368,9 +366,8 @@ matrix([[true, false]] as const, async (useAad) => { } }); - it("deletes an alert configuration", async function() { + it("deletes an alert configuration", /** @this*/ async function() { if (!createdAlertConfigId) { - // eslint-disable-next-line no-invalid-this this.skip(); } @@ -383,9 +380,8 @@ matrix([[true, false]] as const, async (useAad) => { } }); - it("deletes a detection configuration", async function() { + it("deletes a detection configuration", /** @this*/ async function() { if (!createdDetectionConfigId) { - // eslint-disable-next-line no-invalid-this this.skip(); } diff --git a/sdk/metricsadvisor/ai-metrics-advisor/test/public/advisorclient.spec.ts b/sdk/metricsadvisor/ai-metrics-advisor/test/public/advisorclient.spec.ts index 46c7a41c49f8..a015332780f6 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/test/public/advisorclient.spec.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/test/public/advisorclient.spec.ts @@ -20,8 +20,7 @@ matrix([[true, false]] as const, async (useAad) => { let client: MetricsAdvisorClient; let recorder: Recorder; - beforeEach(function() { - // eslint-disable-next-line no-invalid-this + beforeEach(/** @this*/ function() { ({ recorder, client } = createRecordedAdvisorClient(this, makeCredential(useAad))); }); diff --git a/sdk/metricsadvisor/ai-metrics-advisor/test/public/datafeed.spec.ts b/sdk/metricsadvisor/ai-metrics-advisor/test/public/datafeed.spec.ts index 7fc3b4a41450..be98e9d29be2 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/test/public/datafeed.spec.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/test/public/datafeed.spec.ts @@ -18,6 +18,7 @@ import { import { createRecordedAdminClient, testEnv, makeCredential } from "./util/recordedClients"; import { Recorder } from "@azure/test-utils-recorder"; import { matrix } from "./util/matrix"; +import { Context } from "mocha"; matrix([[true, false]] as const, async (useAad) => { describe(`[${useAad ? "AAD" : "API Key"}]`, () => { @@ -36,8 +37,7 @@ matrix([[true, false]] as const, async (useAad) => { let mySqlFeedName: string; let postgreSqlFeedName: string; - beforeEach(function() { - // eslint-disable-next-line no-invalid-this + beforeEach(/** @this*/ function() { ({ recorder, client } = createRecordedAdminClient(this, makeCredential(useAad))); if (recorder && !feedName) { feedName = recorder.getUniqueName("js-test-datafeed-"); @@ -233,7 +233,7 @@ matrix([[true, false]] as const, async (useAad) => { } }); - it("retrieves an Azure Blob datafeed", async function() { + it("retrieves an Azure Blob datafeed", /** @this*/ async function() { // accessing environment variables here so they are already replaced by test env ones const expectedSource: DataFeedSource = { dataSourceType: "AzureBlob", @@ -245,7 +245,6 @@ matrix([[true, false]] as const, async (useAad) => { }; if (!createdAzureBlobDataFeedId) { - // eslint-disable-next-line no-invalid-this this.skip(); } @@ -273,9 +272,8 @@ matrix([[true, false]] as const, async (useAad) => { ); }); - it("updates an Azure Blob datafeed", async function() { + it("updates an Azure Blob datafeed", /** @this*/ async function() { if (!createdAzureBlobDataFeedId) { - // eslint-disable-next-line no-invalid-this this.skip(); } const expectedSourceParameter = { @@ -338,7 +336,7 @@ matrix([[true, false]] as const, async (useAad) => { applicationId: testEnv.METRICS_ADVISOR_AZURE_APPINSIGHTS_APPLICATION_ID, apiKey: testEnv.METRICS_ADVISOR_AZURE_APPINSIGHTS_API_KEY, query: - "let gran=60m; let starttime=datetime(@StartTime); let endtime=starttime + gran; requests | where timestamp >= starttime and timestamp < endtime | summarize request_count = count(), duration_avg_ms = avg(duration), duration_95th_ms = percentile(duration, 95), duration_max_ms = max(duration) by resultCode" + "let gran=60m; let starttime=datetime(@StartTime); let endtime=starttime + gran; requests | where timestamp >= starttime and timestamp < endtime | summarize request_count = count(), duration_avg_ms = avg(duration), duration_95th_ms = percentile(duration, 95), duration_max_ms = max(duration) by resultCode" } }; const actual = await client.createDataFeed({ @@ -365,7 +363,7 @@ matrix([[true, false]] as const, async (useAad) => { ); assert.equal( actual.source.dataSourceParameter.query, - "let gran=60m; let starttime=datetime(@StartTime); let endtime=starttime + gran; requests | where timestamp >= starttime and timestamp < endtime | summarize request_count = count(), duration_avg_ms = avg(duration), duration_95th_ms = percentile(duration, 95), duration_max_ms = max(duration) by resultCode" + "let gran=60m; let starttime=datetime(@StartTime); let endtime=starttime + gran; requests | where timestamp >= starttime and timestamp < endtime | summarize request_count = count(), duration_avg_ms = avg(duration), duration_95th_ms = percentile(duration, 95), duration_max_ms = max(duration) by resultCode" ); } }); @@ -808,15 +806,14 @@ matrix([[true, false]] as const, async (useAad) => { }); }); -// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types +/** @this*/ export async function verifyDataFeedDeletion( // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types - this: any, + this: Context, client: MetricsAdvisorAdministrationClient, createdDataFeedId: string ): Promise { if (!createdDataFeedId) { - // eslint-disable-next-line no-invalid-this this.skip(); } diff --git a/sdk/metricsadvisor/ai-metrics-advisor/test/public/hookTests.spec.ts b/sdk/metricsadvisor/ai-metrics-advisor/test/public/hookTests.spec.ts index 4510ea7c79db..de46cd4236d2 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/test/public/hookTests.spec.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/test/public/hookTests.spec.ts @@ -24,8 +24,7 @@ matrix([[true, false]] as const, async (useAad) => { let emailHookName: string; let webHookName: string; - beforeEach(function() { - // eslint-disable-next-line no-invalid-this + beforeEach(/** @this*/ function() { ({ recorder, client } = createRecordedAdminClient(this, makeCredential(useAad))); if (recorder && !emailHookName) { emailHookName = recorder.getUniqueName("js-test-emailHook-"); diff --git a/sdk/mixedreality/mixedreality-authentication/test/mixedRealityStsClient.spec.ts b/sdk/mixedreality/mixedreality-authentication/test/mixedRealityStsClient.spec.ts index 95109bd50f24..534b95a573e4 100644 --- a/sdk/mixedreality/mixedreality-authentication/test/mixedRealityStsClient.spec.ts +++ b/sdk/mixedreality/mixedreality-authentication/test/mixedRealityStsClient.spec.ts @@ -77,8 +77,7 @@ describe("[AccountKey] MixedRealityStsClient functional tests", function() { let client: MixedRealityStsClient; let recorder: Recorder; - beforeEach(function() { - // eslint-disable-next-line no-invalid-this + beforeEach(/** @this*/ function() { recorder = createRecorder(this); client = createClient(); }); diff --git a/sdk/schemaregistry/schema-registry/test/schemaRegistry.spec.ts b/sdk/schemaregistry/schema-registry/test/schemaRegistry.spec.ts index 84e5659e4124..872fe8ac8e51 100644 --- a/sdk/schemaregistry/schema-registry/test/schemaRegistry.spec.ts +++ b/sdk/schemaregistry/schema-registry/test/schemaRegistry.spec.ts @@ -62,8 +62,7 @@ describe("SchemaRegistryClient", function() { let recorder: Recorder; let client: SchemaRegistryClient; - beforeEach(function() { - // eslint-disable-next-line no-invalid-this + beforeEach(/** @this*/ function() { ({ client, recorder } = createRecordedClient(this)); }); diff --git a/sdk/schemaregistry/schema-registry/tsdoc.json b/sdk/schemaregistry/schema-registry/tsdoc.json new file mode 100644 index 000000000000..81c5a8a2aa2f --- /dev/null +++ b/sdk/schemaregistry/schema-registry/tsdoc.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json", + "extends": ["../../../tsdoc.json"] +} diff --git a/sdk/search/search-documents/test/public/node/searchClient.spec.ts b/sdk/search/search-documents/test/public/node/searchClient.spec.ts index 118a6abd2feb..42e9cb48a182 100644 --- a/sdk/search/search-documents/test/public/node/searchClient.spec.ts +++ b/sdk/search/search-documents/test/public/node/searchClient.spec.ts @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -/* eslint-disable no-invalid-this */ - import { assert } from "chai"; import { Recorder, record, isPlaybackMode, isLiveMode } from "@azure/test-utils-recorder"; @@ -20,14 +18,14 @@ import { delay } from "@azure/core-http"; const TEST_INDEX_NAME = isLiveMode() ? createRandomIndexName() : "hotel-live-test1"; -describe("SearchClient", function() { +describe("SearchClient", /** @this*/ function() { let recorder: Recorder; let searchClient: SearchClient; let indexClient: SearchIndexClient; this.timeout(99999); - beforeEach(async function() { + beforeEach(/** @this*/ async function() { ({ searchClient, indexClient } = createClients(TEST_INDEX_NAME)); if (!isPlaybackMode()) { await createIndex(indexClient, TEST_INDEX_NAME); diff --git a/sdk/search/search-documents/test/public/node/searchIndexClient.spec.ts b/sdk/search/search-documents/test/public/node/searchIndexClient.spec.ts index 9ce9b62bc7a2..5566a30d53b1 100644 --- a/sdk/search/search-documents/test/public/node/searchIndexClient.spec.ts +++ b/sdk/search/search-documents/test/public/node/searchIndexClient.spec.ts @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -/* eslint-disable no-invalid-this */ import { isPlaybackMode, record, Recorder, isLiveMode } from "@azure/test-utils-recorder"; import { assert } from "chai"; import { SearchIndexClient, SynonymMap, SearchIndex } from "../../../src"; @@ -18,13 +17,13 @@ import { delay } from "@azure/core-http"; const TEST_INDEX_NAME = isLiveMode() ? createRandomIndexName() : "hotel-live-test3"; -describe("SearchIndexClient", function() { +describe("SearchIndexClient", /** @this */ function() { let recorder: Recorder; let indexClient: SearchIndexClient; this.timeout(99999); - beforeEach(async function() { + beforeEach(/** @this */ async function() { ({ indexClient } = createClients(TEST_INDEX_NAME)); if (!isPlaybackMode()) { await createSynonymMaps(indexClient); diff --git a/sdk/search/search-documents/test/public/node/searchIndexerClient.spec.ts b/sdk/search/search-documents/test/public/node/searchIndexerClient.spec.ts index 5f1bdd35c631..eed1d363076f 100644 --- a/sdk/search/search-documents/test/public/node/searchIndexerClient.spec.ts +++ b/sdk/search/search-documents/test/public/node/searchIndexerClient.spec.ts @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -/* eslint-disable no-invalid-this */ import { isPlaybackMode, record, Recorder, isLiveMode } from "@azure/test-utils-recorder"; import { assert } from "chai"; import { @@ -28,14 +27,14 @@ import { delay } from "@azure/core-http"; const TEST_INDEX_NAME = isLiveMode() ? createRandomIndexName() : "hotel-live-test2"; -describe("SearchIndexerClient", function() { +describe("SearchIndexerClient", /** @this */ function() { let recorder: Recorder; let indexerClient: SearchIndexerClient; let indexClient: SearchIndexClient; this.timeout(99999); - beforeEach(async function() { + beforeEach(/** @this */ async function() { ({ indexClient, indexerClient } = createClients(TEST_INDEX_NAME)); if (!isPlaybackMode()) { await createDataSourceConnections(indexerClient); diff --git a/sdk/tables/data-tables/test/integration/batch.spec.ts b/sdk/tables/data-tables/test/integration/batch.spec.ts index ffc9f094455e..7eeb54686550 100644 --- a/sdk/tables/data-tables/test/integration/batch.spec.ts +++ b/sdk/tables/data-tables/test/integration/batch.spec.ts @@ -26,9 +26,8 @@ describe("batch operations", () => { // which wouldn't match the recorded one. Fallingback to SAS for recorded tests. const authMode = !isNode || !isLiveMode() ? "SASConnectionString" : "AccountConnectionString"; - beforeEach(async function() { + beforeEach(/** @this*/ async function() { sinon.stub(Uuid, "generateUuid").returns("fakeId"); - // eslint-disable-next-line no-invalid-this recorder = record(this, recordedEnvironmentSetup); client = createTableClient(tableName, authMode); diff --git a/sdk/tables/data-tables/test/integration/tableclient.spec.ts b/sdk/tables/data-tables/test/integration/tableclient.spec.ts index e7ecb80f7647..6a974fc10a9a 100644 --- a/sdk/tables/data-tables/test/integration/tableclient.spec.ts +++ b/sdk/tables/data-tables/test/integration/tableclient.spec.ts @@ -18,8 +18,7 @@ describe("TableClient", () => { // which wouldn't match the recorded one. Fallingback to SAS for recorded tests. const authMode = !isNode || !isLiveMode() ? "SASConnectionString" : "AccountConnectionString"; - beforeEach(function() { - // eslint-disable-next-line no-invalid-this + beforeEach(/** @this*/ function() { recorder = record(this, recordedEnvironmentSetup); client = createTableClient(tableName, authMode); @@ -44,9 +43,8 @@ describe("TableClient", () => { describe("listEntities", () => { // Create required entities for testing list operations - before(async function() { + before(/** @this*/ async function() { if (!isPlaybackMode()) { - // eslint-disable-next-line no-invalid-this this.timeout(10000); await client.createEntity({ partitionKey: listPartitionKey, diff --git a/sdk/tables/data-tables/test/integration/tableserviceclient.spec.ts b/sdk/tables/data-tables/test/integration/tableserviceclient.spec.ts index cad2288b90a7..1440cf891fff 100644 --- a/sdk/tables/data-tables/test/integration/tableserviceclient.spec.ts +++ b/sdk/tables/data-tables/test/integration/tableserviceclient.spec.ts @@ -14,8 +14,7 @@ describe("TableServiceClient", () => { const suffix = isNode ? "node" : "browser"; const authMode = !isNode || !isLiveMode() ? "SASConnectionString" : "AccountConnectionString"; - beforeEach(function() { - // eslint-disable-next-line no-invalid-this + beforeEach(/** @this*/ function() { recorder = record(this, recordedEnvironmentSetup); client = createTableServiceClient(authMode); }); @@ -50,10 +49,9 @@ describe("TableServiceClient", () => { describe("listTables", () => { const tableNames: string[] = []; const expectedTotalItems = 20; - before(async function() { + before(/** @this*/ async function() { // Create tables to be listed if (!isPlaybackMode()) { - // eslint-disable-next-line no-invalid-this this.timeout(10000); for (let i = 0; i < 20; i++) { const tableName = `ListTableTest${suffix}${i}`; @@ -63,10 +61,9 @@ describe("TableServiceClient", () => { } }); - after(async function() { + after(/** @this*/ async function() { // Cleanup tables if (!isPlaybackMode()) { - // eslint-disable-next-line no-invalid-this this.timeout(10000); try { for (const table of tableNames) { diff --git a/sdk/tables/data-tables/test/unit/sharedKeyCredential.spec.ts b/sdk/tables/data-tables/test/unit/sharedKeyCredential.spec.ts index 7b5a13fc5764..f050ff1796c1 100644 --- a/sdk/tables/data-tables/test/unit/sharedKeyCredential.spec.ts +++ b/sdk/tables/data-tables/test/unit/sharedKeyCredential.spec.ts @@ -25,10 +25,9 @@ describe("TablesSharedKeyCredential", () => { Date.prototype.toUTCString = originalToUTCString; }); - it("It should sign", async function() { + it("It should sign", /** @this*/ async function() { if (!isNode) { // TablesSharedKeyCredential auth is not supported in Browser - // eslint-disable-next-line no-invalid-this this.skip(); } const url = diff --git a/sdk/tables/data-tables/test/unit/utils.spec.ts b/sdk/tables/data-tables/test/unit/utils.spec.ts index d5c6815a6c98..4174173cfedb 100644 --- a/sdk/tables/data-tables/test/unit/utils.spec.ts +++ b/sdk/tables/data-tables/test/unit/utils.spec.ts @@ -10,10 +10,9 @@ import { ConnectionString } from "../../src/utils/internalModels"; describe("Utility Helpers", () => { describe("extractConnectionStringParts", () => { describe("Account Connection String", () => { - beforeEach(function() { + beforeEach(/** @this*/ function() { if (!isNode) { // Account connection string is not supported for Browsers - // eslint-disable-next-line no-invalid-this this.skip(); } }); diff --git a/sdk/template/template/test/public/configurationClient.spec.ts b/sdk/template/template/test/public/configurationClient.spec.ts index e56752424e2a..33d8509ce163 100644 --- a/sdk/template/template/test/public/configurationClient.spec.ts +++ b/sdk/template/template/test/public/configurationClient.spec.ts @@ -52,11 +52,10 @@ describe("[AAD] ConfigurationClient functional tests", function() { // NOTE: use of "function" and not ES6 arrow-style functions with the // beforeEach hook is IMPORTANT due to the use of `this` in the function // body. - beforeEach(function(this: Context) { + beforeEach(/** @this*/ function(this: Context) { // The recorder has some convenience methods, and we need to store a // reference to it so that we can `stop()` the recorder later in the // `afterEach` hook. - // eslint-disable-next-line no-invalid-this recorder = record(this, { // == Recorder Environment Setup == Add the replaceable variables from // above diff --git a/sdk/template/template/tsdoc.json b/sdk/template/template/tsdoc.json new file mode 100644 index 000000000000..81c5a8a2aa2f --- /dev/null +++ b/sdk/template/template/tsdoc.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json", + "extends": ["../../../tsdoc.json"] +} diff --git a/sdk/textanalytics/ai-text-analytics/test/public/apiKey.spec.ts b/sdk/textanalytics/ai-text-analytics/test/public/apiKey.spec.ts index ab81543e8405..872c2054c7f1 100644 --- a/sdk/textanalytics/ai-text-analytics/test/public/apiKey.spec.ts +++ b/sdk/textanalytics/ai-text-analytics/test/public/apiKey.spec.ts @@ -19,15 +19,13 @@ const testDataEn = [ "I didn't like the last book I read at all." ]; -describe("[API Key] TextAnalyticsClient", function() { +describe("[API Key] TextAnalyticsClient", /** @this*/ function() { let recorder: Recorder; let client: TextAnalyticsClient; - // eslint-disable-next-line no-invalid-this const CLITimeout = this.timeout(); const fastTimeout = 10000; - beforeEach(function() { - // eslint-disable-next-line no-invalid-this + beforeEach(/** @this*/ function() { recorder = createRecorder(this); client = createClient("APIKey"); }); @@ -37,8 +35,7 @@ describe("[API Key] TextAnalyticsClient", function() { }); describe("fast tests", function() { - before(function() { - // eslint-disable-next-line no-invalid-this + before(/** @this */ function() { this.timeout(fastTimeout); }); @@ -88,8 +85,7 @@ describe("[API Key] TextAnalyticsClient", function() { describe("LROs", function() { const pollingInterval = isPlaybackMode() ? 0 : 2000; - before(function() { - // eslint-disable-next-line no-invalid-this + before(/** @this*/ function() { this.timeout(isPlaybackMode() ? fastTimeout : CLITimeout); }); diff --git a/sdk/textanalytics/ai-text-analytics/test/public/textAnalyticsClient.spec.ts b/sdk/textanalytics/ai-text-analytics/test/public/textAnalyticsClient.spec.ts index 4835f67238a8..fc158f4432e8 100644 --- a/sdk/textanalytics/ai-text-analytics/test/public/textAnalyticsClient.spec.ts +++ b/sdk/textanalytics/ai-text-analytics/test/public/textAnalyticsClient.spec.ts @@ -35,17 +35,15 @@ const testDataEs = [ "Los caminos que llevan hasta Monte Rainier son espectaculares y hermosos.", "La carretera estaba atascada. Había mucho tráfico el día de ayer." ]; -describe("[AAD] TextAnalyticsClient", function() { +describe("[AAD] TextAnalyticsClient", /** @this */ function() { let recorder: Recorder; let client: TextAnalyticsClient; - // eslint-disable-next-line no-invalid-this const CLITimeout = this.timeout(); const fastTimeout = 10000; let getId: () => string; - beforeEach(function() { - // eslint-disable-next-line no-invalid-this + beforeEach(/** @this */ function() { recorder = createRecorder(this); client = createClient("AAD"); let nextId = 0; @@ -60,8 +58,7 @@ describe("[AAD] TextAnalyticsClient", function() { }); describe("fast tests", function() { - before(function() { - // eslint-disable-next-line no-invalid-this + before(/** @this */ function() { this.timeout(fastTimeout); }); @@ -929,8 +926,7 @@ describe("[AAD] TextAnalyticsClient", function() { describe("LROs", function() { const pollingInterval = isPlaybackMode() ? 0 : 2000; - before(function() { - // eslint-disable-next-line no-invalid-this + before(/** @this*/ function() { this.timeout(isPlaybackMode() ? fastTimeout : CLITimeout); }); diff --git a/tsdoc.json b/tsdoc.json index 6e1223d4e138..9c1bbccb2518 100644 --- a/tsdoc.json +++ b/tsdoc.json @@ -4,6 +4,10 @@ { "tagName": "@hidden", "syntaxKind": "modifier" + }, + { + "tagName": "@this", + "syntaxKind": "modifier" } ] } From e80357d0e5f4d1c8beb0d004e84515e88cc22572 Mon Sep 17 00:00:00 2001 From: deyaaeldeen Date: Mon, 22 Mar 2021 18:44:05 +0000 Subject: [PATCH 2/9] Fix compilation issue --- .../ai-metrics-advisor/test/public/datafeed.spec.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sdk/metricsadvisor/ai-metrics-advisor/test/public/datafeed.spec.ts b/sdk/metricsadvisor/ai-metrics-advisor/test/public/datafeed.spec.ts index be98e9d29be2..55f6ba5de591 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/test/public/datafeed.spec.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/test/public/datafeed.spec.ts @@ -18,7 +18,6 @@ import { import { createRecordedAdminClient, testEnv, makeCredential } from "./util/recordedClients"; import { Recorder } from "@azure/test-utils-recorder"; import { matrix } from "./util/matrix"; -import { Context } from "mocha"; matrix([[true, false]] as const, async (useAad) => { describe(`[${useAad ? "AAD" : "API Key"}]`, () => { @@ -806,10 +805,13 @@ matrix([[true, false]] as const, async (useAad) => { }); }); -/** @this*/ +/** + * @this + * eslint-disable-next-line \@typescript-eslint/explicit-module-boundary-types + */ export async function verifyDataFeedDeletion( // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types - this: Context, + this: any, client: MetricsAdvisorAdministrationClient, createdDataFeedId: string ): Promise { From 6b7b73e3de33dccc725b649ada59fb0b1d61b440 Mon Sep 17 00:00:00 2001 From: deyaaeldeen Date: Mon, 22 Mar 2021 18:47:13 +0000 Subject: [PATCH 3/9] update comments --- .../test/anomalydetector.spec.ts | 2 +- .../test/public/attestationTests.spec.ts | 2 +- .../test/public/policyGetSetTests.spec.ts | 2 +- .../public/policyManagementGetSetTests.spec.ts | 2 +- .../attestation/test/public/tokenCertTests.spec.ts | 2 +- .../test/public/containerRegistryClient.spec.ts | 2 +- sdk/core/core-http/test/defaultHttpClientTests.ts | 2 +- sdk/core/core-lro/test/utils/testOperation.ts | 6 +++--- sdk/core/logger/src/debug.ts | 4 ++-- sdk/cosmosdb/cosmos/test/internal/session.spec.ts | 4 ++-- .../cosmos/test/internal/unit/auth.spec.ts | 2 +- .../test/public/functional/authorization.spec.ts | 2 +- .../cosmos/test/public/functional/client.spec.ts | 2 +- .../cosmos/test/public/functional/conflict.spec.ts | 2 +- .../test/public/functional/container.spec.ts | 2 +- .../cosmos/test/public/functional/database.spec.ts | 2 +- .../test/public/functional/databaseaccount.spec.ts | 4 ++-- .../cosmos/test/public/functional/item.spec.ts | 2 +- .../cosmos/test/public/functional/offer.spec.ts | 4 ++-- .../test/public/functional/permission.spec.ts | 2 +- .../cosmos/test/public/functional/query.spec.ts | 6 +++--- .../cosmos/test/public/functional/spatial.spec.ts | 2 +- .../cosmos/test/public/functional/sproc.spec.ts | 6 +++--- .../cosmos/test/public/functional/trigger.spec.ts | 2 +- .../cosmos/test/public/functional/ttl.spec.ts | 2 +- .../cosmos/test/public/functional/udf.spec.ts | 2 +- .../cosmos/test/public/functional/user.spec.ts | 2 +- .../test/public/integration/aggregateQuery.spec.ts | 2 +- .../test/public/integration/authorization.spec.ts | 2 +- .../test/public/integration/changeFeed.spec.ts | 2 +- .../test/public/integration/crossPartition.spec.ts | 2 +- .../test/public/integration/encoding.spec.ts | 2 +- .../test/public/integration/multiregion.spec.ts | 2 +- .../cosmos/test/public/integration/proxy.spec.ts | 2 +- .../cosmos/test/public/integration/query.spec.ts | 6 +++--- .../eventgrid/test/eventGridClient.spec.ts | 14 +++++++------- .../public/browser/formrecognizerclient.spec.ts | 2 +- .../test/public/formtrainingclient.spec.ts | 2 +- .../test/public/node/formrecognizerclient.spec.ts | 2 +- .../identity/test/internal/identityClient.spec.ts | 2 +- .../test/public/adminclient.spec.ts | 8 ++++---- .../test/public/advisorclient.spec.ts | 2 +- .../test/public/datafeed.spec.ts | 6 +++--- .../test/public/hookTests.spec.ts | 2 +- .../test/mixedRealityStsClient.spec.ts | 2 +- .../schema-registry/test/schemaRegistry.spec.ts | 2 +- .../test/public/node/searchClient.spec.ts | 4 ++-- .../data-tables/test/integration/batch.spec.ts | 2 +- .../test/integration/tableclient.spec.ts | 4 ++-- .../test/integration/tableserviceclient.spec.ts | 6 +++--- .../test/unit/sharedKeyCredential.spec.ts | 2 +- sdk/tables/data-tables/test/unit/utils.spec.ts | 2 +- .../test/public/configurationClient.spec.ts | 2 +- .../ai-text-analytics/test/public/apiKey.spec.ts | 6 +++--- .../test/public/textAnalyticsClient.spec.ts | 2 +- 55 files changed, 84 insertions(+), 84 deletions(-) diff --git a/sdk/anomalydetector/ai-anomaly-detector/test/anomalydetector.spec.ts b/sdk/anomalydetector/ai-anomaly-detector/test/anomalydetector.spec.ts index 260bd2cd68e8..5dd4f574ff77 100644 --- a/sdk/anomalydetector/ai-anomaly-detector/test/anomalydetector.spec.ts +++ b/sdk/anomalydetector/ai-anomaly-detector/test/anomalydetector.spec.ts @@ -19,7 +19,7 @@ describe("AnomalyDetectorClient", () => { let recorder: Recorder; const apiKey = new AzureKeyCredential(testEnv.ANOMALY_DETECTOR_API_KEY); - beforeEach(/** @this*/ function() { + beforeEach(/** @this */ function() { ({ recorder, client } = createRecordedAnomalyDetectorClient(this, apiKey)); }); diff --git a/sdk/attestation/attestation/test/public/attestationTests.spec.ts b/sdk/attestation/attestation/test/public/attestationTests.spec.ts index b1f971334bbd..9b3254274801 100644 --- a/sdk/attestation/attestation/test/public/attestationTests.spec.ts +++ b/sdk/attestation/attestation/test/public/attestationTests.spec.ts @@ -14,7 +14,7 @@ import { verifyAttestationToken } from "../utils/helpers"; describe("[AAD] Attestation Client", function() { let recorder: Recorder; - beforeEach(/** @this*/ function() { + beforeEach(/** @this */ function() { recorder = createRecorder(this); }); diff --git a/sdk/attestation/attestation/test/public/policyGetSetTests.spec.ts b/sdk/attestation/attestation/test/public/policyGetSetTests.spec.ts index 7909551356c7..3009e1d249bd 100644 --- a/sdk/attestation/attestation/test/public/policyGetSetTests.spec.ts +++ b/sdk/attestation/attestation/test/public/policyGetSetTests.spec.ts @@ -14,7 +14,7 @@ import { verifyAttestationToken } from "../utils/helpers"; describe("PolicyGetSetTests ", function() { let recorder: Recorder; - beforeEach(/** @this*/ function() { + beforeEach(/** @this */ function() { recorder = createRecorder(this); }); diff --git a/sdk/attestation/attestation/test/public/policyManagementGetSetTests.spec.ts b/sdk/attestation/attestation/test/public/policyManagementGetSetTests.spec.ts index a7a096fcbec0..e580f2b38d61 100644 --- a/sdk/attestation/attestation/test/public/policyManagementGetSetTests.spec.ts +++ b/sdk/attestation/attestation/test/public/policyManagementGetSetTests.spec.ts @@ -13,7 +13,7 @@ import { verifyAttestationToken } from "../utils/helpers"; describe("PolicyManagementTests ", function() { let recorder: Recorder; - beforeEach(/** @this*/ function() { + beforeEach(/** @this */ function() { recorder = createRecorder(this); }); diff --git a/sdk/attestation/attestation/test/public/tokenCertTests.spec.ts b/sdk/attestation/attestation/test/public/tokenCertTests.spec.ts index beb23dbe575b..67a09626dc13 100644 --- a/sdk/attestation/attestation/test/public/tokenCertTests.spec.ts +++ b/sdk/attestation/attestation/test/public/tokenCertTests.spec.ts @@ -13,7 +13,7 @@ import { Buffer } from "../utils/Buffer"; describe("TokenCertTests", function() { let recorder: Recorder; - beforeEach(/** @this*/ function() { + beforeEach(/** @this */ function() { recorder = createRecorder(this); }); diff --git a/sdk/containerregistry/container-registry/test/public/containerRegistryClient.spec.ts b/sdk/containerregistry/container-registry/test/public/containerRegistryClient.spec.ts index b8822d566b6d..eb87fbc59fec 100644 --- a/sdk/containerregistry/container-registry/test/public/containerRegistryClient.spec.ts +++ b/sdk/containerregistry/container-registry/test/public/containerRegistryClient.spec.ts @@ -50,7 +50,7 @@ describe.skip("ContainerRegistryClient functional tests", function() { // NOTE: use of "function" and not ES6 arrow-style functions with the // beforeEach hook is IMPORTANT due to the use of `this` in the function // body. - beforeEach(/** @this*/ function(this: Context) { + beforeEach(/** @this */ function(this: Context) { // The recorder has some convenience methods, and we need to store a // reference to it so that we can `stop()` the recorder later in the // `afterEach` hook. diff --git a/sdk/core/core-http/test/defaultHttpClientTests.ts b/sdk/core/core-http/test/defaultHttpClientTests.ts index 01e6c23412df..708db874f6b0 100644 --- a/sdk/core/core-http/test/defaultHttpClientTests.ts +++ b/sdk/core/core-http/test/defaultHttpClientTests.ts @@ -236,7 +236,7 @@ describe("defaultHttpClient", function() { } }); - it("should give a graceful error for nonexistent hosts", /** @this*/ async function() { + it("should give a graceful error for nonexistent hosts", /** @this */ async function() { // Increase timeout to give the request time to fail this.timeout(10000); const requestUrl = "http://fake.domain"; diff --git a/sdk/core/core-lro/test/utils/testOperation.ts b/sdk/core/core-lro/test/utils/testOperation.ts index 1e7783cd0ac4..b844a93cb484 100644 --- a/sdk/core/core-lro/test/utils/testOperation.ts +++ b/sdk/core/core-lro/test/utils/testOperation.ts @@ -21,7 +21,7 @@ export interface TestOperationState extends PollOperationState { export interface TestOperation extends PollOperation {} -/** @this*/ +/** @this */ async function update( this: TestOperation, options: { @@ -70,7 +70,7 @@ async function update( return makeOperation(newState); } -/** @this*/ +/** @this */ async function cancel( this: TestOperation, options: { abortSignal?: AbortSignal } = {} @@ -101,7 +101,7 @@ async function cancel( }); } -/** @this*/ +/** @this */ function toString(this: TestOperation): string { return JSON.stringify({ state: this.state diff --git a/sdk/core/logger/src/debug.ts b/sdk/core/logger/src/debug.ts index e56f09b5a875..9282cf1c2517 100644 --- a/sdk/core/logger/src/debug.ts +++ b/sdk/core/logger/src/debug.ts @@ -155,7 +155,7 @@ function createDebugger(namespace: string): Debugger { return newDebugger; } -/** @this*/ +/** @this */ function destroy(this: Debugger): boolean { const index = debuggers.indexOf(this); if (index >= 0) { @@ -165,7 +165,7 @@ function destroy(this: Debugger): boolean { return false; } -/** @this*/ +/** @this */ function extend(this: Debugger, namespace: string): Debugger { const newDebugger = createDebugger(`${this.namespace}:${namespace}`); newDebugger.log = this.log; diff --git a/sdk/cosmosdb/cosmos/test/internal/session.spec.ts b/sdk/cosmosdb/cosmos/test/internal/session.spec.ts index 85e6d4d2f680..f174715e8922 100644 --- a/sdk/cosmosdb/cosmos/test/internal/session.spec.ts +++ b/sdk/cosmosdb/cosmos/test/internal/session.spec.ts @@ -28,7 +28,7 @@ function getCollection2TokenMap( return (sessionContainer as any).collectionResourceIdToSessionTokens; } -describe("Session Token", /** @this*/ function() { +describe("Session Token", /** @this */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 20000); const containerId = "sessionTestColl"; @@ -304,7 +304,7 @@ describe("Session Token", /** @this*/ function() { spy.restore(); }); - it("validate 'lsn not caught up' error for higher lsn and clearing session token", /** @this*/ async function() { + it("validate 'lsn not caught up' error for higher lsn and clearing session token", /** @this */ async function() { this.retries(2); const database = await getTestDatabase("session test", client); diff --git a/sdk/cosmosdb/cosmos/test/internal/unit/auth.spec.ts b/sdk/cosmosdb/cosmos/test/internal/unit/auth.spec.ts index 5ca1c23454a3..a3c210a644c9 100644 --- a/sdk/cosmosdb/cosmos/test/internal/unit/auth.spec.ts +++ b/sdk/cosmosdb/cosmos/test/internal/unit/auth.spec.ts @@ -4,7 +4,7 @@ import { getAuthorizationTokenUsingResourceTokens } from "../../../src/auth"; import assert from "assert"; -describe("NodeJS CRUD Tests", /** @this*/ function() { +describe("NodeJS CRUD Tests", /** @this */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); it("should find exact match", async function() { diff --git a/sdk/cosmosdb/cosmos/test/public/functional/authorization.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/authorization.spec.ts index 5a8f6722d714..f538c8628e5f 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/authorization.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/authorization.spec.ts @@ -11,7 +11,7 @@ import { removeAllDatabases } from "../common/TestHelpers"; -describe("NodeJS CRUD Tests", /** @this*/ function() { +describe("NodeJS CRUD Tests", /** @this */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); beforeEach(async function() { await removeAllDatabases(); diff --git a/sdk/cosmosdb/cosmos/test/public/functional/client.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/client.spec.ts index c8ab759377bb..9b3419d50efd 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/client.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/client.spec.ts @@ -13,7 +13,7 @@ import { import AbortController from "node-abort-controller"; import { UsernamePasswordCredential } from "@azure/identity"; -describe("NodeJS CRUD Tests", /** @this*/ function() { +describe("NodeJS CRUD Tests", /** @this */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 20000); describe("Validate client request timeout", function() { diff --git a/sdk/cosmosdb/cosmos/test/public/functional/conflict.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/conflict.spec.ts index 987e6b69c7fa..285c46b3ec92 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/conflict.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/conflict.spec.ts @@ -3,7 +3,7 @@ import assert from "assert"; import { removeAllDatabases, getTestContainer } from "../common/TestHelpers"; -describe("Conflicts", /** @this*/ function() { +describe("Conflicts", /** @this */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); beforeEach(async function() { await removeAllDatabases(); diff --git a/sdk/cosmosdb/cosmos/test/public/functional/container.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/container.spec.ts index a792e54e9084..2b7ed1c703c0 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/container.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/container.spec.ts @@ -14,7 +14,7 @@ import { import { SpatialType } from "../../../src"; import { GeospatialType } from "../../../src"; -describe("Containers", /** @this*/ function() { +describe("Containers", /** @this */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); beforeEach(async function() { await removeAllDatabases(); diff --git a/sdk/cosmosdb/cosmos/test/public/functional/database.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/database.spec.ts index 42b7f7a8a6be..5123ba11b571 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/database.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/database.spec.ts @@ -13,7 +13,7 @@ import { DatabaseRequest } from "../../../src"; const client = new CosmosClient({ endpoint, key: masterKey }); -describe("NodeJS CRUD Tests", /** @this*/ function() { +describe("NodeJS CRUD Tests", /** @this */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); beforeEach(async function() { await removeAllDatabases(); diff --git a/sdk/cosmosdb/cosmos/test/public/functional/databaseaccount.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/databaseaccount.spec.ts index 30f67fed47a6..a7406a185844 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/databaseaccount.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/databaseaccount.spec.ts @@ -6,9 +6,9 @@ import { endpoint, masterKey } from "../common/_testConfig"; const client = new CosmosClient({ endpoint, key: masterKey }); -describe("NodeJS CRUD Tests", /** @this*/ function() { +describe("NodeJS CRUD Tests", /** @this */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); - beforeEach(/** @this*/ async function() { + beforeEach(/** @this */ async function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); }); diff --git a/sdk/cosmosdb/cosmos/test/public/functional/item.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/item.spec.ts index e3fdaae79fda..84f330dcc747 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/item.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/item.spec.ts @@ -26,7 +26,7 @@ interface TestItem { replace?: string; } -describe("Item CRUD", /** @this*/ function() { +describe("Item CRUD", /** @this */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); beforeEach(async function() { await removeAllDatabases(); diff --git a/sdk/cosmosdb/cosmos/test/public/functional/offer.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/offer.spec.ts index dc205d5add3c..ffa390da7e34 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/offer.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/offer.spec.ts @@ -15,10 +15,10 @@ const validateOfferResponseBody = function(offer: any): void { assert(offer._self.indexOf(offer.id) !== -1, "Offer id not contained in offer self link."); }; -describe("NodeJS CRUD Tests", /** @this*/ function() { +describe("NodeJS CRUD Tests", /** @this */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); - beforeEach(/** @this*/ async function() { + beforeEach(/** @this */ async function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); await removeAllDatabases(); }); diff --git a/sdk/cosmosdb/cosmos/test/public/functional/permission.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/permission.spec.ts index 721a960fe535..0a8b2e0159af 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/permission.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/permission.spec.ts @@ -10,7 +10,7 @@ import { replaceOrUpsertPermission } from "../common/TestHelpers"; -describe("NodeJS CRUD Tests", /** @this*/ function() { +describe("NodeJS CRUD Tests", /** @this */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); beforeEach(async function() { await removeAllDatabases(); diff --git a/sdk/cosmosdb/cosmos/test/public/functional/query.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/query.spec.ts index c73d3494d833..df8c5cb84ebb 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/query.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/query.spec.ts @@ -14,7 +14,7 @@ if (!Symbol || !Symbol.asyncIterator) { (Symbol as any).asyncIterator = Symbol.for("Symbol.asyncIterator"); } -describe("Queries", /** @this*/ function() { +describe("Queries", /** @this */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); before(async function() { await removeAllDatabases(); @@ -47,7 +47,7 @@ describe("Queries", /** @this*/ function() { }); }); - describe("QueryIterator", /** @this*/ function() { + describe("QueryIterator", /** @this */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 30000); let resources: { container: Container; doc1: any; doc2: any; doc3: any }; @@ -143,7 +143,7 @@ describe("Queries", /** @this*/ function() { } }); - describe("SUM query iterator", /** @this*/ function() { + describe("SUM query iterator", /** @this */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 30000); it("returns undefined sum with null value in aggregator", async function() { diff --git a/sdk/cosmosdb/cosmos/test/public/functional/spatial.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/spatial.spec.ts index 4d2b71df7073..2d8c083a3fea 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/spatial.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/spatial.spec.ts @@ -4,7 +4,7 @@ import assert from "assert"; import { Database, DataType, IndexKind } from "../../../src"; import { createOrUpsertItem, getTestDatabase, removeAllDatabases } from "../common/TestHelpers"; -describe("Spatial Indexes", /** @this*/ function() { +describe("Spatial Indexes", /** @this */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); beforeEach(async function() { await removeAllDatabases(); diff --git a/sdk/cosmosdb/cosmos/test/public/functional/sproc.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/sproc.spec.ts index 1921db6fe46b..393958f89917 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/sproc.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/sproc.spec.ts @@ -13,14 +13,14 @@ import { // Used for sproc declare let getContext: any; -describe("NodeJS CRUD Tests", /** @this*/ function() { +describe("NodeJS CRUD Tests", /** @this */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); beforeEach(async function() { await removeAllDatabases(); }); describe("Validate sproc CRUD", function() { let container: Container; - beforeEach(/** @this*/ async function() { + beforeEach(/** @this */ async function() { container = await getTestContainer(this.test.fullTitle()); }); @@ -92,7 +92,7 @@ describe("NodeJS CRUD Tests", /** @this*/ function() { describe("Validate stored procedure functionality", function() { let container: Container; - beforeEach(/** @this*/ async function() { + beforeEach(/** @this */ async function() { container = await getTestContainer(this.test.fullTitle()); }); diff --git a/sdk/cosmosdb/cosmos/test/public/functional/trigger.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/trigger.spec.ts index b53dfc254515..00be6d00c4e1 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/trigger.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/trigger.spec.ts @@ -10,7 +10,7 @@ const notFoundErrorCode = 404; // Mock for trigger function bodies declare let getContext: any; -describe("NodeJS CRUD Tests", /** @this*/ function() { +describe("NodeJS CRUD Tests", /** @this */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); let container: Container; diff --git a/sdk/cosmosdb/cosmos/test/public/functional/ttl.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/ttl.spec.ts index 37b0872d55e3..35e66036c7cb 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/ttl.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/ttl.spec.ts @@ -11,7 +11,7 @@ async function sleep(time: number): Promise { }); } -describe("Container TTL", /** @this*/ function() { +describe("Container TTL", /** @this */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 600000); beforeEach(async function() { await removeAllDatabases(); diff --git a/sdk/cosmosdb/cosmos/test/public/functional/udf.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/udf.spec.ts index 1feb70bddcd9..b182c19e6fe5 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/udf.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/udf.spec.ts @@ -4,7 +4,7 @@ import assert from "assert"; import { UserDefinedFunctionDefinition, Container } from "../../../src"; import { removeAllDatabases, getTestContainer } from "../common/TestHelpers"; -describe("User Defined Function", /** @this*/ function() { +describe("User Defined Function", /** @this */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); let container: Container; diff --git a/sdk/cosmosdb/cosmos/test/public/functional/user.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/user.spec.ts index 297cf1fb9332..ab43e7eca2bc 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/user.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/user.spec.ts @@ -4,7 +4,7 @@ import assert from "assert"; import { UserDefinition } from "../../../src"; import { createOrUpsertUser, getTestDatabase, removeAllDatabases } from "../common/TestHelpers"; -describe("NodeJS CRUD Tests", /** @this*/ function() { +describe("NodeJS CRUD Tests", /** @this */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); beforeEach(async function() { await removeAllDatabases(); diff --git a/sdk/cosmosdb/cosmos/test/public/integration/aggregateQuery.spec.ts b/sdk/cosmosdb/cosmos/test/public/integration/aggregateQuery.spec.ts index 42519b8d513d..2c03a96b4dc4 100644 --- a/sdk/cosmosdb/cosmos/test/public/integration/aggregateQuery.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/integration/aggregateQuery.spec.ts @@ -9,7 +9,7 @@ import { FeedOptions } from "../../../src"; import { TestData } from "../common/TestData"; import { bulkInsertItems, getTestContainer, removeAllDatabases } from "../common/TestHelpers"; -describe("Aggregate Query", /** @this*/ function() { +describe("Aggregate Query", /** @this */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 20000); const partitionKey = "key"; const uniquePartitionKey = "uniquePartitionKey"; diff --git a/sdk/cosmosdb/cosmos/test/public/integration/authorization.spec.ts b/sdk/cosmosdb/cosmos/test/public/integration/authorization.spec.ts index f384a5b86011..f3ce88324c8b 100644 --- a/sdk/cosmosdb/cosmos/test/public/integration/authorization.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/integration/authorization.spec.ts @@ -6,7 +6,7 @@ import { Database } from "../../../src"; import { endpoint } from "../common/_testConfig"; import { getTestContainer, removeAllDatabases } from "../common/TestHelpers"; -describe("Authorization", /** @this*/ function() { +describe("Authorization", /** @this */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); // TODO: should have types for all these things diff --git a/sdk/cosmosdb/cosmos/test/public/integration/changeFeed.spec.ts b/sdk/cosmosdb/cosmos/test/public/integration/changeFeed.spec.ts index c49bd6d7be1e..108915057723 100644 --- a/sdk/cosmosdb/cosmos/test/public/integration/changeFeed.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/integration/changeFeed.spec.ts @@ -5,7 +5,7 @@ import { RequestOptions } from "../../../src"; import { Container, ContainerDefinition } from "../../../src"; import { getTestContainer, removeAllDatabases } from "../common/TestHelpers"; -describe("Change Feed Iterator", /** @this*/ function() { +describe("Change Feed Iterator", /** @this */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 20000); // delete all databases and create sample database diff --git a/sdk/cosmosdb/cosmos/test/public/integration/crossPartition.spec.ts b/sdk/cosmosdb/cosmos/test/public/integration/crossPartition.spec.ts index 1646dbe633ae..c0d06cda7594 100644 --- a/sdk/cosmosdb/cosmos/test/public/integration/crossPartition.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/integration/crossPartition.spec.ts @@ -26,7 +26,7 @@ function compare(key: string) { }; } -describe("Cross Partition", /** @this*/ function() { +describe("Cross Partition", /** @this */ function() { this.timeout(process.env.MOCHA_TIMEOUT || "30000"); describe("Validate Query", function() { diff --git a/sdk/cosmosdb/cosmos/test/public/integration/encoding.spec.ts b/sdk/cosmosdb/cosmos/test/public/integration/encoding.spec.ts index 44906d9a7e79..51c2521cdb23 100644 --- a/sdk/cosmosdb/cosmos/test/public/integration/encoding.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/integration/encoding.spec.ts @@ -10,7 +10,7 @@ const testDoc = { "€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€" }; -describe("Create And Read Validation", /** @this*/ function() { +describe("Create And Read Validation", /** @this */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); const dateTime = new Date(); diff --git a/sdk/cosmosdb/cosmos/test/public/integration/multiregion.spec.ts b/sdk/cosmosdb/cosmos/test/public/integration/multiregion.spec.ts index 99d5713b774b..96946714791e 100644 --- a/sdk/cosmosdb/cosmos/test/public/integration/multiregion.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/integration/multiregion.spec.ts @@ -107,7 +107,7 @@ const collectionResponse = { code: 200 }; -describe("Multi-region tests", /** @this*/ function() { +describe("Multi-region tests", /** @this */ function() { this.timeout(process.env.MOCHA_TIMEOUT || "30000"); it("Preferred locations should be honored for readEndpoint", async function() { diff --git a/sdk/cosmosdb/cosmos/test/public/integration/proxy.spec.ts b/sdk/cosmosdb/cosmos/test/public/integration/proxy.spec.ts index 2e423186cd32..98d20ff5e94b 100644 --- a/sdk/cosmosdb/cosmos/test/public/integration/proxy.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/integration/proxy.spec.ts @@ -52,7 +52,7 @@ if (!isBrowser()) { }); }); - it("nativeApi Client Should execute request in error while the proxy setting is not correct", /** @this*/ async function() { + it("nativeApi Client Should execute request in error while the proxy setting is not correct", /** @this */ async function() { this.timeout(process.env.MOCHA_TIMEOUT || 30000); return new Promise((resolve, reject) => { proxy.listen(proxyPort + 1, "127.0.0.1", async () => { diff --git a/sdk/cosmosdb/cosmos/test/public/integration/query.spec.ts b/sdk/cosmosdb/cosmos/test/public/integration/query.spec.ts index 27b7a9c0dcce..872a5b7ce2bd 100644 --- a/sdk/cosmosdb/cosmos/test/public/integration/query.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/integration/query.spec.ts @@ -6,7 +6,7 @@ import { getTestContainer, getTestDatabase, removeAllDatabases } from "../common const doc = { id: "myId", pk: "pk" }; -describe("ResourceLink Trimming of leading and trailing slashes", /** @this*/ function() { +describe("ResourceLink Trimming of leading and trailing slashes", /** @this */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); const containerId = "testcontainer"; @@ -39,7 +39,7 @@ describe("ResourceLink Trimming of leading and trailing slashes", /** @this*/ fu }); }); -describe("Test Query Metrics", /** @this*/ function() { +describe("Test Query Metrics", /** @this */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 20000); const collectionId = "testCollection2"; @@ -84,7 +84,7 @@ describe("Test Query Metrics", /** @this*/ function() { }); }); -describe("Partition key in FeedOptions", /** @this*/ function() { +describe("Partition key in FeedOptions", /** @this */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); beforeEach(async function() { diff --git a/sdk/eventgrid/eventgrid/test/eventGridClient.spec.ts b/sdk/eventgrid/eventgrid/test/eventGridClient.spec.ts index e72c59b329b6..114213eb766f 100644 --- a/sdk/eventgrid/eventgrid/test/eventGridClient.spec.ts +++ b/sdk/eventgrid/eventgrid/test/eventGridClient.spec.ts @@ -18,7 +18,7 @@ import { import { FullOperationResponse } from "@azure/core-client"; import { RestError } from "@azure/core-rest-pipeline"; -describe("EventGridPublisherClient", /** @this*/ function() { +describe("EventGridPublisherClient", /** @this */ function() { let recorder: Recorder; let res: FullOperationResponse | undefined; @@ -31,7 +31,7 @@ describe("EventGridPublisherClient", /** @this*/ function() { describe("#send (EventGrid schema)", function() { let client: EventGridPublisherClient<"EventGrid">; - beforeEach(/** @this*/ function() { + beforeEach(/** @this */ function() { ({ client, recorder } = createRecordedClient( this, testEnv.EVENT_GRID_EVENT_GRID_SCHEMA_ENDPOINT, @@ -98,7 +98,7 @@ describe("EventGridPublisherClient", /** @this*/ function() { describe("#send error cases (EventGrid schema)", function() { let client: EventGridPublisherClient<"EventGrid">; - beforeEach(/** @this*/ function() { + beforeEach(/** @this */ function() { ({ client, recorder } = createRecordedClient( this, removeApiEventsSuffix(testEnv.EVENT_GRID_CUSTOM_SCHEMA_ENDPOINT), @@ -141,7 +141,7 @@ describe("EventGridPublisherClient", /** @this*/ function() { describe("#send (CloudEvent schema)", function() { let client: EventGridPublisherClient<"CloudEvent">; - beforeEach(/** @this*/ function() { + beforeEach(/** @this */ function() { ({ client, recorder } = createRecordedClient( this, testEnv.EVENT_GRID_CLOUD_EVENT_SCHEMA_ENDPOINT, @@ -250,7 +250,7 @@ describe("EventGridPublisherClient", /** @this*/ function() { describe("#send error cases (CloudEvent schema)", function() { let client: EventGridPublisherClient<"CloudEvent">; - beforeEach(/** @this*/ function() { + beforeEach(/** @this */ function() { ({ client, recorder } = createRecordedClient( this, removeApiEventsSuffix(testEnv.EVENT_GRID_CLOUD_EVENT_SCHEMA_ENDPOINT), @@ -291,7 +291,7 @@ describe("EventGridPublisherClient", /** @this*/ function() { describe("#send (Custom Event Schema)", function() { let client: EventGridPublisherClient<"Custom">; - beforeEach(/** @this*/ function() { + beforeEach(/** @this */ function() { ({ client, recorder } = createRecordedClient( this, testEnv.EVENT_GRID_CUSTOM_SCHEMA_ENDPOINT, @@ -352,7 +352,7 @@ describe("EventGridPublisherClient", /** @this*/ function() { describe("#send error cases (Custom Event Schema)", function() { let client: EventGridPublisherClient<"Custom">; - beforeEach(/** @this*/ function() { + beforeEach(/** @this */ function() { ({ client, recorder } = createRecordedClient( this, removeApiEventsSuffix(testEnv.EVENT_GRID_CUSTOM_SCHEMA_ENDPOINT), diff --git a/sdk/formrecognizer/ai-form-recognizer/test/public/browser/formrecognizerclient.spec.ts b/sdk/formrecognizer/ai-form-recognizer/test/public/browser/formrecognizerclient.spec.ts index fb17d3526118..ce4cdb266548 100644 --- a/sdk/formrecognizer/ai-form-recognizer/test/public/browser/formrecognizerclient.spec.ts +++ b/sdk/formrecognizer/ai-form-recognizer/test/public/browser/formrecognizerclient.spec.ts @@ -16,7 +16,7 @@ describe("FormRecognizerClient browser only", () => { let recorder: Recorder; const apiKey = new AzureKeyCredential(testEnv.FORM_RECOGNIZER_API_KEY); - beforeEach(/** @this*/ function() { + beforeEach(/** @this */ function() { ({ recorder, client } = createRecordedRecognizerClient(this, apiKey)); }); diff --git a/sdk/formrecognizer/ai-form-recognizer/test/public/formtrainingclient.spec.ts b/sdk/formrecognizer/ai-form-recognizer/test/public/formtrainingclient.spec.ts index 1d41aa17f5a1..e6fa463b7438 100644 --- a/sdk/formrecognizer/ai-form-recognizer/test/public/formtrainingclient.spec.ts +++ b/sdk/formrecognizer/ai-form-recognizer/test/public/formtrainingclient.spec.ts @@ -27,7 +27,7 @@ matrix([[true, false]] as const, async (useAad) => { describe(`[${useAad ? "AAD" : "API Key"}] FormTrainingClient`, () => { let recorder: Recorder; - beforeEach(/** @this*/ function(this: Context) { + beforeEach(/** @this */ function(this: Context) { recorder = createRecorder(this); }); diff --git a/sdk/formrecognizer/ai-form-recognizer/test/public/node/formrecognizerclient.spec.ts b/sdk/formrecognizer/ai-form-recognizer/test/public/node/formrecognizerclient.spec.ts index e3ed74e833b7..ccdb8174e16a 100644 --- a/sdk/formrecognizer/ai-form-recognizer/test/public/node/formrecognizerclient.spec.ts +++ b/sdk/formrecognizer/ai-form-recognizer/test/public/node/formrecognizerclient.spec.ts @@ -28,7 +28,7 @@ matrix([[true, false]] as const, async (useAad) => { let client: FormRecognizerClient; let recorder: Recorder; - beforeEach(/** @this*/ function() { + beforeEach(/** @this */ function() { recorder = createRecorder(this); client = new FormRecognizerClient(endpoint(), makeCredential(useAad)); }); diff --git a/sdk/identity/identity/test/internal/identityClient.spec.ts b/sdk/identity/identity/test/internal/identityClient.spec.ts index fabafd29b565..1e965f104275 100644 --- a/sdk/identity/identity/test/internal/identityClient.spec.ts +++ b/sdk/identity/identity/test/internal/identityClient.spec.ts @@ -77,7 +77,7 @@ describe("IdentityClient", function() { ); }); - it("throws an exception when an Env AZURE_AUTHORITY_HOST using 'http' is provided", /** @this*/ async function() { + it("throws an exception when an Env AZURE_AUTHORITY_HOST using 'http' is provided", /** @this */ async function() { if (!isNode) { return this.skip(); } diff --git a/sdk/metricsadvisor/ai-metrics-advisor/test/public/adminclient.spec.ts b/sdk/metricsadvisor/ai-metrics-advisor/test/public/adminclient.spec.ts index bdcb0b653221..1204cc5c72ee 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/test/public/adminclient.spec.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/test/public/adminclient.spec.ts @@ -19,7 +19,7 @@ matrix([[true, false]] as const, async (useAad) => { let client: MetricsAdvisorAdministrationClient; let recorder: Recorder; - beforeEach(/** @this*/ function() { + beforeEach(/** @this */ function() { ({ recorder, client } = createRecordedAdminClient(this, makeCredential(useAad))); }); @@ -77,7 +77,7 @@ matrix([[true, false]] as const, async (useAad) => { assert.ok(result.latestActiveTimestamp, "Expecting valid latest active timestamp"); }); - it("refreshes ingesetion status", /** @this*/ async function() { + it("refreshes ingesetion status", /** @this */ async function() { const iterator = client.listDataFeedIngestionStatus( testEnv.METRICS_ADVISOR_AZURE_SQLSERVER_DATAFEED_ID, new Date(Date.UTC(2020, 7, 22)), @@ -366,7 +366,7 @@ matrix([[true, false]] as const, async (useAad) => { } }); - it("deletes an alert configuration", /** @this*/ async function() { + it("deletes an alert configuration", /** @this */ async function() { if (!createdAlertConfigId) { this.skip(); } @@ -380,7 +380,7 @@ matrix([[true, false]] as const, async (useAad) => { } }); - it("deletes a detection configuration", /** @this*/ async function() { + it("deletes a detection configuration", /** @this */ async function() { if (!createdDetectionConfigId) { this.skip(); } diff --git a/sdk/metricsadvisor/ai-metrics-advisor/test/public/advisorclient.spec.ts b/sdk/metricsadvisor/ai-metrics-advisor/test/public/advisorclient.spec.ts index a015332780f6..eaa02ba6fced 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/test/public/advisorclient.spec.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/test/public/advisorclient.spec.ts @@ -20,7 +20,7 @@ matrix([[true, false]] as const, async (useAad) => { let client: MetricsAdvisorClient; let recorder: Recorder; - beforeEach(/** @this*/ function() { + beforeEach(/** @this */ function() { ({ recorder, client } = createRecordedAdvisorClient(this, makeCredential(useAad))); }); diff --git a/sdk/metricsadvisor/ai-metrics-advisor/test/public/datafeed.spec.ts b/sdk/metricsadvisor/ai-metrics-advisor/test/public/datafeed.spec.ts index 55f6ba5de591..b4b220762ba5 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/test/public/datafeed.spec.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/test/public/datafeed.spec.ts @@ -36,7 +36,7 @@ matrix([[true, false]] as const, async (useAad) => { let mySqlFeedName: string; let postgreSqlFeedName: string; - beforeEach(/** @this*/ function() { + beforeEach(/** @this */ function() { ({ recorder, client } = createRecordedAdminClient(this, makeCredential(useAad))); if (recorder && !feedName) { feedName = recorder.getUniqueName("js-test-datafeed-"); @@ -232,7 +232,7 @@ matrix([[true, false]] as const, async (useAad) => { } }); - it("retrieves an Azure Blob datafeed", /** @this*/ async function() { + it("retrieves an Azure Blob datafeed", /** @this */ async function() { // accessing environment variables here so they are already replaced by test env ones const expectedSource: DataFeedSource = { dataSourceType: "AzureBlob", @@ -271,7 +271,7 @@ matrix([[true, false]] as const, async (useAad) => { ); }); - it("updates an Azure Blob datafeed", /** @this*/ async function() { + it("updates an Azure Blob datafeed", /** @this */ async function() { if (!createdAzureBlobDataFeedId) { this.skip(); } diff --git a/sdk/metricsadvisor/ai-metrics-advisor/test/public/hookTests.spec.ts b/sdk/metricsadvisor/ai-metrics-advisor/test/public/hookTests.spec.ts index de46cd4236d2..9ca66db3f649 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/test/public/hookTests.spec.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/test/public/hookTests.spec.ts @@ -24,7 +24,7 @@ matrix([[true, false]] as const, async (useAad) => { let emailHookName: string; let webHookName: string; - beforeEach(/** @this*/ function() { + beforeEach(/** @this */ function() { ({ recorder, client } = createRecordedAdminClient(this, makeCredential(useAad))); if (recorder && !emailHookName) { emailHookName = recorder.getUniqueName("js-test-emailHook-"); diff --git a/sdk/mixedreality/mixedreality-authentication/test/mixedRealityStsClient.spec.ts b/sdk/mixedreality/mixedreality-authentication/test/mixedRealityStsClient.spec.ts index 534b95a573e4..66c47c9bcc7a 100644 --- a/sdk/mixedreality/mixedreality-authentication/test/mixedRealityStsClient.spec.ts +++ b/sdk/mixedreality/mixedreality-authentication/test/mixedRealityStsClient.spec.ts @@ -77,7 +77,7 @@ describe("[AccountKey] MixedRealityStsClient functional tests", function() { let client: MixedRealityStsClient; let recorder: Recorder; - beforeEach(/** @this*/ function() { + beforeEach(/** @this */ function() { recorder = createRecorder(this); client = createClient(); }); diff --git a/sdk/schemaregistry/schema-registry/test/schemaRegistry.spec.ts b/sdk/schemaregistry/schema-registry/test/schemaRegistry.spec.ts index 872fe8ac8e51..8e4dd8a59337 100644 --- a/sdk/schemaregistry/schema-registry/test/schemaRegistry.spec.ts +++ b/sdk/schemaregistry/schema-registry/test/schemaRegistry.spec.ts @@ -62,7 +62,7 @@ describe("SchemaRegistryClient", function() { let recorder: Recorder; let client: SchemaRegistryClient; - beforeEach(/** @this*/ function() { + beforeEach(/** @this */ function() { ({ client, recorder } = createRecordedClient(this)); }); diff --git a/sdk/search/search-documents/test/public/node/searchClient.spec.ts b/sdk/search/search-documents/test/public/node/searchClient.spec.ts index 42e9cb48a182..6321fcf3e944 100644 --- a/sdk/search/search-documents/test/public/node/searchClient.spec.ts +++ b/sdk/search/search-documents/test/public/node/searchClient.spec.ts @@ -18,14 +18,14 @@ import { delay } from "@azure/core-http"; const TEST_INDEX_NAME = isLiveMode() ? createRandomIndexName() : "hotel-live-test1"; -describe("SearchClient", /** @this*/ function() { +describe("SearchClient", /** @this */ function() { let recorder: Recorder; let searchClient: SearchClient; let indexClient: SearchIndexClient; this.timeout(99999); - beforeEach(/** @this*/ async function() { + beforeEach(/** @this */ async function() { ({ searchClient, indexClient } = createClients(TEST_INDEX_NAME)); if (!isPlaybackMode()) { await createIndex(indexClient, TEST_INDEX_NAME); diff --git a/sdk/tables/data-tables/test/integration/batch.spec.ts b/sdk/tables/data-tables/test/integration/batch.spec.ts index 7eeb54686550..86007bf0a417 100644 --- a/sdk/tables/data-tables/test/integration/batch.spec.ts +++ b/sdk/tables/data-tables/test/integration/batch.spec.ts @@ -26,7 +26,7 @@ describe("batch operations", () => { // which wouldn't match the recorded one. Fallingback to SAS for recorded tests. const authMode = !isNode || !isLiveMode() ? "SASConnectionString" : "AccountConnectionString"; - beforeEach(/** @this*/ async function() { + beforeEach(/** @this */ async function() { sinon.stub(Uuid, "generateUuid").returns("fakeId"); recorder = record(this, recordedEnvironmentSetup); client = createTableClient(tableName, authMode); diff --git a/sdk/tables/data-tables/test/integration/tableclient.spec.ts b/sdk/tables/data-tables/test/integration/tableclient.spec.ts index 6a974fc10a9a..3cb412b3f05f 100644 --- a/sdk/tables/data-tables/test/integration/tableclient.spec.ts +++ b/sdk/tables/data-tables/test/integration/tableclient.spec.ts @@ -18,7 +18,7 @@ describe("TableClient", () => { // which wouldn't match the recorded one. Fallingback to SAS for recorded tests. const authMode = !isNode || !isLiveMode() ? "SASConnectionString" : "AccountConnectionString"; - beforeEach(/** @this*/ function() { + beforeEach(/** @this */ function() { recorder = record(this, recordedEnvironmentSetup); client = createTableClient(tableName, authMode); @@ -43,7 +43,7 @@ describe("TableClient", () => { describe("listEntities", () => { // Create required entities for testing list operations - before(/** @this*/ async function() { + before(/** @this */ async function() { if (!isPlaybackMode()) { this.timeout(10000); await client.createEntity({ diff --git a/sdk/tables/data-tables/test/integration/tableserviceclient.spec.ts b/sdk/tables/data-tables/test/integration/tableserviceclient.spec.ts index 1440cf891fff..428a4e2acf2a 100644 --- a/sdk/tables/data-tables/test/integration/tableserviceclient.spec.ts +++ b/sdk/tables/data-tables/test/integration/tableserviceclient.spec.ts @@ -14,7 +14,7 @@ describe("TableServiceClient", () => { const suffix = isNode ? "node" : "browser"; const authMode = !isNode || !isLiveMode() ? "SASConnectionString" : "AccountConnectionString"; - beforeEach(/** @this*/ function() { + beforeEach(/** @this */ function() { recorder = record(this, recordedEnvironmentSetup); client = createTableServiceClient(authMode); }); @@ -49,7 +49,7 @@ describe("TableServiceClient", () => { describe("listTables", () => { const tableNames: string[] = []; const expectedTotalItems = 20; - before(/** @this*/ async function() { + before(/** @this */ async function() { // Create tables to be listed if (!isPlaybackMode()) { this.timeout(10000); @@ -61,7 +61,7 @@ describe("TableServiceClient", () => { } }); - after(/** @this*/ async function() { + after(/** @this */ async function() { // Cleanup tables if (!isPlaybackMode()) { this.timeout(10000); diff --git a/sdk/tables/data-tables/test/unit/sharedKeyCredential.spec.ts b/sdk/tables/data-tables/test/unit/sharedKeyCredential.spec.ts index f050ff1796c1..ddefb457a11f 100644 --- a/sdk/tables/data-tables/test/unit/sharedKeyCredential.spec.ts +++ b/sdk/tables/data-tables/test/unit/sharedKeyCredential.spec.ts @@ -25,7 +25,7 @@ describe("TablesSharedKeyCredential", () => { Date.prototype.toUTCString = originalToUTCString; }); - it("It should sign", /** @this*/ async function() { + it("It should sign", /** @this */ async function() { if (!isNode) { // TablesSharedKeyCredential auth is not supported in Browser this.skip(); diff --git a/sdk/tables/data-tables/test/unit/utils.spec.ts b/sdk/tables/data-tables/test/unit/utils.spec.ts index 4174173cfedb..af817f396fdb 100644 --- a/sdk/tables/data-tables/test/unit/utils.spec.ts +++ b/sdk/tables/data-tables/test/unit/utils.spec.ts @@ -10,7 +10,7 @@ import { ConnectionString } from "../../src/utils/internalModels"; describe("Utility Helpers", () => { describe("extractConnectionStringParts", () => { describe("Account Connection String", () => { - beforeEach(/** @this*/ function() { + beforeEach(/** @this */ function() { if (!isNode) { // Account connection string is not supported for Browsers this.skip(); diff --git a/sdk/template/template/test/public/configurationClient.spec.ts b/sdk/template/template/test/public/configurationClient.spec.ts index 33d8509ce163..3b02604a73aa 100644 --- a/sdk/template/template/test/public/configurationClient.spec.ts +++ b/sdk/template/template/test/public/configurationClient.spec.ts @@ -52,7 +52,7 @@ describe("[AAD] ConfigurationClient functional tests", function() { // NOTE: use of "function" and not ES6 arrow-style functions with the // beforeEach hook is IMPORTANT due to the use of `this` in the function // body. - beforeEach(/** @this*/ function(this: Context) { + beforeEach(/** @this */ function(this: Context) { // The recorder has some convenience methods, and we need to store a // reference to it so that we can `stop()` the recorder later in the // `afterEach` hook. diff --git a/sdk/textanalytics/ai-text-analytics/test/public/apiKey.spec.ts b/sdk/textanalytics/ai-text-analytics/test/public/apiKey.spec.ts index 872c2054c7f1..605c2b932f7a 100644 --- a/sdk/textanalytics/ai-text-analytics/test/public/apiKey.spec.ts +++ b/sdk/textanalytics/ai-text-analytics/test/public/apiKey.spec.ts @@ -19,13 +19,13 @@ const testDataEn = [ "I didn't like the last book I read at all." ]; -describe("[API Key] TextAnalyticsClient", /** @this*/ function() { +describe("[API Key] TextAnalyticsClient", /** @this */ function() { let recorder: Recorder; let client: TextAnalyticsClient; const CLITimeout = this.timeout(); const fastTimeout = 10000; - beforeEach(/** @this*/ function() { + beforeEach(/** @this */ function() { recorder = createRecorder(this); client = createClient("APIKey"); }); @@ -85,7 +85,7 @@ describe("[API Key] TextAnalyticsClient", /** @this*/ function() { describe("LROs", function() { const pollingInterval = isPlaybackMode() ? 0 : 2000; - before(/** @this*/ function() { + before(/** @this */ function() { this.timeout(isPlaybackMode() ? fastTimeout : CLITimeout); }); diff --git a/sdk/textanalytics/ai-text-analytics/test/public/textAnalyticsClient.spec.ts b/sdk/textanalytics/ai-text-analytics/test/public/textAnalyticsClient.spec.ts index fc158f4432e8..9dd0dfc29695 100644 --- a/sdk/textanalytics/ai-text-analytics/test/public/textAnalyticsClient.spec.ts +++ b/sdk/textanalytics/ai-text-analytics/test/public/textAnalyticsClient.spec.ts @@ -926,7 +926,7 @@ describe("[AAD] TextAnalyticsClient", /** @this */ function() { describe("LROs", function() { const pollingInterval = isPlaybackMode() ? 0 : 2000; - before(/** @this*/ function() { + before(/** @this */ function() { this.timeout(isPlaybackMode() ? fastTimeout : CLITimeout); }); From 395457cd582d0ae89acf49d3194c2caa0c6597d2 Mon Sep 17 00:00:00 2001 From: deyaaeldeen Date: Mon, 22 Mar 2021 18:59:17 +0000 Subject: [PATCH 4/9] adding the type of this to the comment --- .../test/anomalydetector.spec.ts | 2 +- .../test/public/attestationTests.spec.ts | 2 +- .../test/public/policyGetSetTests.spec.ts | 2 +- .../policyManagementGetSetTests.spec.ts | 2 +- .../test/public/tokenCertTests.spec.ts | 2 +- .../public/containerRegistryClient.spec.ts | 2 +- .../core-http/test/defaultHttpClientTests.ts | 2 +- sdk/core/core-lro/test/utils/testOperation.ts | 6 +-- sdk/core/logger/src/debug.ts | 4 +- .../cosmos/test/internal/session.spec.ts | 4 +- .../cosmos/test/internal/unit/auth.spec.ts | 2 +- .../public/functional/authorization.spec.ts | 2 +- .../test/public/functional/client.spec.ts | 2 +- .../test/public/functional/conflict.spec.ts | 2 +- .../test/public/functional/container.spec.ts | 2 +- .../test/public/functional/database.spec.ts | 2 +- .../public/functional/databaseaccount.spec.ts | 4 +- .../test/public/functional/item.spec.ts | 2 +- .../test/public/functional/offer.spec.ts | 4 +- .../test/public/functional/permission.spec.ts | 2 +- .../test/public/functional/query.spec.ts | 6 +-- .../test/public/functional/spatial.spec.ts | 2 +- .../test/public/functional/sproc.spec.ts | 6 +-- .../test/public/functional/trigger.spec.ts | 2 +- .../cosmos/test/public/functional/ttl.spec.ts | 2 +- .../cosmos/test/public/functional/udf.spec.ts | 2 +- .../test/public/functional/user.spec.ts | 2 +- .../public/integration/aggregateQuery.spec.ts | 2 +- .../public/integration/authorization.spec.ts | 2 +- .../public/integration/changeFeed.spec.ts | 2 +- .../public/integration/crossPartition.spec.ts | 2 +- .../test/public/integration/encoding.spec.ts | 2 +- .../public/integration/multiregion.spec.ts | 2 +- .../test/public/integration/proxy.spec.ts | 2 +- .../test/public/integration/query.spec.ts | 6 +-- .../eventgrid/test/eventGridClient.spec.ts | 14 ++--- .../browser/formrecognizerclient.spec.ts | 2 +- .../test/public/formtrainingclient.spec.ts | 2 +- .../public/node/formrecognizerclient.spec.ts | 2 +- .../test/internal/identityClient.spec.ts | 2 +- ...challengeBasedAuthenticationPolicy.spec.ts | 6 +-- .../test/internal/userAgent.spec.ts | 2 +- .../test/public/CRUD.spec.ts | 46 ++++++++-------- .../test/public/list.spec.ts | 16 +++--- .../test/public/lro.create.spec.ts | 6 +-- .../test/public/lro.delete.spec.ts | 6 +-- .../test/public/lro.operation.spec.ts | 6 +-- .../test/public/lro.recover.spec.ts | 8 +-- .../test/public/mergeAndImport.spec.ts | 8 +-- .../test/public/recoverBackupRestore.spec.ts | 10 ++-- .../test/internal/aesCryptography.spec.ts | 16 +++--- ...challengeBasedAuthenticationPolicy.spec.ts | 6 +-- .../test/internal/crypto.spec.ts | 12 ++--- .../test/internal/userAgent.spec.ts | 2 +- .../test/public/CRUD.hsm.spec.ts | 4 +- .../keyvault-keys/test/public/CRUD.spec.ts | 52 +++++++++---------- .../test/public/crypto.hsm.spec.ts | 6 +-- .../keyvault-keys/test/public/crypto.spec.ts | 28 +++++----- .../keyvault-keys/test/public/import.spec.ts | 4 +- .../keyvault-keys/test/public/list.spec.ts | 20 +++---- .../test/public/localCryptography.spec.ts | 14 ++--- .../test/public/lro.delete.spec.ts | 6 +-- .../test/public/lro.recoverDelete.spec.ts | 8 +-- .../test/public/recoverBackupRestore.spec.ts | 14 ++--- ...challengeBasedAuthenticationPolicy.spec.ts | 6 +-- .../test/internal/userAgent.spec.ts | 2 +- .../keyvault-secrets/test/public/CRUD.spec.ts | 38 +++++++------- .../keyvault-secrets/test/public/list.spec.ts | 22 ++++---- .../test/public/lro.delete.spec.ts | 8 +-- .../test/public/lro.recover.spec.ts | 8 +-- .../test/public/recoverBackupRestore.spec.ts | 16 +++--- .../test/public/adminclient.spec.ts | 8 +-- .../test/public/advisorclient.spec.ts | 2 +- .../test/public/datafeed.spec.ts | 6 +-- .../test/public/hookTests.spec.ts | 2 +- .../test/mixedRealityStsClient.spec.ts | 2 +- .../test/schemaRegistry.spec.ts | 2 +- .../test/public/node/searchClient.spec.ts | 4 +- .../public/node/searchIndexClient.spec.ts | 4 +- .../public/node/searchIndexerClient.spec.ts | 4 +- .../test/integration/batch.spec.ts | 2 +- .../test/integration/tableclient.spec.ts | 4 +- .../integration/tableserviceclient.spec.ts | 6 +-- .../test/unit/sharedKeyCredential.spec.ts | 2 +- .../data-tables/test/unit/utils.spec.ts | 2 +- .../test/public/configurationClient.spec.ts | 2 +- .../test/public/apiKey.spec.ts | 8 +-- .../test/public/textAnalyticsClient.spec.ts | 8 +-- 88 files changed, 295 insertions(+), 295 deletions(-) diff --git a/sdk/anomalydetector/ai-anomaly-detector/test/anomalydetector.spec.ts b/sdk/anomalydetector/ai-anomaly-detector/test/anomalydetector.spec.ts index 5dd4f574ff77..4fb8b5457299 100644 --- a/sdk/anomalydetector/ai-anomaly-detector/test/anomalydetector.spec.ts +++ b/sdk/anomalydetector/ai-anomaly-detector/test/anomalydetector.spec.ts @@ -19,7 +19,7 @@ describe("AnomalyDetectorClient", () => { let recorder: Recorder; const apiKey = new AzureKeyCredential(testEnv.ANOMALY_DETECTOR_API_KEY); - beforeEach(/** @this */ function() { + beforeEach(/** @this Mocha.Context */ function() { ({ recorder, client } = createRecordedAnomalyDetectorClient(this, apiKey)); }); diff --git a/sdk/attestation/attestation/test/public/attestationTests.spec.ts b/sdk/attestation/attestation/test/public/attestationTests.spec.ts index 9b3254274801..d93d76ed91ed 100644 --- a/sdk/attestation/attestation/test/public/attestationTests.spec.ts +++ b/sdk/attestation/attestation/test/public/attestationTests.spec.ts @@ -14,7 +14,7 @@ import { verifyAttestationToken } from "../utils/helpers"; describe("[AAD] Attestation Client", function() { let recorder: Recorder; - beforeEach(/** @this */ function() { + beforeEach(/** @this Mocha.Context */ function() { recorder = createRecorder(this); }); diff --git a/sdk/attestation/attestation/test/public/policyGetSetTests.spec.ts b/sdk/attestation/attestation/test/public/policyGetSetTests.spec.ts index 3009e1d249bd..c6aae43ce107 100644 --- a/sdk/attestation/attestation/test/public/policyGetSetTests.spec.ts +++ b/sdk/attestation/attestation/test/public/policyGetSetTests.spec.ts @@ -14,7 +14,7 @@ import { verifyAttestationToken } from "../utils/helpers"; describe("PolicyGetSetTests ", function() { let recorder: Recorder; - beforeEach(/** @this */ function() { + beforeEach(/** @this Mocha.Context */ function() { recorder = createRecorder(this); }); diff --git a/sdk/attestation/attestation/test/public/policyManagementGetSetTests.spec.ts b/sdk/attestation/attestation/test/public/policyManagementGetSetTests.spec.ts index e580f2b38d61..9f83fafe11b2 100644 --- a/sdk/attestation/attestation/test/public/policyManagementGetSetTests.spec.ts +++ b/sdk/attestation/attestation/test/public/policyManagementGetSetTests.spec.ts @@ -13,7 +13,7 @@ import { verifyAttestationToken } from "../utils/helpers"; describe("PolicyManagementTests ", function() { let recorder: Recorder; - beforeEach(/** @this */ function() { + beforeEach(/** @this Mocha.Context */ function() { recorder = createRecorder(this); }); diff --git a/sdk/attestation/attestation/test/public/tokenCertTests.spec.ts b/sdk/attestation/attestation/test/public/tokenCertTests.spec.ts index 67a09626dc13..da8030379308 100644 --- a/sdk/attestation/attestation/test/public/tokenCertTests.spec.ts +++ b/sdk/attestation/attestation/test/public/tokenCertTests.spec.ts @@ -13,7 +13,7 @@ import { Buffer } from "../utils/Buffer"; describe("TokenCertTests", function() { let recorder: Recorder; - beforeEach(/** @this */ function() { + beforeEach(/** @this Mocha.Context */ function() { recorder = createRecorder(this); }); diff --git a/sdk/containerregistry/container-registry/test/public/containerRegistryClient.spec.ts b/sdk/containerregistry/container-registry/test/public/containerRegistryClient.spec.ts index eb87fbc59fec..d517e72394cd 100644 --- a/sdk/containerregistry/container-registry/test/public/containerRegistryClient.spec.ts +++ b/sdk/containerregistry/container-registry/test/public/containerRegistryClient.spec.ts @@ -50,7 +50,7 @@ describe.skip("ContainerRegistryClient functional tests", function() { // NOTE: use of "function" and not ES6 arrow-style functions with the // beforeEach hook is IMPORTANT due to the use of `this` in the function // body. - beforeEach(/** @this */ function(this: Context) { + beforeEach(/** @this Mocha.Context */ function(this: Context) { // The recorder has some convenience methods, and we need to store a // reference to it so that we can `stop()` the recorder later in the // `afterEach` hook. diff --git a/sdk/core/core-http/test/defaultHttpClientTests.ts b/sdk/core/core-http/test/defaultHttpClientTests.ts index 708db874f6b0..e548d2e26ff6 100644 --- a/sdk/core/core-http/test/defaultHttpClientTests.ts +++ b/sdk/core/core-http/test/defaultHttpClientTests.ts @@ -236,7 +236,7 @@ describe("defaultHttpClient", function() { } }); - it("should give a graceful error for nonexistent hosts", /** @this */ async function() { + it("should give a graceful error for nonexistent hosts", /** @this Mocha.Context */ async function() { // Increase timeout to give the request time to fail this.timeout(10000); const requestUrl = "http://fake.domain"; diff --git a/sdk/core/core-lro/test/utils/testOperation.ts b/sdk/core/core-lro/test/utils/testOperation.ts index b844a93cb484..c6fbbfad6fde 100644 --- a/sdk/core/core-lro/test/utils/testOperation.ts +++ b/sdk/core/core-lro/test/utils/testOperation.ts @@ -21,7 +21,7 @@ export interface TestOperationState extends PollOperationState { export interface TestOperation extends PollOperation {} -/** @this */ +/** @this Mocha.Context */ async function update( this: TestOperation, options: { @@ -70,7 +70,7 @@ async function update( return makeOperation(newState); } -/** @this */ +/** @this Mocha.Context */ async function cancel( this: TestOperation, options: { abortSignal?: AbortSignal } = {} @@ -101,7 +101,7 @@ async function cancel( }); } -/** @this */ +/** @this Mocha.Context */ function toString(this: TestOperation): string { return JSON.stringify({ state: this.state diff --git a/sdk/core/logger/src/debug.ts b/sdk/core/logger/src/debug.ts index 9282cf1c2517..bdd5172672a5 100644 --- a/sdk/core/logger/src/debug.ts +++ b/sdk/core/logger/src/debug.ts @@ -155,7 +155,7 @@ function createDebugger(namespace: string): Debugger { return newDebugger; } -/** @this */ +/** @this Mocha.Context */ function destroy(this: Debugger): boolean { const index = debuggers.indexOf(this); if (index >= 0) { @@ -165,7 +165,7 @@ function destroy(this: Debugger): boolean { return false; } -/** @this */ +/** @this Mocha.Context */ function extend(this: Debugger, namespace: string): Debugger { const newDebugger = createDebugger(`${this.namespace}:${namespace}`); newDebugger.log = this.log; diff --git a/sdk/cosmosdb/cosmos/test/internal/session.spec.ts b/sdk/cosmosdb/cosmos/test/internal/session.spec.ts index f174715e8922..769a78855d72 100644 --- a/sdk/cosmosdb/cosmos/test/internal/session.spec.ts +++ b/sdk/cosmosdb/cosmos/test/internal/session.spec.ts @@ -28,7 +28,7 @@ function getCollection2TokenMap( return (sessionContainer as any).collectionResourceIdToSessionTokens; } -describe("Session Token", /** @this */ function() { +describe("Session Token", /** @this Mocha.Context */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 20000); const containerId = "sessionTestColl"; @@ -304,7 +304,7 @@ describe("Session Token", /** @this */ function() { spy.restore(); }); - it("validate 'lsn not caught up' error for higher lsn and clearing session token", /** @this */ async function() { + it("validate 'lsn not caught up' error for higher lsn and clearing session token", /** @this Mocha.Context */ async function() { this.retries(2); const database = await getTestDatabase("session test", client); diff --git a/sdk/cosmosdb/cosmos/test/internal/unit/auth.spec.ts b/sdk/cosmosdb/cosmos/test/internal/unit/auth.spec.ts index a3c210a644c9..cac18417be47 100644 --- a/sdk/cosmosdb/cosmos/test/internal/unit/auth.spec.ts +++ b/sdk/cosmosdb/cosmos/test/internal/unit/auth.spec.ts @@ -4,7 +4,7 @@ import { getAuthorizationTokenUsingResourceTokens } from "../../../src/auth"; import assert from "assert"; -describe("NodeJS CRUD Tests", /** @this */ function() { +describe("NodeJS CRUD Tests", /** @this Mocha.Context */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); it("should find exact match", async function() { diff --git a/sdk/cosmosdb/cosmos/test/public/functional/authorization.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/authorization.spec.ts index f538c8628e5f..3b6d75fa567f 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/authorization.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/authorization.spec.ts @@ -11,7 +11,7 @@ import { removeAllDatabases } from "../common/TestHelpers"; -describe("NodeJS CRUD Tests", /** @this */ function() { +describe("NodeJS CRUD Tests", /** @this Mocha.Context */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); beforeEach(async function() { await removeAllDatabases(); diff --git a/sdk/cosmosdb/cosmos/test/public/functional/client.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/client.spec.ts index 9b3419d50efd..8e18e80646b6 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/client.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/client.spec.ts @@ -13,7 +13,7 @@ import { import AbortController from "node-abort-controller"; import { UsernamePasswordCredential } from "@azure/identity"; -describe("NodeJS CRUD Tests", /** @this */ function() { +describe("NodeJS CRUD Tests", /** @this Mocha.Context */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 20000); describe("Validate client request timeout", function() { diff --git a/sdk/cosmosdb/cosmos/test/public/functional/conflict.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/conflict.spec.ts index 285c46b3ec92..1f8aab90af1c 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/conflict.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/conflict.spec.ts @@ -3,7 +3,7 @@ import assert from "assert"; import { removeAllDatabases, getTestContainer } from "../common/TestHelpers"; -describe("Conflicts", /** @this */ function() { +describe("Conflicts", /** @this Mocha.Context */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); beforeEach(async function() { await removeAllDatabases(); diff --git a/sdk/cosmosdb/cosmos/test/public/functional/container.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/container.spec.ts index 2b7ed1c703c0..81c4d262fa1f 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/container.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/container.spec.ts @@ -14,7 +14,7 @@ import { import { SpatialType } from "../../../src"; import { GeospatialType } from "../../../src"; -describe("Containers", /** @this */ function() { +describe("Containers", /** @this Mocha.Context */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); beforeEach(async function() { await removeAllDatabases(); diff --git a/sdk/cosmosdb/cosmos/test/public/functional/database.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/database.spec.ts index 5123ba11b571..123c5fdec13f 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/database.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/database.spec.ts @@ -13,7 +13,7 @@ import { DatabaseRequest } from "../../../src"; const client = new CosmosClient({ endpoint, key: masterKey }); -describe("NodeJS CRUD Tests", /** @this */ function() { +describe("NodeJS CRUD Tests", /** @this Mocha.Context */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); beforeEach(async function() { await removeAllDatabases(); diff --git a/sdk/cosmosdb/cosmos/test/public/functional/databaseaccount.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/databaseaccount.spec.ts index a7406a185844..e2176c69e23f 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/databaseaccount.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/databaseaccount.spec.ts @@ -6,9 +6,9 @@ import { endpoint, masterKey } from "../common/_testConfig"; const client = new CosmosClient({ endpoint, key: masterKey }); -describe("NodeJS CRUD Tests", /** @this */ function() { +describe("NodeJS CRUD Tests", /** @this Mocha.Context */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); }); diff --git a/sdk/cosmosdb/cosmos/test/public/functional/item.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/item.spec.ts index 84f330dcc747..c231f99d5ac2 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/item.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/item.spec.ts @@ -26,7 +26,7 @@ interface TestItem { replace?: string; } -describe("Item CRUD", /** @this */ function() { +describe("Item CRUD", /** @this Mocha.Context */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); beforeEach(async function() { await removeAllDatabases(); diff --git a/sdk/cosmosdb/cosmos/test/public/functional/offer.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/offer.spec.ts index ffa390da7e34..0ea64fef25fe 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/offer.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/offer.spec.ts @@ -15,10 +15,10 @@ const validateOfferResponseBody = function(offer: any): void { assert(offer._self.indexOf(offer.id) !== -1, "Offer id not contained in offer self link."); }; -describe("NodeJS CRUD Tests", /** @this */ function() { +describe("NodeJS CRUD Tests", /** @this Mocha.Context */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); await removeAllDatabases(); }); diff --git a/sdk/cosmosdb/cosmos/test/public/functional/permission.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/permission.spec.ts index 0a8b2e0159af..c947e0a83114 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/permission.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/permission.spec.ts @@ -10,7 +10,7 @@ import { replaceOrUpsertPermission } from "../common/TestHelpers"; -describe("NodeJS CRUD Tests", /** @this */ function() { +describe("NodeJS CRUD Tests", /** @this Mocha.Context */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); beforeEach(async function() { await removeAllDatabases(); diff --git a/sdk/cosmosdb/cosmos/test/public/functional/query.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/query.spec.ts index df8c5cb84ebb..2de5e66f30bc 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/query.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/query.spec.ts @@ -14,7 +14,7 @@ if (!Symbol || !Symbol.asyncIterator) { (Symbol as any).asyncIterator = Symbol.for("Symbol.asyncIterator"); } -describe("Queries", /** @this */ function() { +describe("Queries", /** @this Mocha.Context */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); before(async function() { await removeAllDatabases(); @@ -47,7 +47,7 @@ describe("Queries", /** @this */ function() { }); }); - describe("QueryIterator", /** @this */ function() { + describe("QueryIterator", /** @this Mocha.Context */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 30000); let resources: { container: Container; doc1: any; doc2: any; doc3: any }; @@ -143,7 +143,7 @@ describe("Queries", /** @this */ function() { } }); - describe("SUM query iterator", /** @this */ function() { + describe("SUM query iterator", /** @this Mocha.Context */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 30000); it("returns undefined sum with null value in aggregator", async function() { diff --git a/sdk/cosmosdb/cosmos/test/public/functional/spatial.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/spatial.spec.ts index 2d8c083a3fea..857b6ab3b301 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/spatial.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/spatial.spec.ts @@ -4,7 +4,7 @@ import assert from "assert"; import { Database, DataType, IndexKind } from "../../../src"; import { createOrUpsertItem, getTestDatabase, removeAllDatabases } from "../common/TestHelpers"; -describe("Spatial Indexes", /** @this */ function() { +describe("Spatial Indexes", /** @this Mocha.Context */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); beforeEach(async function() { await removeAllDatabases(); diff --git a/sdk/cosmosdb/cosmos/test/public/functional/sproc.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/sproc.spec.ts index 393958f89917..354d557aedff 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/sproc.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/sproc.spec.ts @@ -13,14 +13,14 @@ import { // Used for sproc declare let getContext: any; -describe("NodeJS CRUD Tests", /** @this */ function() { +describe("NodeJS CRUD Tests", /** @this Mocha.Context */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); beforeEach(async function() { await removeAllDatabases(); }); describe("Validate sproc CRUD", function() { let container: Container; - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { container = await getTestContainer(this.test.fullTitle()); }); @@ -92,7 +92,7 @@ describe("NodeJS CRUD Tests", /** @this */ function() { describe("Validate stored procedure functionality", function() { let container: Container; - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { container = await getTestContainer(this.test.fullTitle()); }); diff --git a/sdk/cosmosdb/cosmos/test/public/functional/trigger.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/trigger.spec.ts index 00be6d00c4e1..cdcc6d5b90e9 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/trigger.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/trigger.spec.ts @@ -10,7 +10,7 @@ const notFoundErrorCode = 404; // Mock for trigger function bodies declare let getContext: any; -describe("NodeJS CRUD Tests", /** @this */ function() { +describe("NodeJS CRUD Tests", /** @this Mocha.Context */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); let container: Container; diff --git a/sdk/cosmosdb/cosmos/test/public/functional/ttl.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/ttl.spec.ts index 35e66036c7cb..0682de279eae 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/ttl.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/ttl.spec.ts @@ -11,7 +11,7 @@ async function sleep(time: number): Promise { }); } -describe("Container TTL", /** @this */ function() { +describe("Container TTL", /** @this Mocha.Context */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 600000); beforeEach(async function() { await removeAllDatabases(); diff --git a/sdk/cosmosdb/cosmos/test/public/functional/udf.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/udf.spec.ts index b182c19e6fe5..cbfd1dfc5468 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/udf.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/udf.spec.ts @@ -4,7 +4,7 @@ import assert from "assert"; import { UserDefinedFunctionDefinition, Container } from "../../../src"; import { removeAllDatabases, getTestContainer } from "../common/TestHelpers"; -describe("User Defined Function", /** @this */ function() { +describe("User Defined Function", /** @this Mocha.Context */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); let container: Container; diff --git a/sdk/cosmosdb/cosmos/test/public/functional/user.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/user.spec.ts index ab43e7eca2bc..c06ec026c6a9 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/user.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/user.spec.ts @@ -4,7 +4,7 @@ import assert from "assert"; import { UserDefinition } from "../../../src"; import { createOrUpsertUser, getTestDatabase, removeAllDatabases } from "../common/TestHelpers"; -describe("NodeJS CRUD Tests", /** @this */ function() { +describe("NodeJS CRUD Tests", /** @this Mocha.Context */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); beforeEach(async function() { await removeAllDatabases(); diff --git a/sdk/cosmosdb/cosmos/test/public/integration/aggregateQuery.spec.ts b/sdk/cosmosdb/cosmos/test/public/integration/aggregateQuery.spec.ts index 2c03a96b4dc4..51dac69cf1fd 100644 --- a/sdk/cosmosdb/cosmos/test/public/integration/aggregateQuery.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/integration/aggregateQuery.spec.ts @@ -9,7 +9,7 @@ import { FeedOptions } from "../../../src"; import { TestData } from "../common/TestData"; import { bulkInsertItems, getTestContainer, removeAllDatabases } from "../common/TestHelpers"; -describe("Aggregate Query", /** @this */ function() { +describe("Aggregate Query", /** @this Mocha.Context */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 20000); const partitionKey = "key"; const uniquePartitionKey = "uniquePartitionKey"; diff --git a/sdk/cosmosdb/cosmos/test/public/integration/authorization.spec.ts b/sdk/cosmosdb/cosmos/test/public/integration/authorization.spec.ts index f3ce88324c8b..a7d22d30bd6a 100644 --- a/sdk/cosmosdb/cosmos/test/public/integration/authorization.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/integration/authorization.spec.ts @@ -6,7 +6,7 @@ import { Database } from "../../../src"; import { endpoint } from "../common/_testConfig"; import { getTestContainer, removeAllDatabases } from "../common/TestHelpers"; -describe("Authorization", /** @this */ function() { +describe("Authorization", /** @this Mocha.Context */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); // TODO: should have types for all these things diff --git a/sdk/cosmosdb/cosmos/test/public/integration/changeFeed.spec.ts b/sdk/cosmosdb/cosmos/test/public/integration/changeFeed.spec.ts index 108915057723..97625a17e2e4 100644 --- a/sdk/cosmosdb/cosmos/test/public/integration/changeFeed.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/integration/changeFeed.spec.ts @@ -5,7 +5,7 @@ import { RequestOptions } from "../../../src"; import { Container, ContainerDefinition } from "../../../src"; import { getTestContainer, removeAllDatabases } from "../common/TestHelpers"; -describe("Change Feed Iterator", /** @this */ function() { +describe("Change Feed Iterator", /** @this Mocha.Context */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 20000); // delete all databases and create sample database diff --git a/sdk/cosmosdb/cosmos/test/public/integration/crossPartition.spec.ts b/sdk/cosmosdb/cosmos/test/public/integration/crossPartition.spec.ts index c0d06cda7594..1bf0a5db5161 100644 --- a/sdk/cosmosdb/cosmos/test/public/integration/crossPartition.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/integration/crossPartition.spec.ts @@ -26,7 +26,7 @@ function compare(key: string) { }; } -describe("Cross Partition", /** @this */ function() { +describe("Cross Partition", /** @this Mocha.Context */ function() { this.timeout(process.env.MOCHA_TIMEOUT || "30000"); describe("Validate Query", function() { diff --git a/sdk/cosmosdb/cosmos/test/public/integration/encoding.spec.ts b/sdk/cosmosdb/cosmos/test/public/integration/encoding.spec.ts index 51c2521cdb23..33dc9521adfb 100644 --- a/sdk/cosmosdb/cosmos/test/public/integration/encoding.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/integration/encoding.spec.ts @@ -10,7 +10,7 @@ const testDoc = { "€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€" }; -describe("Create And Read Validation", /** @this */ function() { +describe("Create And Read Validation", /** @this Mocha.Context */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); const dateTime = new Date(); diff --git a/sdk/cosmosdb/cosmos/test/public/integration/multiregion.spec.ts b/sdk/cosmosdb/cosmos/test/public/integration/multiregion.spec.ts index 96946714791e..81570d28516f 100644 --- a/sdk/cosmosdb/cosmos/test/public/integration/multiregion.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/integration/multiregion.spec.ts @@ -107,7 +107,7 @@ const collectionResponse = { code: 200 }; -describe("Multi-region tests", /** @this */ function() { +describe("Multi-region tests", /** @this Mocha.Context */ function() { this.timeout(process.env.MOCHA_TIMEOUT || "30000"); it("Preferred locations should be honored for readEndpoint", async function() { diff --git a/sdk/cosmosdb/cosmos/test/public/integration/proxy.spec.ts b/sdk/cosmosdb/cosmos/test/public/integration/proxy.spec.ts index 98d20ff5e94b..7409c7bacc7f 100644 --- a/sdk/cosmosdb/cosmos/test/public/integration/proxy.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/integration/proxy.spec.ts @@ -52,7 +52,7 @@ if (!isBrowser()) { }); }); - it("nativeApi Client Should execute request in error while the proxy setting is not correct", /** @this */ async function() { + it("nativeApi Client Should execute request in error while the proxy setting is not correct", /** @this Mocha.Context */ async function() { this.timeout(process.env.MOCHA_TIMEOUT || 30000); return new Promise((resolve, reject) => { proxy.listen(proxyPort + 1, "127.0.0.1", async () => { diff --git a/sdk/cosmosdb/cosmos/test/public/integration/query.spec.ts b/sdk/cosmosdb/cosmos/test/public/integration/query.spec.ts index 872a5b7ce2bd..f33bb4753ff3 100644 --- a/sdk/cosmosdb/cosmos/test/public/integration/query.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/integration/query.spec.ts @@ -6,7 +6,7 @@ import { getTestContainer, getTestDatabase, removeAllDatabases } from "../common const doc = { id: "myId", pk: "pk" }; -describe("ResourceLink Trimming of leading and trailing slashes", /** @this */ function() { +describe("ResourceLink Trimming of leading and trailing slashes", /** @this Mocha.Context */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); const containerId = "testcontainer"; @@ -39,7 +39,7 @@ describe("ResourceLink Trimming of leading and trailing slashes", /** @this */ f }); }); -describe("Test Query Metrics", /** @this */ function() { +describe("Test Query Metrics", /** @this Mocha.Context */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 20000); const collectionId = "testCollection2"; @@ -84,7 +84,7 @@ describe("Test Query Metrics", /** @this */ function() { }); }); -describe("Partition key in FeedOptions", /** @this */ function() { +describe("Partition key in FeedOptions", /** @this Mocha.Context */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); beforeEach(async function() { diff --git a/sdk/eventgrid/eventgrid/test/eventGridClient.spec.ts b/sdk/eventgrid/eventgrid/test/eventGridClient.spec.ts index 114213eb766f..cfc4deb94260 100644 --- a/sdk/eventgrid/eventgrid/test/eventGridClient.spec.ts +++ b/sdk/eventgrid/eventgrid/test/eventGridClient.spec.ts @@ -18,7 +18,7 @@ import { import { FullOperationResponse } from "@azure/core-client"; import { RestError } from "@azure/core-rest-pipeline"; -describe("EventGridPublisherClient", /** @this */ function() { +describe("EventGridPublisherClient", /** @this Mocha.Context */ function() { let recorder: Recorder; let res: FullOperationResponse | undefined; @@ -31,7 +31,7 @@ describe("EventGridPublisherClient", /** @this */ function() { describe("#send (EventGrid schema)", function() { let client: EventGridPublisherClient<"EventGrid">; - beforeEach(/** @this */ function() { + beforeEach(/** @this Mocha.Context */ function() { ({ client, recorder } = createRecordedClient( this, testEnv.EVENT_GRID_EVENT_GRID_SCHEMA_ENDPOINT, @@ -98,7 +98,7 @@ describe("EventGridPublisherClient", /** @this */ function() { describe("#send error cases (EventGrid schema)", function() { let client: EventGridPublisherClient<"EventGrid">; - beforeEach(/** @this */ function() { + beforeEach(/** @this Mocha.Context */ function() { ({ client, recorder } = createRecordedClient( this, removeApiEventsSuffix(testEnv.EVENT_GRID_CUSTOM_SCHEMA_ENDPOINT), @@ -141,7 +141,7 @@ describe("EventGridPublisherClient", /** @this */ function() { describe("#send (CloudEvent schema)", function() { let client: EventGridPublisherClient<"CloudEvent">; - beforeEach(/** @this */ function() { + beforeEach(/** @this Mocha.Context */ function() { ({ client, recorder } = createRecordedClient( this, testEnv.EVENT_GRID_CLOUD_EVENT_SCHEMA_ENDPOINT, @@ -250,7 +250,7 @@ describe("EventGridPublisherClient", /** @this */ function() { describe("#send error cases (CloudEvent schema)", function() { let client: EventGridPublisherClient<"CloudEvent">; - beforeEach(/** @this */ function() { + beforeEach(/** @this Mocha.Context */ function() { ({ client, recorder } = createRecordedClient( this, removeApiEventsSuffix(testEnv.EVENT_GRID_CLOUD_EVENT_SCHEMA_ENDPOINT), @@ -291,7 +291,7 @@ describe("EventGridPublisherClient", /** @this */ function() { describe("#send (Custom Event Schema)", function() { let client: EventGridPublisherClient<"Custom">; - beforeEach(/** @this */ function() { + beforeEach(/** @this Mocha.Context */ function() { ({ client, recorder } = createRecordedClient( this, testEnv.EVENT_GRID_CUSTOM_SCHEMA_ENDPOINT, @@ -352,7 +352,7 @@ describe("EventGridPublisherClient", /** @this */ function() { describe("#send error cases (Custom Event Schema)", function() { let client: EventGridPublisherClient<"Custom">; - beforeEach(/** @this */ function() { + beforeEach(/** @this Mocha.Context */ function() { ({ client, recorder } = createRecordedClient( this, removeApiEventsSuffix(testEnv.EVENT_GRID_CUSTOM_SCHEMA_ENDPOINT), diff --git a/sdk/formrecognizer/ai-form-recognizer/test/public/browser/formrecognizerclient.spec.ts b/sdk/formrecognizer/ai-form-recognizer/test/public/browser/formrecognizerclient.spec.ts index ce4cdb266548..21fee4cda531 100644 --- a/sdk/formrecognizer/ai-form-recognizer/test/public/browser/formrecognizerclient.spec.ts +++ b/sdk/formrecognizer/ai-form-recognizer/test/public/browser/formrecognizerclient.spec.ts @@ -16,7 +16,7 @@ describe("FormRecognizerClient browser only", () => { let recorder: Recorder; const apiKey = new AzureKeyCredential(testEnv.FORM_RECOGNIZER_API_KEY); - beforeEach(/** @this */ function() { + beforeEach(/** @this Mocha.Context */ function() { ({ recorder, client } = createRecordedRecognizerClient(this, apiKey)); }); diff --git a/sdk/formrecognizer/ai-form-recognizer/test/public/formtrainingclient.spec.ts b/sdk/formrecognizer/ai-form-recognizer/test/public/formtrainingclient.spec.ts index e6fa463b7438..5372f3087589 100644 --- a/sdk/formrecognizer/ai-form-recognizer/test/public/formtrainingclient.spec.ts +++ b/sdk/formrecognizer/ai-form-recognizer/test/public/formtrainingclient.spec.ts @@ -27,7 +27,7 @@ matrix([[true, false]] as const, async (useAad) => { describe(`[${useAad ? "AAD" : "API Key"}] FormTrainingClient`, () => { let recorder: Recorder; - beforeEach(/** @this */ function(this: Context) { + beforeEach(/** @this Mocha.Context */ function(this: Context) { recorder = createRecorder(this); }); diff --git a/sdk/formrecognizer/ai-form-recognizer/test/public/node/formrecognizerclient.spec.ts b/sdk/formrecognizer/ai-form-recognizer/test/public/node/formrecognizerclient.spec.ts index ccdb8174e16a..7a09d8398670 100644 --- a/sdk/formrecognizer/ai-form-recognizer/test/public/node/formrecognizerclient.spec.ts +++ b/sdk/formrecognizer/ai-form-recognizer/test/public/node/formrecognizerclient.spec.ts @@ -28,7 +28,7 @@ matrix([[true, false]] as const, async (useAad) => { let client: FormRecognizerClient; let recorder: Recorder; - beforeEach(/** @this */ function() { + beforeEach(/** @this Mocha.Context */ function() { recorder = createRecorder(this); client = new FormRecognizerClient(endpoint(), makeCredential(useAad)); }); diff --git a/sdk/identity/identity/test/internal/identityClient.spec.ts b/sdk/identity/identity/test/internal/identityClient.spec.ts index 1e965f104275..e33e02bb7204 100644 --- a/sdk/identity/identity/test/internal/identityClient.spec.ts +++ b/sdk/identity/identity/test/internal/identityClient.spec.ts @@ -77,7 +77,7 @@ describe("IdentityClient", function() { ); }); - it("throws an exception when an Env AZURE_AUTHORITY_HOST using 'http' is provided", /** @this */ async function() { + it("throws an exception when an Env AZURE_AUTHORITY_HOST using 'http' is provided", /** @this Mocha.Context */ async function() { if (!isNode) { return this.skip(); } diff --git a/sdk/keyvault/keyvault-certificates/test/internal/challengeBasedAuthenticationPolicy.spec.ts b/sdk/keyvault/keyvault-certificates/test/internal/challengeBasedAuthenticationPolicy.spec.ts index a1bd850fbb4f..b79a7e4bde57 100644 --- a/sdk/keyvault/keyvault-certificates/test/internal/challengeBasedAuthenticationPolicy.spec.ts +++ b/sdk/keyvault/keyvault-certificates/test/internal/challengeBasedAuthenticationPolicy.spec.ts @@ -32,7 +32,7 @@ describe("Challenge based authentication tests", () => { subject: "cn=MyCert" }; - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { const authentication = await authenticate(this); certificateSuffix = authentication.suffix; client = authentication.client; @@ -46,7 +46,7 @@ describe("Challenge based authentication tests", () => { // The tests follow - it("Authentication should work for parallel requests", /** @this */ async function() { + it("Authentication should work for parallel requests", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName( `${certificatePrefix}-${this!.test!.title}-${certificateSuffix}` ); @@ -84,7 +84,7 @@ describe("Challenge based authentication tests", () => { sandbox.restore(); }); - it("Once authenticated, new requests should not authenticate again", /** @this */ async function() { + it("Once authenticated, new requests should not authenticate again", /** @this Mocha.Context */ async function() { // Our goal is to intercept how our pipelines are storing the challenge. // The first network call should indeed set the challenge in memory. // Subsequent network calls should not set new challenges. diff --git a/sdk/keyvault/keyvault-certificates/test/internal/userAgent.spec.ts b/sdk/keyvault/keyvault-certificates/test/internal/userAgent.spec.ts index 63ce689de280..2949f7e2475b 100644 --- a/sdk/keyvault/keyvault-certificates/test/internal/userAgent.spec.ts +++ b/sdk/keyvault/keyvault-certificates/test/internal/userAgent.spec.ts @@ -13,7 +13,7 @@ describe("Certificates client's user agent (only in Node, because of fs)", () => assert.equal(SDK_VERSION, packageVersion); }); - it("the version should also match with the one available in the package.json (only in Node, because of fs)", /** @this */ async function() { + it("the version should also match with the one available in the package.json (only in Node, because of fs)", /** @this Mocha.Context */ async function() { if (!isNode) { this.skip(); return; diff --git a/sdk/keyvault/keyvault-certificates/test/public/CRUD.spec.ts b/sdk/keyvault/keyvault-certificates/test/public/CRUD.spec.ts index bfda575d2222..6f3a15a7397d 100644 --- a/sdk/keyvault/keyvault-certificates/test/public/CRUD.spec.ts +++ b/sdk/keyvault/keyvault-certificates/test/public/CRUD.spec.ts @@ -32,7 +32,7 @@ describe("Certificates client - create, read, update and delete", () => { subject: "cn=MyCert" }; - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { const authentication = await authenticate(this); suffix = authentication.suffix; client = authentication.client; @@ -49,7 +49,7 @@ describe("Certificates client - create, read, update and delete", () => { // The tests follow - it("can create a certificate", /** @this */ async function() { + it("can create a certificate", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); const poller = await client.beginCreateCertificate( certificateName, @@ -65,7 +65,7 @@ describe("Certificates client - create, read, update and delete", () => { await testClient.flushCertificate(certificateName); }); - it("can abort creating a certificate", /** @this */ async function() { + it("can abort creating a certificate", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); const controller = new AbortController(); @@ -80,7 +80,7 @@ describe("Certificates client - create, read, update and delete", () => { }); // On playback mode, the tests happen too fast for the timeout to work - in browsers - it("can create a certificate with requestOptions timeout", /** @this */ async function() { + it("can create a certificate with requestOptions timeout", /** @this Mocha.Context */ async function() { recorder.skip("browser", "Timeout tests don't work on playback mode."); const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); @@ -114,7 +114,7 @@ describe("Certificates client - create, read, update and delete", () => { ); }); - it("can update the tags of a certificate", /** @this */ async function() { + it("can update the tags of a certificate", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); await client.beginCreateCertificate( @@ -137,7 +137,7 @@ describe("Certificates client - create, read, update and delete", () => { await testClient.flushCertificate(certificateName); }); - it("can disable a certificate", /** @this */ async function() { + it("can disable a certificate", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); const poller = await client.beginCreateCertificate( @@ -160,7 +160,7 @@ describe("Certificates client - create, read, update and delete", () => { await testClient.flushCertificate(certificateName); }); - it("can disable a certificate version", /** @this */ async function() { + it("can disable a certificate version", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); const poller = await client.beginCreateCertificate( @@ -186,7 +186,7 @@ describe("Certificates client - create, read, update and delete", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can update certificate with requestOptions timeout", /** @this */ async function() { + it("can update certificate with requestOptions timeout", /** @this Mocha.Context */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); @@ -207,7 +207,7 @@ describe("Certificates client - create, read, update and delete", () => { }); }); - it("can get a certificate", /** @this */ async function() { + it("can get a certificate", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); await client.beginCreateCertificate( certificateName, @@ -223,7 +223,7 @@ describe("Certificates client - create, read, update and delete", () => { await testClient.flushCertificate(certificateName); }); - it("can get a certificate's secret in PKCS 12 format", /** @this */ async function() { + it("can get a certificate's secret in PKCS 12 format", /** @this Mocha.Context */ async function() { recorder.skip("browser", "This test uses the file system."); // Skipping this test from the live browser test runs, because we use the file system. if (!isNode) { @@ -272,7 +272,7 @@ describe("Certificates client - create, read, update and delete", () => { await testClient.flushCertificate(certificateName); }); - it("can get a certificate's secret in PEM format", /** @this */ async function() { + it("can get a certificate's secret in PEM format", /** @this Mocha.Context */ async function() { recorder.skip("browser", "This test uses the file system."); // Skipping this test from the live browser test runs, because we use the file system. if (!isNode) { @@ -308,7 +308,7 @@ describe("Certificates client - create, read, update and delete", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can get a certificate with requestOptions timeout", /** @this */ async function() { + it("can get a certificate with requestOptions timeout", /** @this Mocha.Context */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); await client.beginCreateCertificate( @@ -321,7 +321,7 @@ describe("Certificates client - create, read, update and delete", () => { }); }); - it("can retrieve the latest version of a certificate value", /** @this */ async function() { + it("can retrieve the latest version of a certificate value", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); await client.beginCreateCertificate( certificateName, @@ -339,7 +339,7 @@ describe("Certificates client - create, read, update and delete", () => { await testClient.flushCertificate(certificateName); }); - it("can get a certificate (Non Existing)", /** @this */ async function() { + it("can get a certificate (Non Existing)", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); let error; try { @@ -352,7 +352,7 @@ describe("Certificates client - create, read, update and delete", () => { assert.equal(error.statusCode, 404); }); - it("can delete a certificate", /** @this */ async function() { + it("can delete a certificate", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); await client.beginCreateCertificate( certificateName, @@ -382,7 +382,7 @@ describe("Certificates client - create, read, update and delete", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can delete a certificate with requestOptions timeout", /** @this */ async function() { + it("can delete a certificate with requestOptions timeout", /** @this Mocha.Context */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); await client.beginCreateCertificate( @@ -400,7 +400,7 @@ describe("Certificates client - create, read, update and delete", () => { }); }); - it("can delete a certificate (Non Existing)", /** @this */ async function() { + it("can delete a certificate (Non Existing)", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); let error; try { @@ -414,7 +414,7 @@ describe("Certificates client - create, read, update and delete", () => { }); describe("can get a deleted certificate", () => { - it("using beginDeleteCertificate's poller", /** @this */ async function() { + it("using beginDeleteCertificate's poller", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); await client.beginCreateCertificate( certificateName, @@ -436,7 +436,7 @@ describe("Certificates client - create, read, update and delete", () => { await testClient.purgeCertificate(certificateName); }); - it("using getDeletedCertificate", /** @this */ async function() { + it("using getDeletedCertificate", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); await client.beginCreateCertificate( certificateName, @@ -460,7 +460,7 @@ describe("Certificates client - create, read, update and delete", () => { await testClient.purgeCertificate(certificateName); }); - it("can not get a certificate that never existed", /** @this */ async function() { + it("can not get a certificate that never existed", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); let error; try { @@ -474,7 +474,7 @@ describe("Certificates client - create, read, update and delete", () => { }); }); - it("can create, read, and delete a certificate issuer", /** @this */ async function() { + it("can create, read, and delete a certificate issuer", /** @this Mocha.Context */ async function() { const issuerName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); @@ -540,7 +540,7 @@ describe("Certificates client - create, read, update and delete", () => { await testClient.flushCertificate(certificateName); }); - it("can update a certificate's policy", /** @this */ async function() { + it("can update a certificate's policy", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); await client.beginCreateCertificate( @@ -562,7 +562,7 @@ describe("Certificates client - create, read, update and delete", () => { await testClient.flushCertificate(certificateName); }); - it("can read, cancel and delete a certificate's operation", /** @this */ async function() { + it("can read, cancel and delete a certificate's operation", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); await client.beginCreateCertificate( certificateName, diff --git a/sdk/keyvault/keyvault-certificates/test/public/list.spec.ts b/sdk/keyvault/keyvault-certificates/test/public/list.spec.ts index a43412deef0c..b1532455d2c0 100644 --- a/sdk/keyvault/keyvault-certificates/test/public/list.spec.ts +++ b/sdk/keyvault/keyvault-certificates/test/public/list.spec.ts @@ -26,7 +26,7 @@ describe("Certificates client - list certificates in various ways", () => { subject: "cn=MyCert" }; - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { const authentication = await authenticate(this); suffix = authentication.suffix; client = authentication.client; @@ -43,7 +43,7 @@ describe("Certificates client - list certificates in various ways", () => { // Use this while recording to make sure the target keyvault is clean. // The next tests will produce a more consistent output. // This test is only useful while developing locally. - it("can purge all certificates", /** @this */ async function(): Promise { + it("can purge all certificates", /** @this Mocha.Context */ async function(): Promise { // WARNING: When TEST_MODE equals "record", all of the certificates in the indicated KEYVAULT_NAME will be deleted as part of this test. if (!isRecordMode()) { return this.skip(); @@ -66,7 +66,7 @@ describe("Certificates client - list certificates in various ways", () => { } }); - it("can list certificates", /** @this */ async function() { + it("can list certificates", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); const certificateNames = [`${certificateName}0`, `${certificateName}1`]; for (const name of certificateNames) { @@ -92,7 +92,7 @@ describe("Certificates client - list certificates in various ways", () => { } }); - it("can list deleted certificates", /** @this */ async function() { + it("can list deleted certificates", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); const certificateNames = [`${certificateName}0`, `${certificateName}1`]; for (const name of certificateNames) { @@ -122,7 +122,7 @@ describe("Certificates client - list certificates in various ways", () => { } }); - it("can list certificates by page", /** @this */ async function() { + it("can list certificates by page", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); const certificateNames = [`${certificateName}0`, `${certificateName}1`]; for (const name of certificateNames) { @@ -159,7 +159,7 @@ describe("Certificates client - list certificates in various ways", () => { }); } - it("can list deleted certificates by page", /** @this */ async function() { + it("can list deleted certificates by page", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); const certificateNames = [`${certificateName}0`, `${certificateName}1`]; for (const name of certificateNames) { @@ -198,7 +198,7 @@ describe("Certificates client - list certificates in various ways", () => { }); }); - it("can retrieve all versions of a certificate", /** @this */ async function() { + it("can retrieve all versions of a certificate", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); const certificateTags = ["tag01", "tag02", "tag03"]; @@ -255,7 +255,7 @@ describe("Certificates client - list certificates in various ways", () => { }); }); - it("can list certificate versions (non existing)", /** @this */ async function() { + it("can list certificate versions (non existing)", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); let totalVersions = 0; for await (const page of client.listPropertiesOfCertificateVersions(certificateName).byPage()) { diff --git a/sdk/keyvault/keyvault-certificates/test/public/lro.create.spec.ts b/sdk/keyvault/keyvault-certificates/test/public/lro.create.spec.ts index f6f21eba0fc7..61a1ca77ffe4 100644 --- a/sdk/keyvault/keyvault-certificates/test/public/lro.create.spec.ts +++ b/sdk/keyvault/keyvault-certificates/test/public/lro.create.spec.ts @@ -17,7 +17,7 @@ describe("Certificates client - LRO - create", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { const authentication = await authenticate(this); certificateSuffix = authentication.suffix; client = authentication.client; @@ -31,7 +31,7 @@ describe("Certificates client - LRO - create", () => { // The tests follow - it("can wait until a certificate is created", /** @this */ async function() { + it("can wait until a certificate is created", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName( `${certificatePrefix}-${this!.test!.title}-${certificateSuffix}` ); @@ -55,7 +55,7 @@ describe("Certificates client - LRO - create", () => { await testClient.flushCertificate(certificateName); }); - it("can resume from a stopped poller", /** @this */ async function() { + it("can resume from a stopped poller", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName( `${certificatePrefix}-${this!.test!.title}-${certificateSuffix}` ); diff --git a/sdk/keyvault/keyvault-certificates/test/public/lro.delete.spec.ts b/sdk/keyvault/keyvault-certificates/test/public/lro.delete.spec.ts index 9377770ecec1..6ee46f180736 100644 --- a/sdk/keyvault/keyvault-certificates/test/public/lro.delete.spec.ts +++ b/sdk/keyvault/keyvault-certificates/test/public/lro.delete.spec.ts @@ -17,7 +17,7 @@ describe("Certificates client - lro - delete", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { const authentication = await authenticate(this); certificateSuffix = authentication.suffix; client = authentication.client; @@ -31,7 +31,7 @@ describe("Certificates client - lro - delete", () => { // The tests follow - it("can wait until a certificate is deleted", /** @this */ async function() { + it("can wait until a certificate is deleted", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName( `${certificatePrefix}-${this!.test!.title}-${certificateSuffix}` ); @@ -61,7 +61,7 @@ describe("Certificates client - lro - delete", () => { await testClient.purgeCertificate(certificateName); }); - it("can resume from a stopped poller", /** @this */ async function() { + it("can resume from a stopped poller", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName( `${certificatePrefix}-${this!.test!.title}-${certificateSuffix}` ); diff --git a/sdk/keyvault/keyvault-certificates/test/public/lro.operation.spec.ts b/sdk/keyvault/keyvault-certificates/test/public/lro.operation.spec.ts index 85e5f9666d24..b16310e74c6f 100644 --- a/sdk/keyvault/keyvault-certificates/test/public/lro.operation.spec.ts +++ b/sdk/keyvault/keyvault-certificates/test/public/lro.operation.spec.ts @@ -21,7 +21,7 @@ describe("Certificates client - LRO - certificate operation", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { const authentication = await authenticate(this); certificateSuffix = authentication.suffix; client = authentication.client; @@ -35,7 +35,7 @@ describe("Certificates client - LRO - certificate operation", () => { // The tests follow - it("can wait until a certificate is created by getting the poller from getCertificateOperation", /** @this */ async function() { + it("can wait until a certificate is created by getting the poller from getCertificateOperation", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName( `${certificatePrefix}-${this!.test!.title}-${certificateSuffix}` ); @@ -64,7 +64,7 @@ describe("Certificates client - LRO - certificate operation", () => { await testClient.flushCertificate(certificateName); }); - it("can resume from a stopped poller", /** @this */ async function() { + it("can resume from a stopped poller", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName( `${certificatePrefix}-${this!.test!.title}-${certificateSuffix}` ); diff --git a/sdk/keyvault/keyvault-certificates/test/public/lro.recover.spec.ts b/sdk/keyvault/keyvault-certificates/test/public/lro.recover.spec.ts index a7e0d74ff1e8..64e36d6c5cee 100644 --- a/sdk/keyvault/keyvault-certificates/test/public/lro.recover.spec.ts +++ b/sdk/keyvault/keyvault-certificates/test/public/lro.recover.spec.ts @@ -18,7 +18,7 @@ describe("Certificates client - LRO - recoverDelete", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { const authentication = await authenticate(this); certificateSuffix = authentication.suffix; client = authentication.client; @@ -32,7 +32,7 @@ describe("Certificates client - LRO - recoverDelete", () => { // The tests follow - it("can wait until a certificate is recovered", /** @this */ async function() { + it("can wait until a certificate is recovered", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName( `${certificatePrefix}-${this!.test!.title}-${certificateSuffix}` ); @@ -65,7 +65,7 @@ describe("Certificates client - LRO - recoverDelete", () => { await testClient.flushCertificate(certificateName); }); - it("can resume from a stopped poller", /** @this */ async function() { + it("can resume from a stopped poller", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName( `${certificatePrefix}-${this!.test!.title}-${certificateSuffix}` ); @@ -112,7 +112,7 @@ describe("Certificates client - LRO - recoverDelete", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can recover a deleted certificate with requestOptions timeout", /** @this */ async function() { + it("can recover a deleted certificate with requestOptions timeout", /** @this Mocha.Context */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const certificateName = testClient.formatName( `${certificatePrefix}-${this!.test!.title}-${certificateSuffix}` diff --git a/sdk/keyvault/keyvault-certificates/test/public/mergeAndImport.spec.ts b/sdk/keyvault/keyvault-certificates/test/public/mergeAndImport.spec.ts index a423f6692dbb..81aac6735be5 100644 --- a/sdk/keyvault/keyvault-certificates/test/public/mergeAndImport.spec.ts +++ b/sdk/keyvault/keyvault-certificates/test/public/mergeAndImport.spec.ts @@ -24,7 +24,7 @@ describe("Certificates client - merge and import certificates", () => { let credential: ClientSecretCredential; let secretClient: SecretClient; - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { const authentication = await authenticate(this); suffix = authentication.suffix; client = authentication.client; @@ -41,7 +41,7 @@ describe("Certificates client - merge and import certificates", () => { // The tests follow - it("can import a certificate from a certificate's non base64 secret value", /** @this */ async function() { + it("can import a certificate from a certificate's non base64 secret value", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); const certificateNames = [`${certificateName}0`, `${certificateName}1`]; const createPoller = await client.beginCreateCertificate( @@ -65,7 +65,7 @@ describe("Certificates client - merge and import certificates", () => { } }); - it("can import a certificate from a certificate's base64 secret value", /** @this */ async function() { + it("can import a certificate from a certificate's base64 secret value", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); const certificateNames = [`${certificateName}0`, `${certificateName}1`]; const createPoller = await client.beginCreateCertificate( @@ -95,7 +95,7 @@ describe("Certificates client - merge and import certificates", () => { // The signed certificate will never be the same, so we can't play it back. // This test is only designed to work on NodeJS, since we use child_process to interact with openssl. - it("can merge a self signed certificate", /** @this */ async function(): Promise { + it("can merge a self signed certificate", /** @this Mocha.Context */ async function(): Promise { recorder.skip( undefined, "The signed certificate will never be the same, so we can't play it back." diff --git a/sdk/keyvault/keyvault-certificates/test/public/recoverBackupRestore.spec.ts b/sdk/keyvault/keyvault-certificates/test/public/recoverBackupRestore.spec.ts index 5c1dad27952c..bbf35d657f74 100644 --- a/sdk/keyvault/keyvault-certificates/test/public/recoverBackupRestore.spec.ts +++ b/sdk/keyvault/keyvault-certificates/test/public/recoverBackupRestore.spec.ts @@ -23,7 +23,7 @@ describe("Certificates client - restore certificates and recover backups", () => subject: "cn=MyCert" }; - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { const authentication = await authenticate(this); suffix = authentication.suffix; client = authentication.client; @@ -37,7 +37,7 @@ describe("Certificates client - restore certificates and recover backups", () => // The tests follow - it("can recover a deleted certificate", /** @this */ async function() { + it("can recover a deleted certificate", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); const createPoller = await client.beginCreateCertificate( certificateName, @@ -65,7 +65,7 @@ describe("Certificates client - restore certificates and recover backups", () => await testClient.flushCertificate(certificateName); }); - it("can recover a deleted certificate (non existing)", /** @this */ async function() { + it("can recover a deleted certificate (non existing)", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); let error; try { @@ -81,7 +81,7 @@ describe("Certificates client - restore certificates and recover backups", () => if (isRecordMode() || isPlaybackMode()) { // This test can't run live, // since the purge operation currently can't be expected to finish anytime soon. - it("can restore a certificate", /** @this */ async function() { + it("can restore a certificate", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); const createPoller = await client.beginCreateCertificate( certificateName, @@ -141,7 +141,7 @@ describe("Certificates client - restore certificates and recover backups", () => if (isNode && !isPlaybackMode()) { // On playback mode, the tests happen too fast for the timeout to work - it("can restore a key with requestOptions timeout", /** @this */ async function() { + it("can restore a key with requestOptions timeout", /** @this Mocha.Context */ async function() { const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); const createPoller = await client.beginCreateCertificate( certificateName, diff --git a/sdk/keyvault/keyvault-keys/test/internal/aesCryptography.spec.ts b/sdk/keyvault/keyvault-keys/test/internal/aesCryptography.spec.ts index 7b6f957e2c1a..20e441ed10bf 100644 --- a/sdk/keyvault/keyvault-keys/test/internal/aesCryptography.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/internal/aesCryptography.spec.ts @@ -19,7 +19,7 @@ import { RemoteCryptographyProvider } from "../../src/cryptography/remoteCryptog import { ClientSecretCredential } from "@azure/identity"; describe("AesCryptographyProvider browser tests", function() { - it("uses the browser replacement when running in the browser", /** @this */ async function() { + it("uses the browser replacement when running in the browser", /** @this Mocha.Context */ async function() { if (isNode) { this.skip(); } @@ -43,7 +43,7 @@ describe("AesCryptographyProvider internal tests", function() { const encryptionAlgorithm = `A${keySize}CBCPAD` as AesCbcEncryptionAlgorithm; let jwk: JsonWebKey; - beforeEach(/** @this */ function() { + beforeEach(/** @this Mocha.Context */ function() { if (!isNode) { this.skip(); } @@ -59,7 +59,7 @@ describe("AesCryptographyProvider internal tests", function() { describe(`AES-CBC with PKCS padding (${keySize})`, () => { describe("local-only tests", async function() { - it("encrypts and decrypts locally", /** @this */ async function() { + it("encrypts and decrypts locally", /** @this Mocha.Context */ async function() { const text = this.test!.title; const encryptResult = await cryptoClient.encrypt({ algorithm: encryptionAlgorithm, @@ -75,7 +75,7 @@ describe("AesCryptographyProvider internal tests", function() { assert.equal(uint8ArrayToString(decryptResult.result), text); }); - it("validates the key type", /** @this */ async function() { + it("validates the key type", /** @this Mocha.Context */ async function() { const text = this.test!.title; jwk.kty = "RSA"; @@ -98,7 +98,7 @@ describe("AesCryptographyProvider internal tests", function() { ); }); - it("validates the key length", /** @this */ async function() { + it("validates the key length", /** @this Mocha.Context */ async function() { const text = this.test!.title; jwk.k = getKey((keySize >> 3) - 1); @@ -132,7 +132,7 @@ describe("AesCryptographyProvider internal tests", function() { let keyVaultKey: KeyVaultKey; let remoteProvider: RemoteCryptographyProvider; - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { const authentication = await authenticate(this); recorder = authentication.recorder; @@ -152,7 +152,7 @@ describe("AesCryptographyProvider internal tests", function() { await recorder.stop(); }); - it("encrypts locally and decrypts remotely", /** @this */ async function() { + it("encrypts locally and decrypts remotely", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this.test!.title}-${keySuffix}`); keyVaultKey = await client.importKey(keyName, jwk, {}); remoteProvider = new RemoteCryptographyProvider(keyVaultKey, credential); @@ -174,7 +174,7 @@ describe("AesCryptographyProvider internal tests", function() { await testClient.flushKey(keyName); }); - it("encrypts remotely and decrypts locally", /** @this */ async function() { + it("encrypts remotely and decrypts locally", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this.test!.title}-${keySuffix}`); keyVaultKey = await client.importKey(keyName, jwk, {}); remoteProvider = new RemoteCryptographyProvider(keyVaultKey, credential); diff --git a/sdk/keyvault/keyvault-keys/test/internal/challengeBasedAuthenticationPolicy.spec.ts b/sdk/keyvault/keyvault-keys/test/internal/challengeBasedAuthenticationPolicy.spec.ts index 37397a355650..4caab673358f 100644 --- a/sdk/keyvault/keyvault-keys/test/internal/challengeBasedAuthenticationPolicy.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/internal/challengeBasedAuthenticationPolicy.spec.ts @@ -26,7 +26,7 @@ describe("Challenge based authentication tests", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { const authentication = await authenticate(this); keySuffix = authentication.keySuffix; client = authentication.client; @@ -40,7 +40,7 @@ describe("Challenge based authentication tests", () => { // The tests follow - it("Authentication should work for parallel requests", /** @this */ async function() { + it("Authentication should work for parallel requests", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const keyNames = [`${keyName}-0`, `${keyName}-1`]; @@ -71,7 +71,7 @@ describe("Challenge based authentication tests", () => { sandbox.restore(); }); - it("Once authenticated, new requests should not authenticate again", /** @this */ async function() { + it("Once authenticated, new requests should not authenticate again", /** @this Mocha.Context */ async function() { // Our goal is to intercept how our pipelines are storing the challenge. // The first network call should indeed set the challenge in memory. // Subsequent network calls should not set new challenges. diff --git a/sdk/keyvault/keyvault-keys/test/internal/crypto.spec.ts b/sdk/keyvault/keyvault-keys/test/internal/crypto.spec.ts index bf97df4bf012..ed0e5f4dbfbf 100644 --- a/sdk/keyvault/keyvault-keys/test/internal/crypto.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/internal/crypto.spec.ts @@ -135,7 +135,7 @@ describe("internal crypto tests", () => { }); describe("Encrypt parameter mapping", async function() { - it("maps parameters correctly when using the previous API", /** @this */ async function() { + it("maps parameters correctly when using the previous API", /** @this Mocha.Context */ async function() { const text = stringToUint8Array(this.test!.title!); await client.encrypt("RSA1_5", text, { requestOptions: { timeout: 5 } }); @@ -146,7 +146,7 @@ describe("internal crypto tests", () => { ); }); - it("maps parameters correctly when using the current API", /** @this */ async function() { + it("maps parameters correctly when using the current API", /** @this Mocha.Context */ async function() { const text = stringToUint8Array(this.test!.title!); await client.encrypt( @@ -163,7 +163,7 @@ describe("internal crypto tests", () => { }); describe("Decrypt parameter mapping", async function() { - it("maps parameters correctly when using the previous API", /** @this */ async function() { + it("maps parameters correctly when using the previous API", /** @this Mocha.Context */ async function() { const text = stringToUint8Array(this.test!.title!); await client.decrypt("RSA1_5", text, { requestOptions: { timeout: 5 } }); @@ -174,7 +174,7 @@ describe("internal crypto tests", () => { ); }); - it("maps parameters correctly when using the current API", /** @this */ async function() { + it("maps parameters correctly when using the current API", /** @this Mocha.Context */ async function() { const text = stringToUint8Array(this.test!.title!); await client.decrypt( @@ -192,7 +192,7 @@ describe("internal crypto tests", () => { }); describe("RSA local cryptography tests", function() { - it("throws a validation error when the key is invalid", /** @this */ function() { + it("throws a validation error when the key is invalid", /** @this Mocha.Context */ function() { if (!isNode) { // Local cryptography is not supported in the browser this.skip(); @@ -204,7 +204,7 @@ describe("internal crypto tests", () => { ); }); - it("uses the browser replacement when running in the browser", /** @this */ function() { + it("uses the browser replacement when running in the browser", /** @this Mocha.Context */ function() { if (isNode) { this.skip(); } diff --git a/sdk/keyvault/keyvault-keys/test/internal/userAgent.spec.ts b/sdk/keyvault/keyvault-keys/test/internal/userAgent.spec.ts index c4583b3176ba..13ea672ba6fe 100644 --- a/sdk/keyvault/keyvault-keys/test/internal/userAgent.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/internal/userAgent.spec.ts @@ -13,7 +13,7 @@ describe("Keys client's user agent (only in Node, because of fs)", () => { assert.equal(SDK_VERSION, packageVersion); }); - it("the version should also match with the one available in the package.json (only in Node, because of fs)", /** @this */ async function() { + it("the version should also match with the one available in the package.json (only in Node, because of fs)", /** @this Mocha.Context */ async function() { if (!isNode) { this.skip(); return; diff --git a/sdk/keyvault/keyvault-keys/test/public/CRUD.hsm.spec.ts b/sdk/keyvault/keyvault-keys/test/public/CRUD.hsm.spec.ts index bacafd27e446..10976beab403 100644 --- a/sdk/keyvault/keyvault-keys/test/public/CRUD.hsm.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/public/CRUD.hsm.spec.ts @@ -16,7 +16,7 @@ describe("Keys client - create, read, update and delete operations for managed H let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { const authentication = await authenticate(this); recorder = authentication.recorder; @@ -35,7 +35,7 @@ describe("Keys client - create, read, update and delete operations for managed H await recorder.stop(); }); - it("can create an OCT key with options", /** @this */ async function() { + it("can create an OCT key with options", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const options: CreateOctKeyOptions = { hsm: true diff --git a/sdk/keyvault/keyvault-keys/test/public/CRUD.spec.ts b/sdk/keyvault/keyvault-keys/test/public/CRUD.spec.ts index 8f67e611136e..eab26f76ad68 100644 --- a/sdk/keyvault/keyvault-keys/test/public/CRUD.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/public/CRUD.spec.ts @@ -24,7 +24,7 @@ describe("Keys client - create, read, update and delete operations", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { const authentication = await authenticate(this); keySuffix = authentication.keySuffix; client = authentication.client; @@ -38,7 +38,7 @@ describe("Keys client - create, read, update and delete operations", () => { // The tests follow - it("can create a key while giving a manual type", /** @this */ async function() { + it("can create a key while giving a manual type", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const result = await client.createKey(keyName, "RSA"); assert.equal(result.name, keyName, "Unexpected key name in result from createKey()."); @@ -46,7 +46,7 @@ describe("Keys client - create, read, update and delete operations", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can abort creating a key", /** @this */ async function() { + it("can abort creating a key", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const controller = new AbortController(); @@ -60,7 +60,7 @@ describe("Keys client - create, read, update and delete operations", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can create a key with requestOptions timeout", /** @this */ async function() { + it("can create a key with requestOptions timeout", /** @this Mocha.Context */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await assertThrowsAbortError(async () => { @@ -88,14 +88,14 @@ describe("Keys client - create, read, update and delete operations", () => { ); }); - it("can create a RSA key", /** @this */ async function() { + it("can create a RSA key", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const result = await client.createRsaKey(keyName); assert.equal(result.name, keyName, "Unexpected key name in result from createKey()."); await testClient.flushKey(keyName); }); - it("can create a RSA key with size", /** @this */ async function() { + it("can create a RSA key with size", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const options = { keySize: 2048 @@ -105,7 +105,7 @@ describe("Keys client - create, read, update and delete operations", () => { await testClient.flushKey(keyName); }); - it("can create a RSA key with public exponent", /** @this */ async function() { + it("can create a RSA key with public exponent", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const options = { publicExponent: 3 @@ -116,7 +116,7 @@ describe("Keys client - create, read, update and delete operations", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can create a RSA key with requestOptions timeout", /** @this */ async function() { + it("can create a RSA key with requestOptions timeout", /** @this Mocha.Context */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); @@ -129,14 +129,14 @@ describe("Keys client - create, read, update and delete operations", () => { }); }); - it("can create an EC key", /** @this */ async function() { + it("can create an EC key", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const result = await client.createEcKey(keyName); assert.equal(result.name, keyName, "Unexpected key name in result from createKey()."); await testClient.flushKey(keyName); }); - it("can create an EC key with curve", /** @this */ async function() { + it("can create an EC key with curve", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const options: CreateEcKeyOptions = { curve: "P-256" @@ -147,7 +147,7 @@ describe("Keys client - create, read, update and delete operations", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can create an EC key with requestOptions timeout", /** @this */ async function() { + it("can create an EC key with requestOptions timeout", /** @this Mocha.Context */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await assertThrowsAbortError(async () => { @@ -159,7 +159,7 @@ describe("Keys client - create, read, update and delete operations", () => { }); }); - it("can create a disabled key", /** @this */ async function() { + it("can create a disabled key", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const options = { enabled: false @@ -169,7 +169,7 @@ describe("Keys client - create, read, update and delete operations", () => { await testClient.flushKey(keyName); }); - it("can create a key with notBefore", /** @this */ async function() { + it("can create a key with notBefore", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const date = new Date("2019-01-01"); const notBefore = new Date(date.getTime() + 5000); // 5 seconds later @@ -187,7 +187,7 @@ describe("Keys client - create, read, update and delete operations", () => { await testClient.flushKey(keyName); }); - it("can create a key with expires", /** @this */ async function() { + it("can create a key with expires", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const date = new Date("2019-01-01"); const expiresOn = new Date(date.getTime() + 5000); // 5 seconds later @@ -205,7 +205,7 @@ describe("Keys client - create, read, update and delete operations", () => { await testClient.flushKey(keyName); }); - it("can update key", /** @this */ async function() { + it("can update key", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const { version } = (await client.createRsaKey(keyName)).properties; const options: UpdateKeyPropertiesOptions = { enabled: false }; @@ -214,7 +214,7 @@ describe("Keys client - create, read, update and delete operations", () => { await testClient.flushKey(keyName); }); - it("can update a disabled key", /** @this */ async function() { + it("can update a disabled key", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const createOptions = { enabled: false @@ -233,7 +233,7 @@ describe("Keys client - create, read, update and delete operations", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can update key with requestOptions timeout", /** @this */ async function() { + it("can update key with requestOptions timeout", /** @this Mocha.Context */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const { version } = (await client.createRsaKey(keyName)).properties; @@ -246,7 +246,7 @@ describe("Keys client - create, read, update and delete operations", () => { }); }); - it("can delete a key", /** @this */ async function() { + it("can delete a key", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await client.createKey(keyName, "RSA"); const poller = await client.beginDeleteKey(keyName, testPollerProperties); @@ -267,7 +267,7 @@ describe("Keys client - create, read, update and delete operations", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can delete a key with requestOptions timeout", /** @this */ async function() { + it("can delete a key with requestOptions timeout", /** @this Mocha.Context */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await client.createKey(keyName, "RSA"); @@ -281,7 +281,7 @@ describe("Keys client - create, read, update and delete operations", () => { }); }); - it("delete nonexisting key", /** @this */ async function() { + it("delete nonexisting key", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); try { await client.getKey(keyName); @@ -296,7 +296,7 @@ describe("Keys client - create, read, update and delete operations", () => { } }); - it("can get a key", /** @this */ async function() { + it("can get a key", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await client.createKey(keyName, "RSA"); const getResult = await client.getKey(keyName); @@ -305,7 +305,7 @@ describe("Keys client - create, read, update and delete operations", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can get a key with requestOptions timeout", /** @this */ async function() { + it("can get a key with requestOptions timeout", /** @this Mocha.Context */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await client.createKey(keyName, "RSA"); @@ -314,7 +314,7 @@ describe("Keys client - create, read, update and delete operations", () => { }); }); - it("can get a specific version of a key", /** @this */ async function() { + it("can get a specific version of a key", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const { version } = (await client.createKey(keyName, "RSA")).properties; const options: GetKeyOptions = { version }; @@ -327,7 +327,7 @@ describe("Keys client - create, read, update and delete operations", () => { await testClient.flushKey(keyName); }); - it("can get a deleted key", /** @this */ async function() { + it("can get a deleted key", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await client.createKey(keyName, "RSA"); const poller = await client.beginDeleteKey(keyName, testPollerProperties); @@ -348,7 +348,7 @@ describe("Keys client - create, read, update and delete operations", () => { await testClient.purgeKey(keyName); }); - it("can't get a deleted key that doesn't exist", /** @this */ async function() { + it("can't get a deleted key that doesn't exist", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); let error; try { @@ -362,7 +362,7 @@ describe("Keys client - create, read, update and delete operations", () => { assert.equal(error.statusCode, 404); }); - it("can purge a deleted key", /** @this */ async function() { + it("can purge a deleted key", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await client.createKey(keyName, "RSA"); const poller = await client.beginDeleteKey(keyName, testPollerProperties); diff --git a/sdk/keyvault/keyvault-keys/test/public/crypto.hsm.spec.ts b/sdk/keyvault/keyvault-keys/test/public/crypto.hsm.spec.ts index a577fa0877a1..6e7f8445c714 100644 --- a/sdk/keyvault/keyvault-keys/test/public/crypto.hsm.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/public/crypto.hsm.spec.ts @@ -20,7 +20,7 @@ describe("CryptographyClient for managed HSM (skipped if MHSM is not deployed)", let keyVaultKey: KeyVaultKey; let keySuffix: string; - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { const authentication = await authenticate(this); recorder = authentication.recorder; @@ -43,7 +43,7 @@ describe("CryptographyClient for managed HSM (skipped if MHSM is not deployed)", }); describe("with AES crypto algorithms", async function() { - it("encrypts and decrypts using AES-GCM", /** @this */ async function() { + it("encrypts and decrypts using AES-GCM", /** @this Mocha.Context */ async function() { keyVaultKey = await hsmClient.createKey(keyName, "AES", { keySize: 256 }); cryptoClient = new CryptographyClient(keyVaultKey.id!, credential); const text = this.test!.title; @@ -63,7 +63,7 @@ describe("CryptographyClient for managed HSM (skipped if MHSM is not deployed)", assert.equal(text, uint8ArrayToString(decryptResult.result)); }); - it("encrypts and decrypts using AES-CBC", /** @this */ async function() { + it("encrypts and decrypts using AES-CBC", /** @this Mocha.Context */ async function() { keyVaultKey = await hsmClient.createKey(keyName, "AES", { keySize: 256 }); cryptoClient = new CryptographyClient(keyVaultKey.id!, credential); const text = this.test!.title; diff --git a/sdk/keyvault/keyvault-keys/test/public/crypto.spec.ts b/sdk/keyvault/keyvault-keys/test/public/crypto.spec.ts index 424745389788..0289eef57bfc 100644 --- a/sdk/keyvault/keyvault-keys/test/public/crypto.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/public/crypto.spec.ts @@ -29,7 +29,7 @@ describe("CryptographyClient (all decrypts happen remotely)", () => { return; } - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { const authentication = await authenticate(this); client = authentication.client; recorder = authentication.recorder; @@ -41,7 +41,7 @@ describe("CryptographyClient (all decrypts happen remotely)", () => { cryptoClient = new CryptographyClient(keyVaultKey.id!, credential); }); - afterEach(/** @this */ async function() { + afterEach(/** @this Mocha.Context */ async function() { if (!this.currentTest?.isPending()) { await testClient.flushKey(keyName); } @@ -51,7 +51,7 @@ describe("CryptographyClient (all decrypts happen remotely)", () => { // The tests follow if (!isPlaybackMode()) { - it("encrypt & decrypt with RSA1_5", /** @this */ async function() { + it("encrypt & decrypt with RSA1_5", /** @this Mocha.Context */ async function() { const text = this.test!.title; const encryptResult = await cryptoClient.encrypt({ algorithm: "RSA1_5", @@ -65,7 +65,7 @@ describe("CryptographyClient (all decrypts happen remotely)", () => { assert.equal(text, decryptedText); }); - it("manually encrypt locally and decrypt remotely, both with RSA1_5", /** @this */ async function() { + it("manually encrypt locally and decrypt remotely, both with RSA1_5", /** @this Mocha.Context */ async function() { const text = this.test!.title; const localProvider = new RsaCryptographyProvider(keyVaultKey.key!); const encryptResult = await localProvider.encrypt({ @@ -80,7 +80,7 @@ describe("CryptographyClient (all decrypts happen remotely)", () => { assert.equal(text, decryptedText); }); - it("encrypt & decrypt with RSA-OAEP", /** @this */ async function() { + it("encrypt & decrypt with RSA-OAEP", /** @this Mocha.Context */ async function() { const text = this.test!.title; const encryptResult = await cryptoClient.encrypt( { @@ -97,7 +97,7 @@ describe("CryptographyClient (all decrypts happen remotely)", () => { assert.equal(text, decryptedText); }); - it("manually encrypt locally and decrypt remotely, both with RSA-OAEP", /** @this */ async function() { + it("manually encrypt locally and decrypt remotely, both with RSA-OAEP", /** @this Mocha.Context */ async function() { const text = this.test!.title; const localProvider = new RsaCryptographyProvider(keyVaultKey.key!); const encryptResult = await localProvider.encrypt({ @@ -112,7 +112,7 @@ describe("CryptographyClient (all decrypts happen remotely)", () => { assert.equal(text, decryptedText); }); - it("the CryptographyClient can be created from a full KeyVaultKey object", /** @this */ async function() { + it("the CryptographyClient can be created from a full KeyVaultKey object", /** @this Mocha.Context */ async function() { const customKeyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const customKeyVaultKey = await client.createKey(customKeyName, "RSA"); const cryptoClientFromKey = new CryptographyClient(customKeyVaultKey, credential); @@ -162,7 +162,7 @@ describe("CryptographyClient (all decrypts happen remotely)", () => { assert.equal("RSA1_5", unwrappedResult.algorithm); }); - it("wrap and unwrap with RSA-OAEP", /** @this */ async function() { + it("wrap and unwrap with RSA-OAEP", /** @this Mocha.Context */ async function() { recorder.skip( undefined, "Wrapping and unwrapping don't cause a repeatable pattern, so these tests can only run in playback mode" @@ -176,7 +176,7 @@ describe("CryptographyClient (all decrypts happen remotely)", () => { }); if (!isPlaybackMode()) { - it("encrypt & decrypt with an RSA-HSM key and the RSA-OAEP algorithm", /** @this */ async function() { + it("encrypt & decrypt with an RSA-HSM key and the RSA-OAEP algorithm", /** @this Mocha.Context */ async function() { const hsmKeyName = keyName + "2"; const hsmKey = await client.createKey(hsmKeyName, "RSA-HSM"); const hsmCryptoClient = new CryptographyClient(hsmKey.id!, credential); @@ -188,7 +188,7 @@ describe("CryptographyClient (all decrypts happen remotely)", () => { await testClient.flushKey(hsmKeyName); }); - it("encrypt & decrypt with an RSA-HSM key and the RSA1_5 algorithm", /** @this */ async function() { + it("encrypt & decrypt with an RSA-HSM key and the RSA1_5 algorithm", /** @this Mocha.Context */ async function() { const hsmKeyName = keyName + "2"; const hsmKey = await client.createKey(hsmKeyName, "RSA-HSM"); const hsmCryptoClient = new CryptographyClient(hsmKey.id!, credential); @@ -201,7 +201,7 @@ describe("CryptographyClient (all decrypts happen remotely)", () => { }); } - it("wrap and unwrap with RSA-OAEP on a RSA-HSM key", /** @this */ async function() { + it("wrap and unwrap with RSA-OAEP on a RSA-HSM key", /** @this Mocha.Context */ async function() { recorder.skip( undefined, "Wrapping and unwrapping don't cause a repeatable pattern, so this test can only run live" @@ -217,7 +217,7 @@ describe("CryptographyClient (all decrypts happen remotely)", () => { await testClient.flushKey(hsmKeyName); }); - it("wrap and unwrap with RSA1_5 on a RSA-HSM key", /** @this */ async function() { + it("wrap and unwrap with RSA1_5 on a RSA-HSM key", /** @this Mocha.Context */ async function() { recorder.skip( undefined, "Wrapping and unwrapping don't cause a repeatable pattern, so this test can only run live" @@ -233,7 +233,7 @@ describe("CryptographyClient (all decrypts happen remotely)", () => { await testClient.flushKey(hsmKeyName); }); - it("sign and verify with RS256 through an RSA-HSM key", /** @this */ async function(): Promise { + it("sign and verify with RS256 through an RSA-HSM key", /** @this Mocha.Context */ async function(): Promise { const hsmKeyName = keyName + "2"; const hsmKey = await client.createKey(hsmKeyName, "RSA-HSM"); const hsmCryptoClient = new CryptographyClient(hsmKey.id!, credential); @@ -264,7 +264,7 @@ describe("CryptographyClient (all decrypts happen remotely)", () => { await testClient.flushKey(hsmKeyName); }); - it("sign and verify with RS384 through an RSA-HSM key", /** @this */ async function(): Promise { + it("sign and verify with RS384 through an RSA-HSM key", /** @this Mocha.Context */ async function(): Promise { const hsmKeyName = keyName + "2"; const hsmKey = await client.createKey(hsmKeyName, "RSA-HSM"); const hsmCryptoClient = new CryptographyClient(hsmKey.id!, credential); diff --git a/sdk/keyvault/keyvault-keys/test/public/import.spec.ts b/sdk/keyvault/keyvault-keys/test/public/import.spec.ts index 94dfe4da58d4..3c268beb9c5d 100644 --- a/sdk/keyvault/keyvault-keys/test/public/import.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/public/import.spec.ts @@ -16,7 +16,7 @@ describe("Keys client - import keys", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { const authentication = await authenticate(this); suffix = authentication.keySuffix; client = authentication.client; @@ -30,7 +30,7 @@ describe("Keys client - import keys", () => { // The tests follow - it("can import a key", /** @this */ async function() { + it("can import a key", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`); function toBytes(hex: string): Uint8Array { if (hex.length % 2) { diff --git a/sdk/keyvault/keyvault-keys/test/public/list.spec.ts b/sdk/keyvault/keyvault-keys/test/public/list.spec.ts index 9bdefa3da8bc..52b1283c3509 100644 --- a/sdk/keyvault/keyvault-keys/test/public/list.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/public/list.spec.ts @@ -20,7 +20,7 @@ versionsToTest(serviceApiVersions, {}, (serviceVersion, onVersions) => { let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { const authentication = await authenticate(this, serviceVersion); keySuffix = authentication.keySuffix; client = authentication.client; @@ -37,7 +37,7 @@ versionsToTest(serviceApiVersions, {}, (serviceVersion, onVersions) => { // Use this while recording to make sure the target keyvault is clean. // The next tests will produce a more consistent output. // This test is only useful while developing locally. - it("can purge all keys", /** @this */ async function(): Promise { + it("can purge all keys", /** @this Mocha.Context */ async function(): Promise { // WARNING: When TEST_MODE equals "record", all of the keys in the indicated KEYVAULT_URI will be deleted as part of this test. if (!isRecordMode()) { return this.skip(); @@ -58,7 +58,7 @@ versionsToTest(serviceApiVersions, {}, (serviceVersion, onVersions) => { } }); - it("can get the versions of a key", /** @this */ async function() { + it("can get the versions of a key", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await client.createKey(keyName, "RSA"); let totalVersions = 0; @@ -85,7 +85,7 @@ versionsToTest(serviceApiVersions, {}, (serviceVersion, onVersions) => { }); }); - it("can get the versions of a key (paged)", /** @this */ async function() { + it("can get the versions of a key (paged)", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await client.createKey(keyName, "RSA"); let totalVersions = 0; @@ -103,7 +103,7 @@ versionsToTest(serviceApiVersions, {}, (serviceVersion, onVersions) => { await testClient.flushKey(keyName); }); - it("list 0 versions of a non-existing key", /** @this */ async function() { + it("list 0 versions of a non-existing key", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); let totalVersions = 0; for await (const version of client.listPropertiesOfKeyVersions(keyName)) { @@ -117,7 +117,7 @@ versionsToTest(serviceApiVersions, {}, (serviceVersion, onVersions) => { assert.equal(totalVersions, 0, `Unexpected total versions for key ${keyName}`); }); - it("list 0 versions of a non-existing key (paged)", /** @this */ async function() { + it("list 0 versions of a non-existing key (paged)", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); let totalVersions = 0; for await (const page of client.listPropertiesOfKeyVersions(keyName).byPage()) { @@ -133,7 +133,7 @@ versionsToTest(serviceApiVersions, {}, (serviceVersion, onVersions) => { assert.equal(totalVersions, 0, `Unexpected total versions for key ${keyName}`); }); - it("can get several inserted keys", /** @this */ async function() { + it("can get several inserted keys", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const keyNames = [`${keyName}-0`, `${keyName}-1`]; for (const name of keyNames) { @@ -164,7 +164,7 @@ versionsToTest(serviceApiVersions, {}, (serviceVersion, onVersions) => { }); }); - it("can get several inserted keys (paged)", /** @this */ async function() { + it("can get several inserted keys (paged)", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const keyNames = [`${keyName}-0`, `${keyName}-1`]; for (const name of keyNames) { @@ -187,7 +187,7 @@ versionsToTest(serviceApiVersions, {}, (serviceVersion, onVersions) => { } }); - it("list deleted keys", /** @this */ async function() { + it("list deleted keys", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const keyNames = [`${keyName}-0`, `${keyName}-1`]; for (const name of keyNames) { @@ -221,7 +221,7 @@ versionsToTest(serviceApiVersions, {}, (serviceVersion, onVersions) => { }); }); - it("list deleted keys (paged)", /** @this */ async function() { + it("list deleted keys (paged)", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const keyNames = [`${keyName}-0`, `${keyName}-1`]; for (const name of keyNames) { diff --git a/sdk/keyvault/keyvault-keys/test/public/localCryptography.spec.ts b/sdk/keyvault/keyvault-keys/test/public/localCryptography.spec.ts index 1a84cf301ff2..8aa92dd29cbc 100644 --- a/sdk/keyvault/keyvault-keys/test/public/localCryptography.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/public/localCryptography.spec.ts @@ -33,7 +33,7 @@ describe("Local cryptography public tests", () => { return; } - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { const authentication = await authenticate(this); client = authentication.client; recorder = authentication.recorder; @@ -51,7 +51,7 @@ describe("Local cryptography public tests", () => { let customKeyVaultKey: KeyVaultKey; let cryptoClientFromKey: CryptographyClient; - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { customKeyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); customKeyVaultKey = await client.createKey(customKeyName, "RSA"); cryptoClientFromKey = new CryptographyClient(customKeyVaultKey.key!); @@ -123,7 +123,7 @@ describe("Local cryptography public tests", () => { }); }); - it("encrypt & decrypt RSA1_5", /** @this */ async function() { + it("encrypt & decrypt RSA1_5", /** @this Mocha.Context */ async function() { recorder.skip(undefined, "Local encryption can't be tested on playback"); const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const keyVaultKey = await client.createKey(keyName, "RSA"); @@ -137,7 +137,7 @@ describe("Local cryptography public tests", () => { await testClient.flushKey(keyName); }); - it("encrypt & decrypt RSA-OAEP", /** @this */ async function() { + it("encrypt & decrypt RSA-OAEP", /** @this Mocha.Context */ async function() { recorder.skip(undefined, "Local encryption can't be tested on playback"); const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const keyVaultKey = await client.createKey(keyName, "RSA"); @@ -151,7 +151,7 @@ describe("Local cryptography public tests", () => { await testClient.flushKey(keyName); }); - it("wrapKey & unwrapKey RSA1_5", /** @this */ async function() { + it("wrapKey & unwrapKey RSA1_5", /** @this Mocha.Context */ async function() { recorder.skip(undefined, "Local encryption can't be tested on playback"); const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const keyVaultKey = await client.createKey(keyName, "RSA"); @@ -168,7 +168,7 @@ describe("Local cryptography public tests", () => { await testClient.flushKey(keyName); }); - it("wrapKey & unwrapKey RSA-OAEP", /** @this */ async function() { + it("wrapKey & unwrapKey RSA-OAEP", /** @this Mocha.Context */ async function() { recorder.skip(undefined, "Local encryption can't be tested on playback"); const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); const keyVaultKey = await client.createKey(keyName, "RSA"); @@ -190,7 +190,7 @@ describe("Local cryptography public tests", () => { const localSupportedAlgorithmNames = Object.keys(rsaProvider.signatureAlgorithmToHashAlgorithm); for (const localAlgorithmName of localSupportedAlgorithmNames) { - it(localAlgorithmName, /** @this */ async function(): Promise { + it(localAlgorithmName, /** @this Mocha.Context */ async function(): Promise { recorder.skip( "browser", `Local sign of algorithm ${localAlgorithmName} is only supported in NodeJS` diff --git a/sdk/keyvault/keyvault-keys/test/public/lro.delete.spec.ts b/sdk/keyvault/keyvault-keys/test/public/lro.delete.spec.ts index 2ad1daa9e276..b0ecf505af6d 100644 --- a/sdk/keyvault/keyvault-keys/test/public/lro.delete.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/public/lro.delete.spec.ts @@ -17,7 +17,7 @@ describe("Keys client - Long Running Operations - delete", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { const authentication = await authenticate(this); keySuffix = authentication.keySuffix; client = authentication.client; @@ -31,7 +31,7 @@ describe("Keys client - Long Running Operations - delete", () => { // The tests follow - it("can wait until a key is deleted", /** @this */ async function() { + it("can wait until a key is deleted", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await client.createKey(keyName, "RSA"); const poller = await client.beginDeleteKey(keyName, testPollerProperties); @@ -50,7 +50,7 @@ describe("Keys client - Long Running Operations - delete", () => { await testClient.purgeKey(keyName); }); - it("can resume from a stopped poller", /** @this */ async function() { + it("can resume from a stopped poller", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await client.createKey(keyName, "RSA"); const poller = await client.beginDeleteKey(keyName, testPollerProperties); diff --git a/sdk/keyvault/keyvault-keys/test/public/lro.recoverDelete.spec.ts b/sdk/keyvault/keyvault-keys/test/public/lro.recoverDelete.spec.ts index 92c486317827..e190055e3a4c 100644 --- a/sdk/keyvault/keyvault-keys/test/public/lro.recoverDelete.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/public/lro.recoverDelete.spec.ts @@ -18,7 +18,7 @@ describe("Keys client - Long Running Operations - recoverDelete", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { const authentication = await authenticate(this); keySuffix = authentication.keySuffix; client = authentication.client; @@ -32,7 +32,7 @@ describe("Keys client - Long Running Operations - recoverDelete", () => { // The tests follow - it("can wait until a key is recovered", /** @this */ async function() { + it("can wait until a key is recovered", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await client.createKey(keyName, "RSA"); @@ -55,7 +55,7 @@ describe("Keys client - Long Running Operations - recoverDelete", () => { await testClient.flushKey(keyName); }); - it("can resume from a stopped poller", /** @this */ async function() { + it("can resume from a stopped poller", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await client.createKey(keyName, "RSA"); const deletePoller = await client.beginDeleteKey(keyName, testPollerProperties); @@ -92,7 +92,7 @@ describe("Keys client - Long Running Operations - recoverDelete", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can recover a deleted key with requestOptions timeout", /** @this */ async function() { + it("can recover a deleted key with requestOptions timeout", /** @this Mocha.Context */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await client.createKey(keyName, "RSA"); diff --git a/sdk/keyvault/keyvault-keys/test/public/recoverBackupRestore.spec.ts b/sdk/keyvault/keyvault-keys/test/public/recoverBackupRestore.spec.ts index 40c9ba49008b..6f8f1dd27ec5 100644 --- a/sdk/keyvault/keyvault-keys/test/public/recoverBackupRestore.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/public/recoverBackupRestore.spec.ts @@ -17,7 +17,7 @@ describe("Keys client - restore keys and recover backups", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { const authentication = await authenticate(this); keySuffix = authentication.keySuffix; client = authentication.client; @@ -31,7 +31,7 @@ describe("Keys client - restore keys and recover backups", () => { // The tests follow - it("can recover a deleted key", /** @this */ async function() { + it("can recover a deleted key", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await client.createKey(keyName, "RSA"); const deletePoller = await client.beginDeleteKey(keyName, testPollerProperties); @@ -52,7 +52,7 @@ describe("Keys client - restore keys and recover backups", () => { await testClient.flushKey(keyName); }); - it("fails if one tries to recover a non-existing deleted key", /** @this */ async function() { + it("fails if one tries to recover a non-existing deleted key", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); let error; try { @@ -66,7 +66,7 @@ describe("Keys client - restore keys and recover backups", () => { assert.equal(error.statusCode, 404); }); - it("can generate a backup of a key", /** @this */ async function() { + it("can generate a backup of a key", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await client.createKey(keyName, "RSA"); const result = await client.backupKey(keyName); @@ -87,7 +87,7 @@ describe("Keys client - restore keys and recover backups", () => { }); }); - it("fails to generate a backup of a non-existing key", /** @this */ async function() { + it("fails to generate a backup of a non-existing key", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); let error; try { @@ -103,7 +103,7 @@ describe("Keys client - restore keys and recover backups", () => { if (isRecordMode() || isPlaybackMode()) { // This test can't run live, // since the purge operation currently can't be expected to finish anytime soon. - it("can restore a key with a given backup", /** @this */ async function() { + it("can restore a key with a given backup", /** @this Mocha.Context */ async function() { const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await client.createKey(keyName, "RSA"); const backup = await client.backupKey(keyName); @@ -126,7 +126,7 @@ describe("Keys client - restore keys and recover backups", () => { } // On playback mode, the tests happen too fast for the timeout to work - it("can restore a key with requestOptions timeout", /** @this */ async function() { + it("can restore a key with requestOptions timeout", /** @this Mocha.Context */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); await client.createKey(keyName, "RSA"); diff --git a/sdk/keyvault/keyvault-secrets/test/internal/challengeBasedAuthenticationPolicy.spec.ts b/sdk/keyvault/keyvault-secrets/test/internal/challengeBasedAuthenticationPolicy.spec.ts index cace21516386..dd319054d663 100644 --- a/sdk/keyvault/keyvault-secrets/test/internal/challengeBasedAuthenticationPolicy.spec.ts +++ b/sdk/keyvault/keyvault-secrets/test/internal/challengeBasedAuthenticationPolicy.spec.ts @@ -26,7 +26,7 @@ describe("Challenge based authentication tests", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { const authentication = await authenticate(this); secretSuffix = authentication.secretSuffix; client = authentication.client; @@ -40,7 +40,7 @@ describe("Challenge based authentication tests", () => { // The tests follow - it("Authentication should work for parallel requests", /** @this */ async function() { + it("Authentication should work for parallel requests", /** @this Mocha.Context */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -73,7 +73,7 @@ describe("Challenge based authentication tests", () => { sandbox.restore(); }); - it("Once authenticated, new requests should not authenticate again", /** @this */ async function() { + it("Once authenticated, new requests should not authenticate again", /** @this Mocha.Context */ async function() { // Our goal is to intercept how our pipelines are storing the challenge. // The first network call should indeed set the challenge in memory. // Subsequent network calls should not set new challenges. diff --git a/sdk/keyvault/keyvault-secrets/test/internal/userAgent.spec.ts b/sdk/keyvault/keyvault-secrets/test/internal/userAgent.spec.ts index 6f3788fb2c07..a2f06913dcc9 100644 --- a/sdk/keyvault/keyvault-secrets/test/internal/userAgent.spec.ts +++ b/sdk/keyvault/keyvault-secrets/test/internal/userAgent.spec.ts @@ -13,7 +13,7 @@ describe("Secrets client's user agent (only in Node, because of fs)", () => { assert.equal(SDK_VERSION, packageVersion); }); - it("the version should also match with the one available in the package.json (only in Node, because of fs)", /** @this */ async function() { + it("the version should also match with the one available in the package.json (only in Node, because of fs)", /** @this Mocha.Context */ async function() { if (!isNode) { this.skip(); return; diff --git a/sdk/keyvault/keyvault-secrets/test/public/CRUD.spec.ts b/sdk/keyvault/keyvault-secrets/test/public/CRUD.spec.ts index e98e47926894..fb487c855daa 100644 --- a/sdk/keyvault/keyvault-secrets/test/public/CRUD.spec.ts +++ b/sdk/keyvault/keyvault-secrets/test/public/CRUD.spec.ts @@ -19,7 +19,7 @@ describe("Secret client - create, read, update and delete operations", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { const authentication = await authenticate(this); secretSuffix = authentication.secretSuffix; client = authentication.client; @@ -33,7 +33,7 @@ describe("Secret client - create, read, update and delete operations", () => { // The tests follow - it("can add a secret", /** @this */ async function() { + it("can add a secret", /** @this Mocha.Context */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -45,7 +45,7 @@ describe("Secret client - create, read, update and delete operations", () => { // If this test is not skipped in the browser's playback, no other test will be played back. // This is a bug related to the browser features of the recorder. - it("can abort adding a secret", /** @this */ async function() { + it("can abort adding a secret", /** @this Mocha.Context */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -59,7 +59,7 @@ describe("Secret client - create, read, update and delete operations", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can timeout adding a secret", /** @this */ async function() { + it("can timeout adding a secret", /** @this Mocha.Context */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` @@ -89,7 +89,7 @@ describe("Secret client - create, read, update and delete operations", () => { ); }); - it("can set a secret with Empty Value", /** @this */ async function() { + it("can set a secret with Empty Value", /** @this Mocha.Context */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -104,7 +104,7 @@ describe("Secret client - create, read, update and delete operations", () => { await testClient.flushSecret(secretName); }); - it("can set a secret with attributes", /** @this */ async function() { + it("can set a secret with attributes", /** @this Mocha.Context */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -120,7 +120,7 @@ describe("Secret client - create, read, update and delete operations", () => { await testClient.flushSecret(secretName); }); - it("can update a secret", /** @this */ async function() { + it("can update a secret", /** @this Mocha.Context */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -142,7 +142,7 @@ describe("Secret client - create, read, update and delete operations", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can timeout updating a secret", /** @this */ async function() { + it("can timeout updating a secret", /** @this Mocha.Context */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` @@ -161,7 +161,7 @@ describe("Secret client - create, read, update and delete operations", () => { }); }); - it("can update a disabled secret", /** @this */ async function() { + it("can update a disabled secret", /** @this Mocha.Context */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -182,7 +182,7 @@ describe("Secret client - create, read, update and delete operations", () => { await testClient.flushSecret(secretName); }); - it("can get a secret", /** @this */ async function() { + it("can get a secret", /** @this Mocha.Context */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -194,7 +194,7 @@ describe("Secret client - create, read, update and delete operations", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can timeout getting a secret", /** @this */ async function() { + it("can timeout getting a secret", /** @this Mocha.Context */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` @@ -209,7 +209,7 @@ describe("Secret client - create, read, update and delete operations", () => { }); }); - it("can't get a disabled secret", /** @this */ async function() { + it("can't get a disabled secret", /** @this Mocha.Context */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -234,7 +234,7 @@ describe("Secret client - create, read, update and delete operations", () => { await testClient.flushSecret(secretName); }); - it("can retrieve the latest version of a secret value", /** @this */ async function() { + it("can retrieve the latest version of a secret value", /** @this Mocha.Context */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -247,7 +247,7 @@ describe("Secret client - create, read, update and delete operations", () => { await testClient.flushSecret(secretName); }); - it("can get a secret (Non Existing)", /** @this */ async function() { + it("can get a secret (Non Existing)", /** @this Mocha.Context */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -262,7 +262,7 @@ describe("Secret client - create, read, update and delete operations", () => { assert.equal(error.statusCode, 404); }); - it("can delete a secret", /** @this */ async function() { + it("can delete a secret", /** @this Mocha.Context */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -293,7 +293,7 @@ describe("Secret client - create, read, update and delete operations", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can timeout deleting a secret", /** @this */ async function() { + it("can timeout deleting a secret", /** @this Mocha.Context */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` @@ -309,7 +309,7 @@ describe("Secret client - create, read, update and delete operations", () => { }); }); - it("can delete a secret (Non Existing)", /** @this */ async function() { + it("can delete a secret (Non Existing)", /** @this Mocha.Context */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -324,7 +324,7 @@ describe("Secret client - create, read, update and delete operations", () => { assert.equal(error.statusCode, 404); }); - it("can get a deleted secret", /** @this */ async function() { + it("can get a deleted secret", /** @this Mocha.Context */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -351,7 +351,7 @@ describe("Secret client - create, read, update and delete operations", () => { await testClient.purgeSecret(secretName); }); - it("can get a deleted secret (Non Existing)", /** @this */ async function() { + it("can get a deleted secret (Non Existing)", /** @this Mocha.Context */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); diff --git a/sdk/keyvault/keyvault-secrets/test/public/list.spec.ts b/sdk/keyvault/keyvault-secrets/test/public/list.spec.ts index 7340287e4b5a..7b22b1c8a56a 100644 --- a/sdk/keyvault/keyvault-secrets/test/public/list.spec.ts +++ b/sdk/keyvault/keyvault-secrets/test/public/list.spec.ts @@ -21,7 +21,7 @@ describe("Secret client - list secrets in various ways", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { const authentication = await authenticate(this); secretSuffix = authentication.secretSuffix; client = authentication.client; @@ -38,7 +38,7 @@ describe("Secret client - list secrets in various ways", () => { // Use this while recording to make sure the target keyvault is clean. // The next tests will produce a more consistent output. // This test is only useful while developing locally. - it("can purge all secrets", /** @this */ async function(): Promise { + it("can purge all secrets", /** @this Mocha.Context */ async function(): Promise { // WARNING: When TEST_MODE equals "record", all of the secrets in the indicated KEYVAULT_URI will be deleted as part of this test. if (!isRecordMode()) { return this.skip(); @@ -59,7 +59,7 @@ describe("Secret client - list secrets in various ways", () => { } }); - it("can list secret properties", /** @this */ async function() { + it("can list secret properties", /** @this Mocha.Context */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -83,7 +83,7 @@ describe("Secret client - list secrets in various ways", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can get secret properties with requestOptions timeout", /** @this */ async function() { + it("can get secret properties with requestOptions timeout", /** @this Mocha.Context */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const iter = client.listPropertiesOfSecrets({ requestOptions: { timeout: 1 } @@ -93,7 +93,7 @@ describe("Secret client - list secrets in various ways", () => { }); }); - it("can list deleted secrets", /** @this */ async function() { + it("can list deleted secrets", /** @this Mocha.Context */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -132,7 +132,7 @@ describe("Secret client - list secrets in various ways", () => { }); }); - it("can retrieve all versions of a secret", /** @this */ async function() { + it("can retrieve all versions of a secret", /** @this Mocha.Context */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` @@ -175,7 +175,7 @@ describe("Secret client - list secrets in various ways", () => { }); }); - it("can list secret versions (non existing)", /** @this */ async function() { + it("can list secret versions (non existing)", /** @this Mocha.Context */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -191,7 +191,7 @@ describe("Secret client - list secrets in various ways", () => { assert.equal(totalVersions, 0, `Unexpected total versions for secret ${secretName}`); }); - it("can list secrets by page", /** @this */ async function() { + it("can list secrets by page", /** @this Mocha.Context */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -213,7 +213,7 @@ describe("Secret client - list secrets in various ways", () => { } }); - it("can list deleted secrets by page", /** @this */ async function() { + it("can list deleted secrets by page", /** @this Mocha.Context */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -240,7 +240,7 @@ describe("Secret client - list secrets in various ways", () => { } }); - it("can retrieve all versions of a secret by page", /** @this */ async function() { + it("can retrieve all versions of a secret by page", /** @this Mocha.Context */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -273,7 +273,7 @@ describe("Secret client - list secrets in various ways", () => { await testClient.flushSecret(secretName); }); - it("can list secret versions by page (non existing)", /** @this */ async function() { + it("can list secret versions by page (non existing)", /** @this Mocha.Context */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); diff --git a/sdk/keyvault/keyvault-secrets/test/public/lro.delete.spec.ts b/sdk/keyvault/keyvault-secrets/test/public/lro.delete.spec.ts index efb438535b22..259b60cfff41 100644 --- a/sdk/keyvault/keyvault-secrets/test/public/lro.delete.spec.ts +++ b/sdk/keyvault/keyvault-secrets/test/public/lro.delete.spec.ts @@ -18,7 +18,7 @@ describe("Secrets client - Long Running Operations - delete", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { const authentication = await authenticate(this); secretSuffix = authentication.secretSuffix; client = authentication.client; @@ -32,7 +32,7 @@ describe("Secrets client - Long Running Operations - delete", () => { // The tests follow - it("can wait until a secret is deleted", /** @this */ async function() { + it("can wait until a secret is deleted", /** @this Mocha.Context */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -53,7 +53,7 @@ describe("Secrets client - Long Running Operations - delete", () => { await testClient.purgeSecret(secretName); }); - it("can resume from a stopped poller", /** @this */ async function() { + it("can resume from a stopped poller", /** @this Mocha.Context */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -87,7 +87,7 @@ describe("Secrets client - Long Running Operations - delete", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can attempt to delete a secret with requestOptions timeout", /** @this */ async function() { + it("can attempt to delete a secret with requestOptions timeout", /** @this Mocha.Context */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` diff --git a/sdk/keyvault/keyvault-secrets/test/public/lro.recover.spec.ts b/sdk/keyvault/keyvault-secrets/test/public/lro.recover.spec.ts index 8ea8bbb7ba43..fc4f011cb498 100644 --- a/sdk/keyvault/keyvault-secrets/test/public/lro.recover.spec.ts +++ b/sdk/keyvault/keyvault-secrets/test/public/lro.recover.spec.ts @@ -18,7 +18,7 @@ describe("Secrets client - Long Running Operations - recoverDelete", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { const authentication = await authenticate(this); secretSuffix = authentication.secretSuffix; client = authentication.client; @@ -32,7 +32,7 @@ describe("Secrets client - Long Running Operations - recoverDelete", () => { // The tests follow - it("can wait until a secret is recovered", /** @this */ async function() { + it("can wait until a secret is recovered", /** @this Mocha.Context */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -57,7 +57,7 @@ describe("Secrets client - Long Running Operations - recoverDelete", () => { await testClient.flushSecret(secretName); }); - it("can resume from a stopped poller", /** @this */ async function() { + it("can resume from a stopped poller", /** @this Mocha.Context */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -96,7 +96,7 @@ describe("Secrets client - Long Running Operations - recoverDelete", () => { }); // On playback mode, the tests happen too fast for the timeout to work - it("can attempt to recover a deleted secret with requestOptions timeout", /** @this */ async function() { + it("can attempt to recover a deleted secret with requestOptions timeout", /** @this Mocha.Context */ async function() { recorder.skip(undefined, "Timeout tests don't work on playback mode."); const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` diff --git a/sdk/keyvault/keyvault-secrets/test/public/recoverBackupRestore.spec.ts b/sdk/keyvault/keyvault-secrets/test/public/recoverBackupRestore.spec.ts index 38fb09f254d0..c9b09465aeb4 100644 --- a/sdk/keyvault/keyvault-secrets/test/public/recoverBackupRestore.spec.ts +++ b/sdk/keyvault/keyvault-secrets/test/public/recoverBackupRestore.spec.ts @@ -18,7 +18,7 @@ describe("Secret client - restore secrets and recover backups", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { const authentication = await authenticate(this); secretSuffix = authentication.secretSuffix; client = authentication.client; @@ -32,7 +32,7 @@ describe("Secret client - restore secrets and recover backups", () => { // The tests follow - it("can recover a deleted secret", /** @this */ async function() { + it("can recover a deleted secret", /** @this Mocha.Context */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -62,7 +62,7 @@ describe("Secret client - restore secrets and recover backups", () => { await testClient.flushSecret(secretName); }); - it("can recover a deleted secret (non existing)", /** @this */ async function() { + it("can recover a deleted secret (non existing)", /** @this Mocha.Context */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -83,7 +83,7 @@ describe("Secret client - restore secrets and recover backups", () => { if (isNode && !isPlaybackMode()) { // On playback mode, the tests happen too fast for the timeout to work - it("can recover a deleted a secret with requestOptions timeout", /** @this */ async function() { + it("can recover a deleted a secret with requestOptions timeout", /** @this Mocha.Context */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -101,7 +101,7 @@ describe("Secret client - restore secrets and recover backups", () => { }); } - it("can backup a secret", /** @this */ async function() { + it("can backup a secret", /** @this Mocha.Context */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -119,7 +119,7 @@ describe("Secret client - restore secrets and recover backups", () => { await testClient.flushSecret(secretName); }); - it("can backup a secret (non existing)", /** @this */ async function() { + it("can backup a secret (non existing)", /** @this Mocha.Context */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -137,7 +137,7 @@ describe("Secret client - restore secrets and recover backups", () => { if (isRecordMode() || isPlaybackMode()) { // This test can't run live, // since the purge operation currently can't be expected to finish anytime soon. - it("can restore a secret", /** @this */ async function() { + it("can restore a secret", /** @this Mocha.Context */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); @@ -182,7 +182,7 @@ describe("Secret client - restore secrets and recover backups", () => { if (isNode && !isPlaybackMode()) { // On playback mode, the tests happen too fast for the timeout to work - it("can timeout deleting a secret", /** @this */ async function() { + it("can timeout deleting a secret", /** @this Mocha.Context */ async function() { const secretName = testClient.formatName( `${secretPrefix}-${this!.test!.title}-${secretSuffix}` ); diff --git a/sdk/metricsadvisor/ai-metrics-advisor/test/public/adminclient.spec.ts b/sdk/metricsadvisor/ai-metrics-advisor/test/public/adminclient.spec.ts index 1204cc5c72ee..5270921af0dd 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/test/public/adminclient.spec.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/test/public/adminclient.spec.ts @@ -19,7 +19,7 @@ matrix([[true, false]] as const, async (useAad) => { let client: MetricsAdvisorAdministrationClient; let recorder: Recorder; - beforeEach(/** @this */ function() { + beforeEach(/** @this Mocha.Context */ function() { ({ recorder, client } = createRecordedAdminClient(this, makeCredential(useAad))); }); @@ -77,7 +77,7 @@ matrix([[true, false]] as const, async (useAad) => { assert.ok(result.latestActiveTimestamp, "Expecting valid latest active timestamp"); }); - it("refreshes ingesetion status", /** @this */ async function() { + it("refreshes ingesetion status", /** @this Mocha.Context */ async function() { const iterator = client.listDataFeedIngestionStatus( testEnv.METRICS_ADVISOR_AZURE_SQLSERVER_DATAFEED_ID, new Date(Date.UTC(2020, 7, 22)), @@ -366,7 +366,7 @@ matrix([[true, false]] as const, async (useAad) => { } }); - it("deletes an alert configuration", /** @this */ async function() { + it("deletes an alert configuration", /** @this Mocha.Context */ async function() { if (!createdAlertConfigId) { this.skip(); } @@ -380,7 +380,7 @@ matrix([[true, false]] as const, async (useAad) => { } }); - it("deletes a detection configuration", /** @this */ async function() { + it("deletes a detection configuration", /** @this Mocha.Context */ async function() { if (!createdDetectionConfigId) { this.skip(); } diff --git a/sdk/metricsadvisor/ai-metrics-advisor/test/public/advisorclient.spec.ts b/sdk/metricsadvisor/ai-metrics-advisor/test/public/advisorclient.spec.ts index eaa02ba6fced..b91bde30857f 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/test/public/advisorclient.spec.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/test/public/advisorclient.spec.ts @@ -20,7 +20,7 @@ matrix([[true, false]] as const, async (useAad) => { let client: MetricsAdvisorClient; let recorder: Recorder; - beforeEach(/** @this */ function() { + beforeEach(/** @this Mocha.Context */ function() { ({ recorder, client } = createRecordedAdvisorClient(this, makeCredential(useAad))); }); diff --git a/sdk/metricsadvisor/ai-metrics-advisor/test/public/datafeed.spec.ts b/sdk/metricsadvisor/ai-metrics-advisor/test/public/datafeed.spec.ts index b4b220762ba5..e6f680b4fe2a 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/test/public/datafeed.spec.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/test/public/datafeed.spec.ts @@ -36,7 +36,7 @@ matrix([[true, false]] as const, async (useAad) => { let mySqlFeedName: string; let postgreSqlFeedName: string; - beforeEach(/** @this */ function() { + beforeEach(/** @this Mocha.Context */ function() { ({ recorder, client } = createRecordedAdminClient(this, makeCredential(useAad))); if (recorder && !feedName) { feedName = recorder.getUniqueName("js-test-datafeed-"); @@ -232,7 +232,7 @@ matrix([[true, false]] as const, async (useAad) => { } }); - it("retrieves an Azure Blob datafeed", /** @this */ async function() { + it("retrieves an Azure Blob datafeed", /** @this Mocha.Context */ async function() { // accessing environment variables here so they are already replaced by test env ones const expectedSource: DataFeedSource = { dataSourceType: "AzureBlob", @@ -271,7 +271,7 @@ matrix([[true, false]] as const, async (useAad) => { ); }); - it("updates an Azure Blob datafeed", /** @this */ async function() { + it("updates an Azure Blob datafeed", /** @this Mocha.Context */ async function() { if (!createdAzureBlobDataFeedId) { this.skip(); } diff --git a/sdk/metricsadvisor/ai-metrics-advisor/test/public/hookTests.spec.ts b/sdk/metricsadvisor/ai-metrics-advisor/test/public/hookTests.spec.ts index 9ca66db3f649..2439026701a8 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/test/public/hookTests.spec.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/test/public/hookTests.spec.ts @@ -24,7 +24,7 @@ matrix([[true, false]] as const, async (useAad) => { let emailHookName: string; let webHookName: string; - beforeEach(/** @this */ function() { + beforeEach(/** @this Mocha.Context */ function() { ({ recorder, client } = createRecordedAdminClient(this, makeCredential(useAad))); if (recorder && !emailHookName) { emailHookName = recorder.getUniqueName("js-test-emailHook-"); diff --git a/sdk/mixedreality/mixedreality-authentication/test/mixedRealityStsClient.spec.ts b/sdk/mixedreality/mixedreality-authentication/test/mixedRealityStsClient.spec.ts index 66c47c9bcc7a..0c4a32e235de 100644 --- a/sdk/mixedreality/mixedreality-authentication/test/mixedRealityStsClient.spec.ts +++ b/sdk/mixedreality/mixedreality-authentication/test/mixedRealityStsClient.spec.ts @@ -77,7 +77,7 @@ describe("[AccountKey] MixedRealityStsClient functional tests", function() { let client: MixedRealityStsClient; let recorder: Recorder; - beforeEach(/** @this */ function() { + beforeEach(/** @this Mocha.Context */ function() { recorder = createRecorder(this); client = createClient(); }); diff --git a/sdk/schemaregistry/schema-registry/test/schemaRegistry.spec.ts b/sdk/schemaregistry/schema-registry/test/schemaRegistry.spec.ts index 8e4dd8a59337..c2b4a0e45ff9 100644 --- a/sdk/schemaregistry/schema-registry/test/schemaRegistry.spec.ts +++ b/sdk/schemaregistry/schema-registry/test/schemaRegistry.spec.ts @@ -62,7 +62,7 @@ describe("SchemaRegistryClient", function() { let recorder: Recorder; let client: SchemaRegistryClient; - beforeEach(/** @this */ function() { + beforeEach(/** @this Mocha.Context */ function() { ({ client, recorder } = createRecordedClient(this)); }); diff --git a/sdk/search/search-documents/test/public/node/searchClient.spec.ts b/sdk/search/search-documents/test/public/node/searchClient.spec.ts index 6321fcf3e944..c1b63922f2f4 100644 --- a/sdk/search/search-documents/test/public/node/searchClient.spec.ts +++ b/sdk/search/search-documents/test/public/node/searchClient.spec.ts @@ -18,14 +18,14 @@ import { delay } from "@azure/core-http"; const TEST_INDEX_NAME = isLiveMode() ? createRandomIndexName() : "hotel-live-test1"; -describe("SearchClient", /** @this */ function() { +describe("SearchClient", /** @this Mocha.Context */ function() { let recorder: Recorder; let searchClient: SearchClient; let indexClient: SearchIndexClient; this.timeout(99999); - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { ({ searchClient, indexClient } = createClients(TEST_INDEX_NAME)); if (!isPlaybackMode()) { await createIndex(indexClient, TEST_INDEX_NAME); diff --git a/sdk/search/search-documents/test/public/node/searchIndexClient.spec.ts b/sdk/search/search-documents/test/public/node/searchIndexClient.spec.ts index 5566a30d53b1..eac6d85cb571 100644 --- a/sdk/search/search-documents/test/public/node/searchIndexClient.spec.ts +++ b/sdk/search/search-documents/test/public/node/searchIndexClient.spec.ts @@ -17,13 +17,13 @@ import { delay } from "@azure/core-http"; const TEST_INDEX_NAME = isLiveMode() ? createRandomIndexName() : "hotel-live-test3"; -describe("SearchIndexClient", /** @this */ function() { +describe("SearchIndexClient", /** @this Mocha.Context */ function() { let recorder: Recorder; let indexClient: SearchIndexClient; this.timeout(99999); - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { ({ indexClient } = createClients(TEST_INDEX_NAME)); if (!isPlaybackMode()) { await createSynonymMaps(indexClient); diff --git a/sdk/search/search-documents/test/public/node/searchIndexerClient.spec.ts b/sdk/search/search-documents/test/public/node/searchIndexerClient.spec.ts index eed1d363076f..bc233cb7742a 100644 --- a/sdk/search/search-documents/test/public/node/searchIndexerClient.spec.ts +++ b/sdk/search/search-documents/test/public/node/searchIndexerClient.spec.ts @@ -27,14 +27,14 @@ import { delay } from "@azure/core-http"; const TEST_INDEX_NAME = isLiveMode() ? createRandomIndexName() : "hotel-live-test2"; -describe("SearchIndexerClient", /** @this */ function() { +describe("SearchIndexerClient", /** @this Mocha.Context */ function() { let recorder: Recorder; let indexerClient: SearchIndexerClient; let indexClient: SearchIndexClient; this.timeout(99999); - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { ({ indexClient, indexerClient } = createClients(TEST_INDEX_NAME)); if (!isPlaybackMode()) { await createDataSourceConnections(indexerClient); diff --git a/sdk/tables/data-tables/test/integration/batch.spec.ts b/sdk/tables/data-tables/test/integration/batch.spec.ts index 86007bf0a417..56cdab58d798 100644 --- a/sdk/tables/data-tables/test/integration/batch.spec.ts +++ b/sdk/tables/data-tables/test/integration/batch.spec.ts @@ -26,7 +26,7 @@ describe("batch operations", () => { // which wouldn't match the recorded one. Fallingback to SAS for recorded tests. const authMode = !isNode || !isLiveMode() ? "SASConnectionString" : "AccountConnectionString"; - beforeEach(/** @this */ async function() { + beforeEach(/** @this Mocha.Context */ async function() { sinon.stub(Uuid, "generateUuid").returns("fakeId"); recorder = record(this, recordedEnvironmentSetup); client = createTableClient(tableName, authMode); diff --git a/sdk/tables/data-tables/test/integration/tableclient.spec.ts b/sdk/tables/data-tables/test/integration/tableclient.spec.ts index 3cb412b3f05f..ebe5c6a9864c 100644 --- a/sdk/tables/data-tables/test/integration/tableclient.spec.ts +++ b/sdk/tables/data-tables/test/integration/tableclient.spec.ts @@ -18,7 +18,7 @@ describe("TableClient", () => { // which wouldn't match the recorded one. Fallingback to SAS for recorded tests. const authMode = !isNode || !isLiveMode() ? "SASConnectionString" : "AccountConnectionString"; - beforeEach(/** @this */ function() { + beforeEach(/** @this Mocha.Context */ function() { recorder = record(this, recordedEnvironmentSetup); client = createTableClient(tableName, authMode); @@ -43,7 +43,7 @@ describe("TableClient", () => { describe("listEntities", () => { // Create required entities for testing list operations - before(/** @this */ async function() { + before(/** @this Mocha.Context */ async function() { if (!isPlaybackMode()) { this.timeout(10000); await client.createEntity({ diff --git a/sdk/tables/data-tables/test/integration/tableserviceclient.spec.ts b/sdk/tables/data-tables/test/integration/tableserviceclient.spec.ts index 428a4e2acf2a..9aad3812eb94 100644 --- a/sdk/tables/data-tables/test/integration/tableserviceclient.spec.ts +++ b/sdk/tables/data-tables/test/integration/tableserviceclient.spec.ts @@ -14,7 +14,7 @@ describe("TableServiceClient", () => { const suffix = isNode ? "node" : "browser"; const authMode = !isNode || !isLiveMode() ? "SASConnectionString" : "AccountConnectionString"; - beforeEach(/** @this */ function() { + beforeEach(/** @this Mocha.Context */ function() { recorder = record(this, recordedEnvironmentSetup); client = createTableServiceClient(authMode); }); @@ -49,7 +49,7 @@ describe("TableServiceClient", () => { describe("listTables", () => { const tableNames: string[] = []; const expectedTotalItems = 20; - before(/** @this */ async function() { + before(/** @this Mocha.Context */ async function() { // Create tables to be listed if (!isPlaybackMode()) { this.timeout(10000); @@ -61,7 +61,7 @@ describe("TableServiceClient", () => { } }); - after(/** @this */ async function() { + after(/** @this Mocha.Context */ async function() { // Cleanup tables if (!isPlaybackMode()) { this.timeout(10000); diff --git a/sdk/tables/data-tables/test/unit/sharedKeyCredential.spec.ts b/sdk/tables/data-tables/test/unit/sharedKeyCredential.spec.ts index ddefb457a11f..b71521260069 100644 --- a/sdk/tables/data-tables/test/unit/sharedKeyCredential.spec.ts +++ b/sdk/tables/data-tables/test/unit/sharedKeyCredential.spec.ts @@ -25,7 +25,7 @@ describe("TablesSharedKeyCredential", () => { Date.prototype.toUTCString = originalToUTCString; }); - it("It should sign", /** @this */ async function() { + it("It should sign", /** @this Mocha.Context */ async function() { if (!isNode) { // TablesSharedKeyCredential auth is not supported in Browser this.skip(); diff --git a/sdk/tables/data-tables/test/unit/utils.spec.ts b/sdk/tables/data-tables/test/unit/utils.spec.ts index af817f396fdb..2ecd65bd4dca 100644 --- a/sdk/tables/data-tables/test/unit/utils.spec.ts +++ b/sdk/tables/data-tables/test/unit/utils.spec.ts @@ -10,7 +10,7 @@ import { ConnectionString } from "../../src/utils/internalModels"; describe("Utility Helpers", () => { describe("extractConnectionStringParts", () => { describe("Account Connection String", () => { - beforeEach(/** @this */ function() { + beforeEach(/** @this Mocha.Context */ function() { if (!isNode) { // Account connection string is not supported for Browsers this.skip(); diff --git a/sdk/template/template/test/public/configurationClient.spec.ts b/sdk/template/template/test/public/configurationClient.spec.ts index 3b02604a73aa..2a089f279f4d 100644 --- a/sdk/template/template/test/public/configurationClient.spec.ts +++ b/sdk/template/template/test/public/configurationClient.spec.ts @@ -52,7 +52,7 @@ describe("[AAD] ConfigurationClient functional tests", function() { // NOTE: use of "function" and not ES6 arrow-style functions with the // beforeEach hook is IMPORTANT due to the use of `this` in the function // body. - beforeEach(/** @this */ function(this: Context) { + beforeEach(/** @this Mocha.Context */ function(this: Context) { // The recorder has some convenience methods, and we need to store a // reference to it so that we can `stop()` the recorder later in the // `afterEach` hook. diff --git a/sdk/textanalytics/ai-text-analytics/test/public/apiKey.spec.ts b/sdk/textanalytics/ai-text-analytics/test/public/apiKey.spec.ts index 605c2b932f7a..22b29fc1f50a 100644 --- a/sdk/textanalytics/ai-text-analytics/test/public/apiKey.spec.ts +++ b/sdk/textanalytics/ai-text-analytics/test/public/apiKey.spec.ts @@ -19,13 +19,13 @@ const testDataEn = [ "I didn't like the last book I read at all." ]; -describe("[API Key] TextAnalyticsClient", /** @this */ function() { +describe("[API Key] TextAnalyticsClient", /** @this Mocha.Context */ function() { let recorder: Recorder; let client: TextAnalyticsClient; const CLITimeout = this.timeout(); const fastTimeout = 10000; - beforeEach(/** @this */ function() { + beforeEach(/** @this Mocha.Context */ function() { recorder = createRecorder(this); client = createClient("APIKey"); }); @@ -35,7 +35,7 @@ describe("[API Key] TextAnalyticsClient", /** @this */ function() { }); describe("fast tests", function() { - before(/** @this */ function() { + before(/** @this Mocha.Context */ function() { this.timeout(fastTimeout); }); @@ -85,7 +85,7 @@ describe("[API Key] TextAnalyticsClient", /** @this */ function() { describe("LROs", function() { const pollingInterval = isPlaybackMode() ? 0 : 2000; - before(/** @this */ function() { + before(/** @this Mocha.Context */ function() { this.timeout(isPlaybackMode() ? fastTimeout : CLITimeout); }); diff --git a/sdk/textanalytics/ai-text-analytics/test/public/textAnalyticsClient.spec.ts b/sdk/textanalytics/ai-text-analytics/test/public/textAnalyticsClient.spec.ts index 9dd0dfc29695..f7da52f42d39 100644 --- a/sdk/textanalytics/ai-text-analytics/test/public/textAnalyticsClient.spec.ts +++ b/sdk/textanalytics/ai-text-analytics/test/public/textAnalyticsClient.spec.ts @@ -35,7 +35,7 @@ const testDataEs = [ "Los caminos que llevan hasta Monte Rainier son espectaculares y hermosos.", "La carretera estaba atascada. Había mucho tráfico el día de ayer." ]; -describe("[AAD] TextAnalyticsClient", /** @this */ function() { +describe("[AAD] TextAnalyticsClient", /** @this Mocha.Context */ function() { let recorder: Recorder; let client: TextAnalyticsClient; const CLITimeout = this.timeout(); @@ -43,7 +43,7 @@ describe("[AAD] TextAnalyticsClient", /** @this */ function() { let getId: () => string; - beforeEach(/** @this */ function() { + beforeEach(/** @this Mocha.Context */ function() { recorder = createRecorder(this); client = createClient("AAD"); let nextId = 0; @@ -58,7 +58,7 @@ describe("[AAD] TextAnalyticsClient", /** @this */ function() { }); describe("fast tests", function() { - before(/** @this */ function() { + before(/** @this Mocha.Context */ function() { this.timeout(fastTimeout); }); @@ -926,7 +926,7 @@ describe("[AAD] TextAnalyticsClient", /** @this */ function() { describe("LROs", function() { const pollingInterval = isPlaybackMode() ? 0 : 2000; - before(/** @this */ function() { + before(/** @this Mocha.Context */ function() { this.timeout(isPlaybackMode() ? fastTimeout : CLITimeout); }); From d4062f72352cc5f6e09f1583d2f11d902b36ed9a Mon Sep 17 00:00:00 2001 From: deyaaeldeen Date: Mon, 22 Mar 2021 20:34:16 +0000 Subject: [PATCH 5/9] format --- .../test/anomalydetector.spec.ts | 8 +- .../public/containerRegistryClient.spec.ts | 52 +++++---- .../public/functional/databaseaccount.spec.ts | 8 +- .../test/public/functional/offer.spec.ts | 10 +- .../test/public/functional/sproc.spec.ts | 16 ++- .../eventgrid/test/eventGridClient.spec.ts | 108 ++++++++++-------- .../browser/formrecognizerclient.spec.ts | 8 +- .../test/public/formtrainingclient.spec.ts | 8 +- .../public/node/formrecognizerclient.spec.ts | 10 +- ...challengeBasedAuthenticationPolicy.spec.ts | 16 +-- .../test/public/CRUD.spec.ts | 22 ++-- .../test/public/list.spec.ts | 16 +-- .../test/public/lro.create.spec.ts | 16 +-- .../test/public/lro.delete.spec.ts | 16 +-- .../test/public/lro.operation.spec.ts | 16 +-- .../test/public/lro.recover.spec.ts | 16 +-- .../test/public/mergeAndImport.spec.ts | 26 +++-- .../test/public/recoverBackupRestore.spec.ts | 16 +-- .../test/internal/aesCryptography.spec.ts | 56 ++++----- ...challengeBasedAuthenticationPolicy.spec.ts | 16 +-- .../test/public/CRUD.hsm.spec.ts | 28 ++--- .../keyvault-keys/test/public/CRUD.spec.ts | 16 +-- .../test/public/crypto.hsm.spec.ts | 30 ++--- .../keyvault-keys/test/public/crypto.spec.ts | 44 ++++--- .../keyvault-keys/test/public/import.spec.ts | 16 +-- .../keyvault-keys/test/public/list.spec.ts | 16 +-- .../test/public/localCryptography.spec.ts | 96 +++++++++------- .../test/public/lro.delete.spec.ts | 16 +-- .../test/public/lro.recoverDelete.spec.ts | 16 +-- .../test/public/recoverBackupRestore.spec.ts | 16 +-- ...challengeBasedAuthenticationPolicy.spec.ts | 16 +-- .../keyvault-secrets/test/public/CRUD.spec.ts | 16 +-- .../keyvault-secrets/test/public/list.spec.ts | 16 +-- .../test/public/lro.delete.spec.ts | 16 +-- .../test/public/lro.recover.spec.ts | 16 +-- .../test/public/recoverBackupRestore.spec.ts | 16 +-- .../test/public/adminclient.spec.ts | 8 +- .../test/public/advisorclient.spec.ts | 8 +- .../test/public/datafeed.spec.ts | 74 ++++++------ .../test/public/hookTests.spec.ts | 18 +-- .../test/mixedRealityStsClient.spec.ts | 10 +- .../test/schemaRegistry.spec.ts | 8 +- .../test/public/node/searchClient.spec.ts | 22 ++-- .../public/node/searchIndexClient.spec.ts | 22 ++-- .../public/node/searchIndexerClient.spec.ts | 26 +++-- .../test/integration/batch.spec.ts | 24 ++-- .../test/integration/tableclient.spec.ts | 38 +++--- .../integration/tableserviceclient.spec.ts | 52 +++++---- .../data-tables/test/unit/utils.spec.ts | 12 +- .../test/public/configurationClient.spec.ts | 58 +++++----- .../multi-version/test/multiVersion.spec.ts | 8 +- .../test/public/apiKey.spec.ts | 26 +++-- .../test/public/textAnalyticsClient.spec.ts | 36 +++--- 53 files changed, 727 insertions(+), 573 deletions(-) diff --git a/sdk/anomalydetector/ai-anomaly-detector/test/anomalydetector.spec.ts b/sdk/anomalydetector/ai-anomaly-detector/test/anomalydetector.spec.ts index 4fb8b5457299..cb120e1c215e 100644 --- a/sdk/anomalydetector/ai-anomaly-detector/test/anomalydetector.spec.ts +++ b/sdk/anomalydetector/ai-anomaly-detector/test/anomalydetector.spec.ts @@ -19,9 +19,11 @@ describe("AnomalyDetectorClient", () => { let recorder: Recorder; const apiKey = new AzureKeyCredential(testEnv.ANOMALY_DETECTOR_API_KEY); - beforeEach(/** @this Mocha.Context */ function() { - ({ recorder, client } = createRecordedAnomalyDetectorClient(this, apiKey)); - }); + beforeEach( + /** @this Mocha.Context */ function() { + ({ recorder, client } = createRecordedAnomalyDetectorClient(this, apiKey)); + } + ); afterEach(async function() { if (recorder) { diff --git a/sdk/containerregistry/container-registry/test/public/containerRegistryClient.spec.ts b/sdk/containerregistry/container-registry/test/public/containerRegistryClient.spec.ts index d517e72394cd..d09350de7c50 100644 --- a/sdk/containerregistry/container-registry/test/public/containerRegistryClient.spec.ts +++ b/sdk/containerregistry/container-registry/test/public/containerRegistryClient.spec.ts @@ -50,34 +50,36 @@ describe.skip("ContainerRegistryClient functional tests", function() { // NOTE: use of "function" and not ES6 arrow-style functions with the // beforeEach hook is IMPORTANT due to the use of `this` in the function // body. - beforeEach(/** @this Mocha.Context */ function(this: Context) { - // The recorder has some convenience methods, and we need to store a - // reference to it so that we can `stop()` the recorder later in the - // `afterEach` hook. - recorder = record(this, { - // == Recorder Environment Setup == Add the replaceable variables from - // above - replaceableVariables, + beforeEach( + /** @this Mocha.Context */ function(this: Context) { + // The recorder has some convenience methods, and we need to store a + // reference to it so that we can `stop()` the recorder later in the + // `afterEach` hook. + recorder = record(this, { + // == Recorder Environment Setup == Add the replaceable variables from + // above + replaceableVariables, - // We don't use this in the template, but if we had any query parameters - // we wished to discard, we could add them here - queryParametersToSkip: [], + // We don't use this in the template, but if we had any query parameters + // we wished to discard, we could add them here + queryParametersToSkip: [], - // Finally, we need to remove the AAD `access_token` from any requests. - // This is very important, as it cannot be removed using environment - // variable or query parameter replacement. The - // `customizationsOnRecordings` field allows us to make arbitrary - // replacements within recordings. - customizationsOnRecordings: [ - (recording: any): any => - recording.replace(/"access_token":"[^"]*"/g, `"access_token":"access_token"`) - ] - }); + // Finally, we need to remove the AAD `access_token` from any requests. + // This is very important, as it cannot be removed using environment + // variable or query parameter replacement. The + // `customizationsOnRecordings` field allows us to make arbitrary + // replacements within recordings. + customizationsOnRecordings: [ + (recording: any): any => + recording.replace(/"access_token":"[^"]*"/g, `"access_token":"access_token"`) + ] + }); - // We'll be able to refer to the instantiated `client` in tests, since we - // initialize it before each test - client = createTestClient(); - }); + // We'll be able to refer to the instantiated `client` in tests, since we + // initialize it before each test + client = createTestClient(); + } + ); // After each test, we need to stop the recording. afterEach(async function() { diff --git a/sdk/cosmosdb/cosmos/test/public/functional/databaseaccount.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/databaseaccount.spec.ts index e2176c69e23f..1aa438386527 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/databaseaccount.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/databaseaccount.spec.ts @@ -8,9 +8,11 @@ const client = new CosmosClient({ endpoint, key: masterKey }); describe("NodeJS CRUD Tests", /** @this Mocha.Context */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); - beforeEach(/** @this Mocha.Context */ async function() { - this.timeout(process.env.MOCHA_TIMEOUT || 10000); - }); + beforeEach( + /** @this Mocha.Context */ async function() { + this.timeout(process.env.MOCHA_TIMEOUT || 10000); + } + ); describe("validate database account functionality", function() { it("nativeApi Should get database account successfully name based", async function() { diff --git a/sdk/cosmosdb/cosmos/test/public/functional/offer.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/offer.spec.ts index 0ea64fef25fe..e148d49c35db 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/offer.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/offer.spec.ts @@ -18,10 +18,12 @@ const validateOfferResponseBody = function(offer: any): void { describe("NodeJS CRUD Tests", /** @this Mocha.Context */ function() { this.timeout(process.env.MOCHA_TIMEOUT || 10000); - beforeEach(/** @this Mocha.Context */ async function() { - this.timeout(process.env.MOCHA_TIMEOUT || 10000); - await removeAllDatabases(); - }); + beforeEach( + /** @this Mocha.Context */ async function() { + this.timeout(process.env.MOCHA_TIMEOUT || 10000); + await removeAllDatabases(); + } + ); describe("Validate Offer CRUD", function() { it("nativeApi Should do offer read and query operations successfully name based single partition collection", async function() { diff --git a/sdk/cosmosdb/cosmos/test/public/functional/sproc.spec.ts b/sdk/cosmosdb/cosmos/test/public/functional/sproc.spec.ts index 354d557aedff..27baaf0b5532 100644 --- a/sdk/cosmosdb/cosmos/test/public/functional/sproc.spec.ts +++ b/sdk/cosmosdb/cosmos/test/public/functional/sproc.spec.ts @@ -20,9 +20,11 @@ describe("NodeJS CRUD Tests", /** @this Mocha.Context */ function() { }); describe("Validate sproc CRUD", function() { let container: Container; - beforeEach(/** @this Mocha.Context */ async function() { - container = await getTestContainer(this.test.fullTitle()); - }); + beforeEach( + /** @this Mocha.Context */ async function() { + container = await getTestContainer(this.test.fullTitle()); + } + ); it("nativeApi Should do sproc CRUD operations successfully with create/replace", async function() { // read sprocs @@ -92,9 +94,11 @@ describe("NodeJS CRUD Tests", /** @this Mocha.Context */ function() { describe("Validate stored procedure functionality", function() { let container: Container; - beforeEach(/** @this Mocha.Context */ async function() { - container = await getTestContainer(this.test.fullTitle()); - }); + beforeEach( + /** @this Mocha.Context */ async function() { + container = await getTestContainer(this.test.fullTitle()); + } + ); it("nativeApi should do stored procedure operations successfully with create/replace", async function() { const sproc1: StoredProcedureDefinition = { diff --git a/sdk/eventgrid/eventgrid/test/eventGridClient.spec.ts b/sdk/eventgrid/eventgrid/test/eventGridClient.spec.ts index cfc4deb94260..7b9c98393f4b 100644 --- a/sdk/eventgrid/eventgrid/test/eventGridClient.spec.ts +++ b/sdk/eventgrid/eventgrid/test/eventGridClient.spec.ts @@ -31,14 +31,16 @@ describe("EventGridPublisherClient", /** @this Mocha.Context */ function() { describe("#send (EventGrid schema)", function() { let client: EventGridPublisherClient<"EventGrid">; - beforeEach(/** @this Mocha.Context */ function() { - ({ client, recorder } = createRecordedClient( - this, - testEnv.EVENT_GRID_EVENT_GRID_SCHEMA_ENDPOINT, - "EventGrid", - new AzureKeyCredential(testEnv.EVENT_GRID_EVENT_GRID_SCHEMA_API_KEY) - )); - }); + beforeEach( + /** @this Mocha.Context */ function() { + ({ client, recorder } = createRecordedClient( + this, + testEnv.EVENT_GRID_EVENT_GRID_SCHEMA_ENDPOINT, + "EventGrid", + new AzureKeyCredential(testEnv.EVENT_GRID_EVENT_GRID_SCHEMA_API_KEY) + )); + } + ); afterEach(async function() { await recorder.stop(); @@ -98,14 +100,16 @@ describe("EventGridPublisherClient", /** @this Mocha.Context */ function() { describe("#send error cases (EventGrid schema)", function() { let client: EventGridPublisherClient<"EventGrid">; - beforeEach(/** @this Mocha.Context */ function() { - ({ client, recorder } = createRecordedClient( - this, - removeApiEventsSuffix(testEnv.EVENT_GRID_CUSTOM_SCHEMA_ENDPOINT), - "EventGrid", - new AzureKeyCredential(testEnv.EVENT_GRID_CUSTOM_SCHEMA_API_KEY) - )); - }); + beforeEach( + /** @this Mocha.Context */ function() { + ({ client, recorder } = createRecordedClient( + this, + removeApiEventsSuffix(testEnv.EVENT_GRID_CUSTOM_SCHEMA_ENDPOINT), + "EventGrid", + new AzureKeyCredential(testEnv.EVENT_GRID_CUSTOM_SCHEMA_API_KEY) + )); + } + ); afterEach(async function() { await recorder.stop(); @@ -141,14 +145,16 @@ describe("EventGridPublisherClient", /** @this Mocha.Context */ function() { describe("#send (CloudEvent schema)", function() { let client: EventGridPublisherClient<"CloudEvent">; - beforeEach(/** @this Mocha.Context */ function() { - ({ client, recorder } = createRecordedClient( - this, - testEnv.EVENT_GRID_CLOUD_EVENT_SCHEMA_ENDPOINT, - "CloudEvent", - new AzureKeyCredential(testEnv.EVENT_GRID_CLOUD_EVENT_SCHEMA_API_KEY) - )); - }); + beforeEach( + /** @this Mocha.Context */ function() { + ({ client, recorder } = createRecordedClient( + this, + testEnv.EVENT_GRID_CLOUD_EVENT_SCHEMA_ENDPOINT, + "CloudEvent", + new AzureKeyCredential(testEnv.EVENT_GRID_CLOUD_EVENT_SCHEMA_API_KEY) + )); + } + ); afterEach(async function() { await recorder.stop(); @@ -250,14 +256,16 @@ describe("EventGridPublisherClient", /** @this Mocha.Context */ function() { describe("#send error cases (CloudEvent schema)", function() { let client: EventGridPublisherClient<"CloudEvent">; - beforeEach(/** @this Mocha.Context */ function() { - ({ client, recorder } = createRecordedClient( - this, - removeApiEventsSuffix(testEnv.EVENT_GRID_CLOUD_EVENT_SCHEMA_ENDPOINT), - "CloudEvent", - new AzureKeyCredential(testEnv.EVENT_GRID_CLOUD_EVENT_SCHEMA_API_KEY) - )); - }); + beforeEach( + /** @this Mocha.Context */ function() { + ({ client, recorder } = createRecordedClient( + this, + removeApiEventsSuffix(testEnv.EVENT_GRID_CLOUD_EVENT_SCHEMA_ENDPOINT), + "CloudEvent", + new AzureKeyCredential(testEnv.EVENT_GRID_CLOUD_EVENT_SCHEMA_API_KEY) + )); + } + ); afterEach(async function() { await recorder.stop(); @@ -291,14 +299,16 @@ describe("EventGridPublisherClient", /** @this Mocha.Context */ function() { describe("#send (Custom Event Schema)", function() { let client: EventGridPublisherClient<"Custom">; - beforeEach(/** @this Mocha.Context */ function() { - ({ client, recorder } = createRecordedClient( - this, - testEnv.EVENT_GRID_CUSTOM_SCHEMA_ENDPOINT, - "Custom", - new AzureKeyCredential(testEnv.EVENT_GRID_CUSTOM_SCHEMA_API_KEY) - )); - }); + beforeEach( + /** @this Mocha.Context */ function() { + ({ client, recorder } = createRecordedClient( + this, + testEnv.EVENT_GRID_CUSTOM_SCHEMA_ENDPOINT, + "Custom", + new AzureKeyCredential(testEnv.EVENT_GRID_CUSTOM_SCHEMA_API_KEY) + )); + } + ); afterEach(async function() { await recorder.stop(); @@ -352,14 +362,16 @@ describe("EventGridPublisherClient", /** @this Mocha.Context */ function() { describe("#send error cases (Custom Event Schema)", function() { let client: EventGridPublisherClient<"Custom">; - beforeEach(/** @this Mocha.Context */ function() { - ({ client, recorder } = createRecordedClient( - this, - removeApiEventsSuffix(testEnv.EVENT_GRID_CUSTOM_SCHEMA_ENDPOINT), - "Custom", - new AzureKeyCredential(testEnv.EVENT_GRID_CUSTOM_SCHEMA_API_KEY) - )); - }); + beforeEach( + /** @this Mocha.Context */ function() { + ({ client, recorder } = createRecordedClient( + this, + removeApiEventsSuffix(testEnv.EVENT_GRID_CUSTOM_SCHEMA_ENDPOINT), + "Custom", + new AzureKeyCredential(testEnv.EVENT_GRID_CUSTOM_SCHEMA_API_KEY) + )); + } + ); afterEach(async function() { await recorder.stop(); diff --git a/sdk/formrecognizer/ai-form-recognizer/test/public/browser/formrecognizerclient.spec.ts b/sdk/formrecognizer/ai-form-recognizer/test/public/browser/formrecognizerclient.spec.ts index 21fee4cda531..03515611079a 100644 --- a/sdk/formrecognizer/ai-form-recognizer/test/public/browser/formrecognizerclient.spec.ts +++ b/sdk/formrecognizer/ai-form-recognizer/test/public/browser/formrecognizerclient.spec.ts @@ -16,9 +16,11 @@ describe("FormRecognizerClient browser only", () => { let recorder: Recorder; const apiKey = new AzureKeyCredential(testEnv.FORM_RECOGNIZER_API_KEY); - beforeEach(/** @this Mocha.Context */ function() { - ({ recorder, client } = createRecordedRecognizerClient(this, apiKey)); - }); + beforeEach( + /** @this Mocha.Context */ function() { + ({ recorder, client } = createRecordedRecognizerClient(this, apiKey)); + } + ); afterEach(async function() { if (recorder) { diff --git a/sdk/formrecognizer/ai-form-recognizer/test/public/formtrainingclient.spec.ts b/sdk/formrecognizer/ai-form-recognizer/test/public/formtrainingclient.spec.ts index 5372f3087589..582c49f61c1f 100644 --- a/sdk/formrecognizer/ai-form-recognizer/test/public/formtrainingclient.spec.ts +++ b/sdk/formrecognizer/ai-form-recognizer/test/public/formtrainingclient.spec.ts @@ -27,9 +27,11 @@ matrix([[true, false]] as const, async (useAad) => { describe(`[${useAad ? "AAD" : "API Key"}] FormTrainingClient`, () => { let recorder: Recorder; - beforeEach(/** @this Mocha.Context */ function(this: Context) { - recorder = createRecorder(this); - }); + beforeEach( + /** @this Mocha.Context */ function(this: Context) { + recorder = createRecorder(this); + } + ); afterEach(async function() { await recorder.stop(); diff --git a/sdk/formrecognizer/ai-form-recognizer/test/public/node/formrecognizerclient.spec.ts b/sdk/formrecognizer/ai-form-recognizer/test/public/node/formrecognizerclient.spec.ts index 7a09d8398670..09094bd24aa4 100644 --- a/sdk/formrecognizer/ai-form-recognizer/test/public/node/formrecognizerclient.spec.ts +++ b/sdk/formrecognizer/ai-form-recognizer/test/public/node/formrecognizerclient.spec.ts @@ -28,10 +28,12 @@ matrix([[true, false]] as const, async (useAad) => { let client: FormRecognizerClient; let recorder: Recorder; - beforeEach(/** @this Mocha.Context */ function() { - recorder = createRecorder(this); - client = new FormRecognizerClient(endpoint(), makeCredential(useAad)); - }); + beforeEach( + /** @this Mocha.Context */ function() { + recorder = createRecorder(this); + client = new FormRecognizerClient(endpoint(), makeCredential(useAad)); + } + ); afterEach(async function() { if (recorder) { diff --git a/sdk/keyvault/keyvault-certificates/test/internal/challengeBasedAuthenticationPolicy.spec.ts b/sdk/keyvault/keyvault-certificates/test/internal/challengeBasedAuthenticationPolicy.spec.ts index b79a7e4bde57..97c489b37405 100644 --- a/sdk/keyvault/keyvault-certificates/test/internal/challengeBasedAuthenticationPolicy.spec.ts +++ b/sdk/keyvault/keyvault-certificates/test/internal/challengeBasedAuthenticationPolicy.spec.ts @@ -32,13 +32,15 @@ describe("Challenge based authentication tests", () => { subject: "cn=MyCert" }; - beforeEach(/** @this Mocha.Context */ async function() { - const authentication = await authenticate(this); - certificateSuffix = authentication.suffix; - client = authentication.client; - testClient = authentication.testClient; - recorder = authentication.recorder; - }); + beforeEach( + /** @this Mocha.Context */ async function() { + const authentication = await authenticate(this); + certificateSuffix = authentication.suffix; + client = authentication.client; + testClient = authentication.testClient; + recorder = authentication.recorder; + } + ); afterEach(async function() { await recorder.stop(); diff --git a/sdk/keyvault/keyvault-certificates/test/public/CRUD.spec.ts b/sdk/keyvault/keyvault-certificates/test/public/CRUD.spec.ts index 6f3a15a7397d..d0431553ed36 100644 --- a/sdk/keyvault/keyvault-certificates/test/public/CRUD.spec.ts +++ b/sdk/keyvault/keyvault-certificates/test/public/CRUD.spec.ts @@ -32,16 +32,18 @@ describe("Certificates client - create, read, update and delete", () => { subject: "cn=MyCert" }; - beforeEach(/** @this Mocha.Context */ async function() { - const authentication = await authenticate(this); - suffix = authentication.suffix; - client = authentication.client; - testClient = authentication.testClient; - recorder = authentication.recorder; - keyVaultUrl = authentication.keyVaultUrl; - credential = authentication.credential; - secretClient = new SecretClient(keyVaultUrl, credential); - }); + beforeEach( + /** @this Mocha.Context */ async function() { + const authentication = await authenticate(this); + suffix = authentication.suffix; + client = authentication.client; + testClient = authentication.testClient; + recorder = authentication.recorder; + keyVaultUrl = authentication.keyVaultUrl; + credential = authentication.credential; + secretClient = new SecretClient(keyVaultUrl, credential); + } + ); afterEach(async function() { await recorder.stop(); diff --git a/sdk/keyvault/keyvault-certificates/test/public/list.spec.ts b/sdk/keyvault/keyvault-certificates/test/public/list.spec.ts index b1532455d2c0..0509116495b5 100644 --- a/sdk/keyvault/keyvault-certificates/test/public/list.spec.ts +++ b/sdk/keyvault/keyvault-certificates/test/public/list.spec.ts @@ -26,13 +26,15 @@ describe("Certificates client - list certificates in various ways", () => { subject: "cn=MyCert" }; - beforeEach(/** @this Mocha.Context */ async function() { - const authentication = await authenticate(this); - suffix = authentication.suffix; - client = authentication.client; - testClient = authentication.testClient; - recorder = authentication.recorder; - }); + beforeEach( + /** @this Mocha.Context */ async function() { + const authentication = await authenticate(this); + suffix = authentication.suffix; + client = authentication.client; + testClient = authentication.testClient; + recorder = authentication.recorder; + } + ); afterEach(async function() { await recorder.stop(); diff --git a/sdk/keyvault/keyvault-certificates/test/public/lro.create.spec.ts b/sdk/keyvault/keyvault-certificates/test/public/lro.create.spec.ts index 61a1ca77ffe4..e03d00b8a8e1 100644 --- a/sdk/keyvault/keyvault-certificates/test/public/lro.create.spec.ts +++ b/sdk/keyvault/keyvault-certificates/test/public/lro.create.spec.ts @@ -17,13 +17,15 @@ describe("Certificates client - LRO - create", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this Mocha.Context */ async function() { - const authentication = await authenticate(this); - certificateSuffix = authentication.suffix; - client = authentication.client; - testClient = authentication.testClient; - recorder = authentication.recorder; - }); + beforeEach( + /** @this Mocha.Context */ async function() { + const authentication = await authenticate(this); + certificateSuffix = authentication.suffix; + client = authentication.client; + testClient = authentication.testClient; + recorder = authentication.recorder; + } + ); afterEach(async function() { await recorder.stop(); diff --git a/sdk/keyvault/keyvault-certificates/test/public/lro.delete.spec.ts b/sdk/keyvault/keyvault-certificates/test/public/lro.delete.spec.ts index 6ee46f180736..028bb40d82d5 100644 --- a/sdk/keyvault/keyvault-certificates/test/public/lro.delete.spec.ts +++ b/sdk/keyvault/keyvault-certificates/test/public/lro.delete.spec.ts @@ -17,13 +17,15 @@ describe("Certificates client - lro - delete", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this Mocha.Context */ async function() { - const authentication = await authenticate(this); - certificateSuffix = authentication.suffix; - client = authentication.client; - testClient = authentication.testClient; - recorder = authentication.recorder; - }); + beforeEach( + /** @this Mocha.Context */ async function() { + const authentication = await authenticate(this); + certificateSuffix = authentication.suffix; + client = authentication.client; + testClient = authentication.testClient; + recorder = authentication.recorder; + } + ); afterEach(async function() { await recorder.stop(); diff --git a/sdk/keyvault/keyvault-certificates/test/public/lro.operation.spec.ts b/sdk/keyvault/keyvault-certificates/test/public/lro.operation.spec.ts index b16310e74c6f..afbdfd974767 100644 --- a/sdk/keyvault/keyvault-certificates/test/public/lro.operation.spec.ts +++ b/sdk/keyvault/keyvault-certificates/test/public/lro.operation.spec.ts @@ -21,13 +21,15 @@ describe("Certificates client - LRO - certificate operation", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this Mocha.Context */ async function() { - const authentication = await authenticate(this); - certificateSuffix = authentication.suffix; - client = authentication.client; - testClient = authentication.testClient; - recorder = authentication.recorder; - }); + beforeEach( + /** @this Mocha.Context */ async function() { + const authentication = await authenticate(this); + certificateSuffix = authentication.suffix; + client = authentication.client; + testClient = authentication.testClient; + recorder = authentication.recorder; + } + ); afterEach(async function() { await recorder.stop(); diff --git a/sdk/keyvault/keyvault-certificates/test/public/lro.recover.spec.ts b/sdk/keyvault/keyvault-certificates/test/public/lro.recover.spec.ts index 64e36d6c5cee..1dbf31eb4cd3 100644 --- a/sdk/keyvault/keyvault-certificates/test/public/lro.recover.spec.ts +++ b/sdk/keyvault/keyvault-certificates/test/public/lro.recover.spec.ts @@ -18,13 +18,15 @@ describe("Certificates client - LRO - recoverDelete", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this Mocha.Context */ async function() { - const authentication = await authenticate(this); - certificateSuffix = authentication.suffix; - client = authentication.client; - testClient = authentication.testClient; - recorder = authentication.recorder; - }); + beforeEach( + /** @this Mocha.Context */ async function() { + const authentication = await authenticate(this); + certificateSuffix = authentication.suffix; + client = authentication.client; + testClient = authentication.testClient; + recorder = authentication.recorder; + } + ); afterEach(async function() { await recorder.stop(); diff --git a/sdk/keyvault/keyvault-certificates/test/public/mergeAndImport.spec.ts b/sdk/keyvault/keyvault-certificates/test/public/mergeAndImport.spec.ts index 81aac6735be5..9a01a66cb025 100644 --- a/sdk/keyvault/keyvault-certificates/test/public/mergeAndImport.spec.ts +++ b/sdk/keyvault/keyvault-certificates/test/public/mergeAndImport.spec.ts @@ -24,16 +24,18 @@ describe("Certificates client - merge and import certificates", () => { let credential: ClientSecretCredential; let secretClient: SecretClient; - beforeEach(/** @this Mocha.Context */ async function() { - const authentication = await authenticate(this); - suffix = authentication.suffix; - client = authentication.client; - testClient = authentication.testClient; - recorder = authentication.recorder; - keyVaultUrl = authentication.keyVaultUrl; - credential = authentication.credential; - secretClient = new SecretClient(keyVaultUrl, credential); - }); + beforeEach( + /** @this Mocha.Context */ async function() { + const authentication = await authenticate(this); + suffix = authentication.suffix; + client = authentication.client; + testClient = authentication.testClient; + recorder = authentication.recorder; + keyVaultUrl = authentication.keyVaultUrl; + credential = authentication.credential; + secretClient = new SecretClient(keyVaultUrl, credential); + } + ); afterEach(async function() { await recorder.stop(); @@ -95,7 +97,9 @@ describe("Certificates client - merge and import certificates", () => { // The signed certificate will never be the same, so we can't play it back. // This test is only designed to work on NodeJS, since we use child_process to interact with openssl. - it("can merge a self signed certificate", /** @this Mocha.Context */ async function(): Promise { + it("can merge a self signed certificate", /** @this Mocha.Context */ async function(): Promise< + void + > { recorder.skip( undefined, "The signed certificate will never be the same, so we can't play it back." diff --git a/sdk/keyvault/keyvault-certificates/test/public/recoverBackupRestore.spec.ts b/sdk/keyvault/keyvault-certificates/test/public/recoverBackupRestore.spec.ts index bbf35d657f74..097780726e50 100644 --- a/sdk/keyvault/keyvault-certificates/test/public/recoverBackupRestore.spec.ts +++ b/sdk/keyvault/keyvault-certificates/test/public/recoverBackupRestore.spec.ts @@ -23,13 +23,15 @@ describe("Certificates client - restore certificates and recover backups", () => subject: "cn=MyCert" }; - beforeEach(/** @this Mocha.Context */ async function() { - const authentication = await authenticate(this); - suffix = authentication.suffix; - client = authentication.client; - testClient = authentication.testClient; - recorder = authentication.recorder; - }); + beforeEach( + /** @this Mocha.Context */ async function() { + const authentication = await authenticate(this); + suffix = authentication.suffix; + client = authentication.client; + testClient = authentication.testClient; + recorder = authentication.recorder; + } + ); afterEach(async function() { await recorder.stop(); diff --git a/sdk/keyvault/keyvault-keys/test/internal/aesCryptography.spec.ts b/sdk/keyvault/keyvault-keys/test/internal/aesCryptography.spec.ts index 20e441ed10bf..c50186ea153a 100644 --- a/sdk/keyvault/keyvault-keys/test/internal/aesCryptography.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/internal/aesCryptography.spec.ts @@ -43,19 +43,21 @@ describe("AesCryptographyProvider internal tests", function() { const encryptionAlgorithm = `A${keySize}CBCPAD` as AesCbcEncryptionAlgorithm; let jwk: JsonWebKey; - beforeEach(/** @this Mocha.Context */ function() { - if (!isNode) { - this.skip(); + beforeEach( + /** @this Mocha.Context */ function() { + if (!isNode) { + this.skip(); + } + + jwk = { + keyOps: ["encrypt", "decrypt", "wrapKey", "unwrapKey"], + k: getKey(keySize >> 3), // Generate a symmetric key for testing + kty: "oct" + }; + + cryptoClient = new CryptographyClient(jwk); } - - jwk = { - keyOps: ["encrypt", "decrypt", "wrapKey", "unwrapKey"], - k: getKey(keySize >> 3), // Generate a symmetric key for testing - kty: "oct" - }; - - cryptoClient = new CryptographyClient(jwk); - }); + ); describe(`AES-CBC with PKCS padding (${keySize})`, () => { describe("local-only tests", async function() { @@ -132,21 +134,23 @@ describe("AesCryptographyProvider internal tests", function() { let keyVaultKey: KeyVaultKey; let remoteProvider: RemoteCryptographyProvider; - beforeEach(/** @this Mocha.Context */ async function() { - const authentication = await authenticate(this); - recorder = authentication.recorder; - - if (!authentication.hsmClient) { - // Managed HSM is not deployed for this run due to service resource restrictions so we skip these tests. - // This is only necessary while Managed HSM is in preview. - this.skip(); + beforeEach( + /** @this Mocha.Context */ async function() { + const authentication = await authenticate(this); + recorder = authentication.recorder; + + if (!authentication.hsmClient) { + // Managed HSM is not deployed for this run due to service resource restrictions so we skip these tests. + // This is only necessary while Managed HSM is in preview. + this.skip(); + } + + client = authentication.hsmClient; + credential = authentication.credential; + testClient = new TestClient(authentication.hsmClient); + keySuffix = authentication.keySuffix; } - - client = authentication.hsmClient; - credential = authentication.credential; - testClient = new TestClient(authentication.hsmClient); - keySuffix = authentication.keySuffix; - }); + ); afterEach(async function() { await recorder.stop(); diff --git a/sdk/keyvault/keyvault-keys/test/internal/challengeBasedAuthenticationPolicy.spec.ts b/sdk/keyvault/keyvault-keys/test/internal/challengeBasedAuthenticationPolicy.spec.ts index 4caab673358f..6adc6eef74b8 100644 --- a/sdk/keyvault/keyvault-keys/test/internal/challengeBasedAuthenticationPolicy.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/internal/challengeBasedAuthenticationPolicy.spec.ts @@ -26,13 +26,15 @@ describe("Challenge based authentication tests", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this Mocha.Context */ async function() { - const authentication = await authenticate(this); - keySuffix = authentication.keySuffix; - client = authentication.client; - testClient = authentication.testClient; - recorder = authentication.recorder; - }); + beforeEach( + /** @this Mocha.Context */ async function() { + const authentication = await authenticate(this); + keySuffix = authentication.keySuffix; + client = authentication.client; + testClient = authentication.testClient; + recorder = authentication.recorder; + } + ); afterEach(async function() { await recorder.stop(); diff --git a/sdk/keyvault/keyvault-keys/test/public/CRUD.hsm.spec.ts b/sdk/keyvault/keyvault-keys/test/public/CRUD.hsm.spec.ts index 10976beab403..5f09ae91ab6f 100644 --- a/sdk/keyvault/keyvault-keys/test/public/CRUD.hsm.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/public/CRUD.hsm.spec.ts @@ -16,20 +16,22 @@ describe("Keys client - create, read, update and delete operations for managed H let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this Mocha.Context */ async function() { - const authentication = await authenticate(this); - recorder = authentication.recorder; - - if (!authentication.hsmClient) { - // Managed HSM is not deployed for this run due to service resource restrictions so we skip these tests. - // This is only necessary while Managed HSM is in preview. - this.skip(); + beforeEach( + /** @this Mocha.Context */ async function() { + const authentication = await authenticate(this); + recorder = authentication.recorder; + + if (!authentication.hsmClient) { + // Managed HSM is not deployed for this run due to service resource restrictions so we skip these tests. + // This is only necessary while Managed HSM is in preview. + this.skip(); + } + + hsmClient = authentication.hsmClient; + keySuffix = authentication.keySuffix; + testClient = new TestClient(authentication.hsmClient); } - - hsmClient = authentication.hsmClient; - keySuffix = authentication.keySuffix; - testClient = new TestClient(authentication.hsmClient); - }); + ); afterEach(async function() { await recorder.stop(); diff --git a/sdk/keyvault/keyvault-keys/test/public/CRUD.spec.ts b/sdk/keyvault/keyvault-keys/test/public/CRUD.spec.ts index eab26f76ad68..6afa8e5bd20e 100644 --- a/sdk/keyvault/keyvault-keys/test/public/CRUD.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/public/CRUD.spec.ts @@ -24,13 +24,15 @@ describe("Keys client - create, read, update and delete operations", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this Mocha.Context */ async function() { - const authentication = await authenticate(this); - keySuffix = authentication.keySuffix; - client = authentication.client; - testClient = authentication.testClient; - recorder = authentication.recorder; - }); + beforeEach( + /** @this Mocha.Context */ async function() { + const authentication = await authenticate(this); + keySuffix = authentication.keySuffix; + client = authentication.client; + testClient = authentication.testClient; + recorder = authentication.recorder; + } + ); afterEach(async function() { await recorder.stop(); diff --git a/sdk/keyvault/keyvault-keys/test/public/crypto.hsm.spec.ts b/sdk/keyvault/keyvault-keys/test/public/crypto.hsm.spec.ts index 6e7f8445c714..7dc9798bae9a 100644 --- a/sdk/keyvault/keyvault-keys/test/public/crypto.hsm.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/public/crypto.hsm.spec.ts @@ -20,22 +20,24 @@ describe("CryptographyClient for managed HSM (skipped if MHSM is not deployed)", let keyVaultKey: KeyVaultKey; let keySuffix: string; - beforeEach(/** @this Mocha.Context */ async function() { - const authentication = await authenticate(this); - recorder = authentication.recorder; + beforeEach( + /** @this Mocha.Context */ async function() { + const authentication = await authenticate(this); + recorder = authentication.recorder; - if (!authentication.hsmClient) { - // Managed HSM is not deployed for this run due to service resource restrictions so we skip these tests. - // This is only necessary while Managed HSM is in preview. - this.skip(); - } + if (!authentication.hsmClient) { + // Managed HSM is not deployed for this run due to service resource restrictions so we skip these tests. + // This is only necessary while Managed HSM is in preview. + this.skip(); + } - hsmClient = authentication.hsmClient; - testClient = new TestClient(authentication.hsmClient); - credential = authentication.credential; - keySuffix = authentication.keySuffix; - keyName = testClient.formatName("cryptography-client-test" + keySuffix); - }); + hsmClient = authentication.hsmClient; + testClient = new TestClient(authentication.hsmClient); + credential = authentication.credential; + keySuffix = authentication.keySuffix; + keyName = testClient.formatName("cryptography-client-test" + keySuffix); + } + ); afterEach(async function() { await testClient?.flushKey(keyName); diff --git a/sdk/keyvault/keyvault-keys/test/public/crypto.spec.ts b/sdk/keyvault/keyvault-keys/test/public/crypto.spec.ts index 0289eef57bfc..d7938fa66152 100644 --- a/sdk/keyvault/keyvault-keys/test/public/crypto.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/public/crypto.spec.ts @@ -29,24 +29,28 @@ describe("CryptographyClient (all decrypts happen remotely)", () => { return; } - beforeEach(/** @this Mocha.Context */ async function() { - const authentication = await authenticate(this); - client = authentication.client; - recorder = authentication.recorder; - testClient = authentication.testClient; - credential = authentication.credential; - keySuffix = authentication.keySuffix; - keyName = testClient.formatName("cryptography-client-test" + keySuffix); - keyVaultKey = await client.createKey(keyName, "RSA"); - cryptoClient = new CryptographyClient(keyVaultKey.id!, credential); - }); + beforeEach( + /** @this Mocha.Context */ async function() { + const authentication = await authenticate(this); + client = authentication.client; + recorder = authentication.recorder; + testClient = authentication.testClient; + credential = authentication.credential; + keySuffix = authentication.keySuffix; + keyName = testClient.formatName("cryptography-client-test" + keySuffix); + keyVaultKey = await client.createKey(keyName, "RSA"); + cryptoClient = new CryptographyClient(keyVaultKey.id!, credential); + } + ); - afterEach(/** @this Mocha.Context */ async function() { - if (!this.currentTest?.isPending()) { - await testClient.flushKey(keyName); + afterEach( + /** @this Mocha.Context */ async function() { + if (!this.currentTest?.isPending()) { + await testClient.flushKey(keyName); + } + await recorder.stop(); } - await recorder.stop(); - }); + ); // The tests follow @@ -233,7 +237,9 @@ describe("CryptographyClient (all decrypts happen remotely)", () => { await testClient.flushKey(hsmKeyName); }); - it("sign and verify with RS256 through an RSA-HSM key", /** @this Mocha.Context */ async function(): Promise { + it("sign and verify with RS256 through an RSA-HSM key", /** @this Mocha.Context */ async function(): Promise< + void + > { const hsmKeyName = keyName + "2"; const hsmKey = await client.createKey(hsmKeyName, "RSA-HSM"); const hsmCryptoClient = new CryptographyClient(hsmKey.id!, credential); @@ -264,7 +270,9 @@ describe("CryptographyClient (all decrypts happen remotely)", () => { await testClient.flushKey(hsmKeyName); }); - it("sign and verify with RS384 through an RSA-HSM key", /** @this Mocha.Context */ async function(): Promise { + it("sign and verify with RS384 through an RSA-HSM key", /** @this Mocha.Context */ async function(): Promise< + void + > { const hsmKeyName = keyName + "2"; const hsmKey = await client.createKey(hsmKeyName, "RSA-HSM"); const hsmCryptoClient = new CryptographyClient(hsmKey.id!, credential); diff --git a/sdk/keyvault/keyvault-keys/test/public/import.spec.ts b/sdk/keyvault/keyvault-keys/test/public/import.spec.ts index 3c268beb9c5d..73dc9c9aef3e 100644 --- a/sdk/keyvault/keyvault-keys/test/public/import.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/public/import.spec.ts @@ -16,13 +16,15 @@ describe("Keys client - import keys", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this Mocha.Context */ async function() { - const authentication = await authenticate(this); - suffix = authentication.keySuffix; - client = authentication.client; - testClient = authentication.testClient; - recorder = authentication.recorder; - }); + beforeEach( + /** @this Mocha.Context */ async function() { + const authentication = await authenticate(this); + suffix = authentication.keySuffix; + client = authentication.client; + testClient = authentication.testClient; + recorder = authentication.recorder; + } + ); afterEach(async function() { await recorder.stop(); diff --git a/sdk/keyvault/keyvault-keys/test/public/list.spec.ts b/sdk/keyvault/keyvault-keys/test/public/list.spec.ts index 52b1283c3509..b69f177d6253 100644 --- a/sdk/keyvault/keyvault-keys/test/public/list.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/public/list.spec.ts @@ -20,13 +20,15 @@ versionsToTest(serviceApiVersions, {}, (serviceVersion, onVersions) => { let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this Mocha.Context */ async function() { - const authentication = await authenticate(this, serviceVersion); - keySuffix = authentication.keySuffix; - client = authentication.client; - testClient = authentication.testClient; - recorder = authentication.recorder; - }); + beforeEach( + /** @this Mocha.Context */ async function() { + const authentication = await authenticate(this, serviceVersion); + keySuffix = authentication.keySuffix; + client = authentication.client; + testClient = authentication.testClient; + recorder = authentication.recorder; + } + ); afterEach(async function() { await recorder.stop(); diff --git a/sdk/keyvault/keyvault-keys/test/public/localCryptography.spec.ts b/sdk/keyvault/keyvault-keys/test/public/localCryptography.spec.ts index 8aa92dd29cbc..6b877d10cfaa 100644 --- a/sdk/keyvault/keyvault-keys/test/public/localCryptography.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/public/localCryptography.spec.ts @@ -33,14 +33,16 @@ describe("Local cryptography public tests", () => { return; } - beforeEach(/** @this Mocha.Context */ async function() { - const authentication = await authenticate(this); - client = authentication.client; - recorder = authentication.recorder; - testClient = authentication.testClient; - credential = authentication.credential; - keySuffix = authentication.keySuffix; - }); + beforeEach( + /** @this Mocha.Context */ async function() { + const authentication = await authenticate(this); + client = authentication.client; + recorder = authentication.recorder; + testClient = authentication.testClient; + credential = authentication.credential; + keySuffix = authentication.keySuffix; + } + ); afterEach(async function() { await recorder.stop(); @@ -51,11 +53,13 @@ describe("Local cryptography public tests", () => { let customKeyVaultKey: KeyVaultKey; let cryptoClientFromKey: CryptographyClient; - beforeEach(/** @this Mocha.Context */ async function() { - customKeyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); - customKeyVaultKey = await client.createKey(customKeyName, "RSA"); - cryptoClientFromKey = new CryptographyClient(customKeyVaultKey.key!); - }); + beforeEach( + /** @this Mocha.Context */ async function() { + customKeyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); + customKeyVaultKey = await client.createKey(customKeyName, "RSA"); + cryptoClientFromKey = new CryptographyClient(customKeyVaultKey.key!); + } + ); it("the CryptographyClient can be created from a local JsonWebKey object", async function() { assert.isEmpty(cryptoClientFromKey.vaultUrl); @@ -190,35 +194,43 @@ describe("Local cryptography public tests", () => { const localSupportedAlgorithmNames = Object.keys(rsaProvider.signatureAlgorithmToHashAlgorithm); for (const localAlgorithmName of localSupportedAlgorithmNames) { - it(localAlgorithmName, /** @this Mocha.Context */ async function(): Promise { - recorder.skip( - "browser", - `Local sign of algorithm ${localAlgorithmName} is only supported in NodeJS` - ); - - const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); - const keyVaultKey = await client.createKey(keyName, "RSA"); - const cryptoClient = new CryptographyClient(keyVaultKey.id!, credential); - - // Sign is not implemented yet. - // This boils down to the JWK to PEM conversion, which doesn't support private keys at the moment. - const signatureValue = this.test!.title; - const hash = createHash(rsaProvider.signatureAlgorithmToHashAlgorithm[localAlgorithmName]); - hash.update(signatureValue); - const digest = hash.digest(); - const signature = await cryptoClient.sign(localAlgorithmName as SignatureAlgorithm, digest); - - // Local Cryptography Client part - const localCryptoClient = new CryptographyClient(keyVaultKey.key!); - const verifyResult = await localCryptoClient.verifyData( - localAlgorithmName as LocalSupportedAlgorithmName, - digest, - signature.result - ); - assert.ok(verifyResult); - - await testClient.flushKey(keyName); - }); + it( + localAlgorithmName, + /** @this Mocha.Context */ async function(): Promise { + recorder.skip( + "browser", + `Local sign of algorithm ${localAlgorithmName} is only supported in NodeJS` + ); + + const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`); + const keyVaultKey = await client.createKey(keyName, "RSA"); + const cryptoClient = new CryptographyClient(keyVaultKey.id!, credential); + + // Sign is not implemented yet. + // This boils down to the JWK to PEM conversion, which doesn't support private keys at the moment. + const signatureValue = this.test!.title; + const hash = createHash( + rsaProvider.signatureAlgorithmToHashAlgorithm[localAlgorithmName] + ); + hash.update(signatureValue); + const digest = hash.digest(); + const signature = await cryptoClient.sign( + localAlgorithmName as SignatureAlgorithm, + digest + ); + + // Local Cryptography Client part + const localCryptoClient = new CryptographyClient(keyVaultKey.key!); + const verifyResult = await localCryptoClient.verifyData( + localAlgorithmName as LocalSupportedAlgorithmName, + digest, + signature.result + ); + assert.ok(verifyResult); + + await testClient.flushKey(keyName); + } + ); } }); }); diff --git a/sdk/keyvault/keyvault-keys/test/public/lro.delete.spec.ts b/sdk/keyvault/keyvault-keys/test/public/lro.delete.spec.ts index b0ecf505af6d..7184d8dbaa2f 100644 --- a/sdk/keyvault/keyvault-keys/test/public/lro.delete.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/public/lro.delete.spec.ts @@ -17,13 +17,15 @@ describe("Keys client - Long Running Operations - delete", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this Mocha.Context */ async function() { - const authentication = await authenticate(this); - keySuffix = authentication.keySuffix; - client = authentication.client; - testClient = authentication.testClient; - recorder = authentication.recorder; - }); + beforeEach( + /** @this Mocha.Context */ async function() { + const authentication = await authenticate(this); + keySuffix = authentication.keySuffix; + client = authentication.client; + testClient = authentication.testClient; + recorder = authentication.recorder; + } + ); afterEach(async function() { await recorder.stop(); diff --git a/sdk/keyvault/keyvault-keys/test/public/lro.recoverDelete.spec.ts b/sdk/keyvault/keyvault-keys/test/public/lro.recoverDelete.spec.ts index e190055e3a4c..ac8769138cfd 100644 --- a/sdk/keyvault/keyvault-keys/test/public/lro.recoverDelete.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/public/lro.recoverDelete.spec.ts @@ -18,13 +18,15 @@ describe("Keys client - Long Running Operations - recoverDelete", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this Mocha.Context */ async function() { - const authentication = await authenticate(this); - keySuffix = authentication.keySuffix; - client = authentication.client; - testClient = authentication.testClient; - recorder = authentication.recorder; - }); + beforeEach( + /** @this Mocha.Context */ async function() { + const authentication = await authenticate(this); + keySuffix = authentication.keySuffix; + client = authentication.client; + testClient = authentication.testClient; + recorder = authentication.recorder; + } + ); afterEach(async function() { await recorder.stop(); diff --git a/sdk/keyvault/keyvault-keys/test/public/recoverBackupRestore.spec.ts b/sdk/keyvault/keyvault-keys/test/public/recoverBackupRestore.spec.ts index 6f8f1dd27ec5..14cfaba62c4f 100644 --- a/sdk/keyvault/keyvault-keys/test/public/recoverBackupRestore.spec.ts +++ b/sdk/keyvault/keyvault-keys/test/public/recoverBackupRestore.spec.ts @@ -17,13 +17,15 @@ describe("Keys client - restore keys and recover backups", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this Mocha.Context */ async function() { - const authentication = await authenticate(this); - keySuffix = authentication.keySuffix; - client = authentication.client; - testClient = authentication.testClient; - recorder = authentication.recorder; - }); + beforeEach( + /** @this Mocha.Context */ async function() { + const authentication = await authenticate(this); + keySuffix = authentication.keySuffix; + client = authentication.client; + testClient = authentication.testClient; + recorder = authentication.recorder; + } + ); afterEach(async function() { await recorder.stop(); diff --git a/sdk/keyvault/keyvault-secrets/test/internal/challengeBasedAuthenticationPolicy.spec.ts b/sdk/keyvault/keyvault-secrets/test/internal/challengeBasedAuthenticationPolicy.spec.ts index dd319054d663..5c3c9adddbb2 100644 --- a/sdk/keyvault/keyvault-secrets/test/internal/challengeBasedAuthenticationPolicy.spec.ts +++ b/sdk/keyvault/keyvault-secrets/test/internal/challengeBasedAuthenticationPolicy.spec.ts @@ -26,13 +26,15 @@ describe("Challenge based authentication tests", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this Mocha.Context */ async function() { - const authentication = await authenticate(this); - secretSuffix = authentication.secretSuffix; - client = authentication.client; - testClient = authentication.testClient; - recorder = authentication.recorder; - }); + beforeEach( + /** @this Mocha.Context */ async function() { + const authentication = await authenticate(this); + secretSuffix = authentication.secretSuffix; + client = authentication.client; + testClient = authentication.testClient; + recorder = authentication.recorder; + } + ); afterEach(async function() { await recorder.stop(); diff --git a/sdk/keyvault/keyvault-secrets/test/public/CRUD.spec.ts b/sdk/keyvault/keyvault-secrets/test/public/CRUD.spec.ts index fb487c855daa..d941ee8c085e 100644 --- a/sdk/keyvault/keyvault-secrets/test/public/CRUD.spec.ts +++ b/sdk/keyvault/keyvault-secrets/test/public/CRUD.spec.ts @@ -19,13 +19,15 @@ describe("Secret client - create, read, update and delete operations", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this Mocha.Context */ async function() { - const authentication = await authenticate(this); - secretSuffix = authentication.secretSuffix; - client = authentication.client; - testClient = authentication.testClient; - recorder = authentication.recorder; - }); + beforeEach( + /** @this Mocha.Context */ async function() { + const authentication = await authenticate(this); + secretSuffix = authentication.secretSuffix; + client = authentication.client; + testClient = authentication.testClient; + recorder = authentication.recorder; + } + ); afterEach(async function() { await recorder.stop(); diff --git a/sdk/keyvault/keyvault-secrets/test/public/list.spec.ts b/sdk/keyvault/keyvault-secrets/test/public/list.spec.ts index 7b22b1c8a56a..a32c8c0bf77c 100644 --- a/sdk/keyvault/keyvault-secrets/test/public/list.spec.ts +++ b/sdk/keyvault/keyvault-secrets/test/public/list.spec.ts @@ -21,13 +21,15 @@ describe("Secret client - list secrets in various ways", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this Mocha.Context */ async function() { - const authentication = await authenticate(this); - secretSuffix = authentication.secretSuffix; - client = authentication.client; - testClient = authentication.testClient; - recorder = authentication.recorder; - }); + beforeEach( + /** @this Mocha.Context */ async function() { + const authentication = await authenticate(this); + secretSuffix = authentication.secretSuffix; + client = authentication.client; + testClient = authentication.testClient; + recorder = authentication.recorder; + } + ); afterEach(async function() { await recorder.stop(); diff --git a/sdk/keyvault/keyvault-secrets/test/public/lro.delete.spec.ts b/sdk/keyvault/keyvault-secrets/test/public/lro.delete.spec.ts index 259b60cfff41..60e83731f084 100644 --- a/sdk/keyvault/keyvault-secrets/test/public/lro.delete.spec.ts +++ b/sdk/keyvault/keyvault-secrets/test/public/lro.delete.spec.ts @@ -18,13 +18,15 @@ describe("Secrets client - Long Running Operations - delete", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this Mocha.Context */ async function() { - const authentication = await authenticate(this); - secretSuffix = authentication.secretSuffix; - client = authentication.client; - testClient = authentication.testClient; - recorder = authentication.recorder; - }); + beforeEach( + /** @this Mocha.Context */ async function() { + const authentication = await authenticate(this); + secretSuffix = authentication.secretSuffix; + client = authentication.client; + testClient = authentication.testClient; + recorder = authentication.recorder; + } + ); afterEach(async function() { await recorder.stop(); diff --git a/sdk/keyvault/keyvault-secrets/test/public/lro.recover.spec.ts b/sdk/keyvault/keyvault-secrets/test/public/lro.recover.spec.ts index fc4f011cb498..f26b4bb5b09f 100644 --- a/sdk/keyvault/keyvault-secrets/test/public/lro.recover.spec.ts +++ b/sdk/keyvault/keyvault-secrets/test/public/lro.recover.spec.ts @@ -18,13 +18,15 @@ describe("Secrets client - Long Running Operations - recoverDelete", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this Mocha.Context */ async function() { - const authentication = await authenticate(this); - secretSuffix = authentication.secretSuffix; - client = authentication.client; - testClient = authentication.testClient; - recorder = authentication.recorder; - }); + beforeEach( + /** @this Mocha.Context */ async function() { + const authentication = await authenticate(this); + secretSuffix = authentication.secretSuffix; + client = authentication.client; + testClient = authentication.testClient; + recorder = authentication.recorder; + } + ); afterEach(async function() { await recorder.stop(); diff --git a/sdk/keyvault/keyvault-secrets/test/public/recoverBackupRestore.spec.ts b/sdk/keyvault/keyvault-secrets/test/public/recoverBackupRestore.spec.ts index c9b09465aeb4..84dc3f97a77d 100644 --- a/sdk/keyvault/keyvault-secrets/test/public/recoverBackupRestore.spec.ts +++ b/sdk/keyvault/keyvault-secrets/test/public/recoverBackupRestore.spec.ts @@ -18,13 +18,15 @@ describe("Secret client - restore secrets and recover backups", () => { let testClient: TestClient; let recorder: Recorder; - beforeEach(/** @this Mocha.Context */ async function() { - const authentication = await authenticate(this); - secretSuffix = authentication.secretSuffix; - client = authentication.client; - testClient = authentication.testClient; - recorder = authentication.recorder; - }); + beforeEach( + /** @this Mocha.Context */ async function() { + const authentication = await authenticate(this); + secretSuffix = authentication.secretSuffix; + client = authentication.client; + testClient = authentication.testClient; + recorder = authentication.recorder; + } + ); afterEach(async function() { await recorder.stop(); diff --git a/sdk/metricsadvisor/ai-metrics-advisor/test/public/adminclient.spec.ts b/sdk/metricsadvisor/ai-metrics-advisor/test/public/adminclient.spec.ts index 5270921af0dd..ba12db6b72d3 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/test/public/adminclient.spec.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/test/public/adminclient.spec.ts @@ -19,9 +19,11 @@ matrix([[true, false]] as const, async (useAad) => { let client: MetricsAdvisorAdministrationClient; let recorder: Recorder; - beforeEach(/** @this Mocha.Context */ function() { - ({ recorder, client } = createRecordedAdminClient(this, makeCredential(useAad))); - }); + beforeEach( + /** @this Mocha.Context */ function() { + ({ recorder, client } = createRecordedAdminClient(this, makeCredential(useAad))); + } + ); afterEach(async function() { if (recorder) { diff --git a/sdk/metricsadvisor/ai-metrics-advisor/test/public/advisorclient.spec.ts b/sdk/metricsadvisor/ai-metrics-advisor/test/public/advisorclient.spec.ts index b91bde30857f..b434c2325203 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/test/public/advisorclient.spec.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/test/public/advisorclient.spec.ts @@ -20,9 +20,11 @@ matrix([[true, false]] as const, async (useAad) => { let client: MetricsAdvisorClient; let recorder: Recorder; - beforeEach(/** @this Mocha.Context */ function() { - ({ recorder, client } = createRecordedAdvisorClient(this, makeCredential(useAad))); - }); + beforeEach( + /** @this Mocha.Context */ function() { + ({ recorder, client } = createRecordedAdvisorClient(this, makeCredential(useAad))); + } + ); afterEach(async function() { if (recorder) { diff --git a/sdk/metricsadvisor/ai-metrics-advisor/test/public/datafeed.spec.ts b/sdk/metricsadvisor/ai-metrics-advisor/test/public/datafeed.spec.ts index e6f680b4fe2a..e6a5c6635dcb 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/test/public/datafeed.spec.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/test/public/datafeed.spec.ts @@ -36,42 +36,44 @@ matrix([[true, false]] as const, async (useAad) => { let mySqlFeedName: string; let postgreSqlFeedName: string; - beforeEach(/** @this Mocha.Context */ function() { - ({ recorder, client } = createRecordedAdminClient(this, makeCredential(useAad))); - if (recorder && !feedName) { - feedName = recorder.getUniqueName("js-test-datafeed-"); - } - if (recorder && !appInsightsFeedName) { - appInsightsFeedName = recorder.getUniqueName("js-test-appInsightsFeed-"); - } - if (recorder && !sqlServerFeedName) { - sqlServerFeedName = recorder.getUniqueName("js-test-sqlServerFeed-"); - } - if (recorder && !cosmosFeedName) { - cosmosFeedName = recorder.getUniqueName("js-test-cosmosFeed-"); - } - if (recorder && !dataExplorerFeedName) { - dataExplorerFeedName = recorder.getUniqueName("js-test-dataExplorerFeed-"); - } - if (recorder && !azureTableFeedName) { - azureTableFeedName = recorder.getUniqueName("js-test-tableFeed-"); - } - if (recorder && !httpRequestFeedName) { - httpRequestFeedName = recorder.getUniqueName("js-test-httpRequestFeed-"); - } - if (recorder && !influxDbFeedName) { - influxDbFeedName = recorder.getUniqueName("js-test-influxdbFeed-"); - } - if (recorder && !mongoDbFeedName) { - mongoDbFeedName = recorder.getUniqueName("js-test-mongoDbFeed-"); - } - if (recorder && !mySqlFeedName) { - mySqlFeedName = recorder.getUniqueName("js-test-mySqlFeed-"); - } - if (recorder && !postgreSqlFeedName) { - postgreSqlFeedName = recorder.getUniqueName("js-test-postgreSqlFeed-"); + beforeEach( + /** @this Mocha.Context */ function() { + ({ recorder, client } = createRecordedAdminClient(this, makeCredential(useAad))); + if (recorder && !feedName) { + feedName = recorder.getUniqueName("js-test-datafeed-"); + } + if (recorder && !appInsightsFeedName) { + appInsightsFeedName = recorder.getUniqueName("js-test-appInsightsFeed-"); + } + if (recorder && !sqlServerFeedName) { + sqlServerFeedName = recorder.getUniqueName("js-test-sqlServerFeed-"); + } + if (recorder && !cosmosFeedName) { + cosmosFeedName = recorder.getUniqueName("js-test-cosmosFeed-"); + } + if (recorder && !dataExplorerFeedName) { + dataExplorerFeedName = recorder.getUniqueName("js-test-dataExplorerFeed-"); + } + if (recorder && !azureTableFeedName) { + azureTableFeedName = recorder.getUniqueName("js-test-tableFeed-"); + } + if (recorder && !httpRequestFeedName) { + httpRequestFeedName = recorder.getUniqueName("js-test-httpRequestFeed-"); + } + if (recorder && !influxDbFeedName) { + influxDbFeedName = recorder.getUniqueName("js-test-influxdbFeed-"); + } + if (recorder && !mongoDbFeedName) { + mongoDbFeedName = recorder.getUniqueName("js-test-mongoDbFeed-"); + } + if (recorder && !mySqlFeedName) { + mySqlFeedName = recorder.getUniqueName("js-test-mySqlFeed-"); + } + if (recorder && !postgreSqlFeedName) { + postgreSqlFeedName = recorder.getUniqueName("js-test-postgreSqlFeed-"); + } } - }); + ); afterEach(async function() { if (recorder) { @@ -807,7 +809,7 @@ matrix([[true, false]] as const, async (useAad) => { /** * @this - * eslint-disable-next-line \@typescript-eslint/explicit-module-boundary-types + * eslint-disable-next-line \@typescript-eslint/explicit-module-boundary-types */ export async function verifyDataFeedDeletion( // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types diff --git a/sdk/metricsadvisor/ai-metrics-advisor/test/public/hookTests.spec.ts b/sdk/metricsadvisor/ai-metrics-advisor/test/public/hookTests.spec.ts index 2439026701a8..4c4bb60d3ea2 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/test/public/hookTests.spec.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/test/public/hookTests.spec.ts @@ -24,15 +24,17 @@ matrix([[true, false]] as const, async (useAad) => { let emailHookName: string; let webHookName: string; - beforeEach(/** @this Mocha.Context */ function() { - ({ recorder, client } = createRecordedAdminClient(this, makeCredential(useAad))); - if (recorder && !emailHookName) { - emailHookName = recorder.getUniqueName("js-test-emailHook-"); - } - if (recorder && !webHookName) { - webHookName = recorder.getUniqueName("js-test-webHook-"); + beforeEach( + /** @this Mocha.Context */ function() { + ({ recorder, client } = createRecordedAdminClient(this, makeCredential(useAad))); + if (recorder && !emailHookName) { + emailHookName = recorder.getUniqueName("js-test-emailHook-"); + } + if (recorder && !webHookName) { + webHookName = recorder.getUniqueName("js-test-webHook-"); + } } - }); + ); afterEach(async function() { if (recorder) { diff --git a/sdk/mixedreality/mixedreality-authentication/test/mixedRealityStsClient.spec.ts b/sdk/mixedreality/mixedreality-authentication/test/mixedRealityStsClient.spec.ts index 0c4a32e235de..9652fb026c82 100644 --- a/sdk/mixedreality/mixedreality-authentication/test/mixedRealityStsClient.spec.ts +++ b/sdk/mixedreality/mixedreality-authentication/test/mixedRealityStsClient.spec.ts @@ -77,10 +77,12 @@ describe("[AccountKey] MixedRealityStsClient functional tests", function() { let client: MixedRealityStsClient; let recorder: Recorder; - beforeEach(/** @this Mocha.Context */ function() { - recorder = createRecorder(this); - client = createClient(); - }); + beforeEach( + /** @this Mocha.Context */ function() { + recorder = createRecorder(this); + client = createClient(); + } + ); afterEach(async function() { // Stop the recording. diff --git a/sdk/schemaregistry/schema-registry/test/schemaRegistry.spec.ts b/sdk/schemaregistry/schema-registry/test/schemaRegistry.spec.ts index c2b4a0e45ff9..77718fccaefb 100644 --- a/sdk/schemaregistry/schema-registry/test/schemaRegistry.spec.ts +++ b/sdk/schemaregistry/schema-registry/test/schemaRegistry.spec.ts @@ -62,9 +62,11 @@ describe("SchemaRegistryClient", function() { let recorder: Recorder; let client: SchemaRegistryClient; - beforeEach(/** @this Mocha.Context */ function() { - ({ client, recorder } = createRecordedClient(this)); - }); + beforeEach( + /** @this Mocha.Context */ function() { + ({ client, recorder } = createRecordedClient(this)); + } + ); afterEach(async function() { await recorder.stop(); diff --git a/sdk/search/search-documents/test/public/node/searchClient.spec.ts b/sdk/search/search-documents/test/public/node/searchClient.spec.ts index c1b63922f2f4..ba1d47853bb4 100644 --- a/sdk/search/search-documents/test/public/node/searchClient.spec.ts +++ b/sdk/search/search-documents/test/public/node/searchClient.spec.ts @@ -25,17 +25,19 @@ describe("SearchClient", /** @this Mocha.Context */ function() { this.timeout(99999); - beforeEach(/** @this Mocha.Context */ async function() { - ({ searchClient, indexClient } = createClients(TEST_INDEX_NAME)); - if (!isPlaybackMode()) { - await createIndex(indexClient, TEST_INDEX_NAME); - await delay(WAIT_TIME); - await populateIndex(searchClient); + beforeEach( + /** @this Mocha.Context */ async function() { + ({ searchClient, indexClient } = createClients(TEST_INDEX_NAME)); + if (!isPlaybackMode()) { + await createIndex(indexClient, TEST_INDEX_NAME); + await delay(WAIT_TIME); + await populateIndex(searchClient); + } + recorder = record(this, environmentSetup); + // create the clients again, but hooked up to the recorder + ({ searchClient, indexClient } = createClients(TEST_INDEX_NAME)); } - recorder = record(this, environmentSetup); - // create the clients again, but hooked up to the recorder - ({ searchClient, indexClient } = createClients(TEST_INDEX_NAME)); - }); + ); afterEach(async function() { if (recorder) { diff --git a/sdk/search/search-documents/test/public/node/searchIndexClient.spec.ts b/sdk/search/search-documents/test/public/node/searchIndexClient.spec.ts index eac6d85cb571..6884e9d1fa0d 100644 --- a/sdk/search/search-documents/test/public/node/searchIndexClient.spec.ts +++ b/sdk/search/search-documents/test/public/node/searchIndexClient.spec.ts @@ -23,17 +23,19 @@ describe("SearchIndexClient", /** @this Mocha.Context */ function() { this.timeout(99999); - beforeEach(/** @this Mocha.Context */ async function() { - ({ indexClient } = createClients(TEST_INDEX_NAME)); - if (!isPlaybackMode()) { - await createSynonymMaps(indexClient); - await createSimpleIndex(indexClient, TEST_INDEX_NAME); - await delay(WAIT_TIME); + beforeEach( + /** @this Mocha.Context */ async function() { + ({ indexClient } = createClients(TEST_INDEX_NAME)); + if (!isPlaybackMode()) { + await createSynonymMaps(indexClient); + await createSimpleIndex(indexClient, TEST_INDEX_NAME); + await delay(WAIT_TIME); + } + recorder = record(this, environmentSetup); + // create the clients again, but hooked up to the recorder + ({ indexClient } = createClients(TEST_INDEX_NAME)); } - recorder = record(this, environmentSetup); - // create the clients again, but hooked up to the recorder - ({ indexClient } = createClients(TEST_INDEX_NAME)); - }); + ); afterEach(async function() { if (recorder) { diff --git a/sdk/search/search-documents/test/public/node/searchIndexerClient.spec.ts b/sdk/search/search-documents/test/public/node/searchIndexerClient.spec.ts index bc233cb7742a..733aa1ddd73b 100644 --- a/sdk/search/search-documents/test/public/node/searchIndexerClient.spec.ts +++ b/sdk/search/search-documents/test/public/node/searchIndexerClient.spec.ts @@ -34,19 +34,21 @@ describe("SearchIndexerClient", /** @this Mocha.Context */ function() { this.timeout(99999); - beforeEach(/** @this Mocha.Context */ async function() { - ({ indexClient, indexerClient } = createClients(TEST_INDEX_NAME)); - if (!isPlaybackMode()) { - await createDataSourceConnections(indexerClient); - await createSkillsets(indexerClient); - await createIndex(indexClient, TEST_INDEX_NAME); - await delay(5000); - await createIndexers(indexerClient, TEST_INDEX_NAME); + beforeEach( + /** @this Mocha.Context */ async function() { + ({ indexClient, indexerClient } = createClients(TEST_INDEX_NAME)); + if (!isPlaybackMode()) { + await createDataSourceConnections(indexerClient); + await createSkillsets(indexerClient); + await createIndex(indexClient, TEST_INDEX_NAME); + await delay(5000); + await createIndexers(indexerClient, TEST_INDEX_NAME); + } + recorder = record(this, environmentSetup); + // create the clients again, but hooked up to the recorder + ({ indexClient, indexerClient } = createClients(TEST_INDEX_NAME)); } - recorder = record(this, environmentSetup); - // create the clients again, but hooked up to the recorder - ({ indexClient, indexerClient } = createClients(TEST_INDEX_NAME)); - }); + ); afterEach(async function() { if (recorder) { diff --git a/sdk/tables/data-tables/test/integration/batch.spec.ts b/sdk/tables/data-tables/test/integration/batch.spec.ts index 56cdab58d798..0d6375845baf 100644 --- a/sdk/tables/data-tables/test/integration/batch.spec.ts +++ b/sdk/tables/data-tables/test/integration/batch.spec.ts @@ -26,19 +26,21 @@ describe("batch operations", () => { // which wouldn't match the recorded one. Fallingback to SAS for recorded tests. const authMode = !isNode || !isLiveMode() ? "SASConnectionString" : "AccountConnectionString"; - beforeEach(/** @this Mocha.Context */ async function() { - sinon.stub(Uuid, "generateUuid").returns("fakeId"); - recorder = record(this, recordedEnvironmentSetup); - client = createTableClient(tableName, authMode); - - try { - if (!isPlaybackMode()) { - await client.create(); + beforeEach( + /** @this Mocha.Context */ async function() { + sinon.stub(Uuid, "generateUuid").returns("fakeId"); + recorder = record(this, recordedEnvironmentSetup); + client = createTableClient(tableName, authMode); + + try { + if (!isPlaybackMode()) { + await client.create(); + } + } catch { + console.warn("Table already exists"); } - } catch { - console.warn("Table already exists"); } - }); + ); afterEach(async function() { sinon.restore(); diff --git a/sdk/tables/data-tables/test/integration/tableclient.spec.ts b/sdk/tables/data-tables/test/integration/tableclient.spec.ts index ebe5c6a9864c..2505d6f5645e 100644 --- a/sdk/tables/data-tables/test/integration/tableclient.spec.ts +++ b/sdk/tables/data-tables/test/integration/tableclient.spec.ts @@ -18,11 +18,13 @@ describe("TableClient", () => { // which wouldn't match the recorded one. Fallingback to SAS for recorded tests. const authMode = !isNode || !isLiveMode() ? "SASConnectionString" : "AccountConnectionString"; - beforeEach(/** @this Mocha.Context */ function() { - recorder = record(this, recordedEnvironmentSetup); + beforeEach( + /** @this Mocha.Context */ function() { + recorder = record(this, recordedEnvironmentSetup); - client = createTableClient(tableName, authMode); - }); + client = createTableClient(tableName, authMode); + } + ); before(async () => { if (!isPlaybackMode()) { @@ -43,24 +45,26 @@ describe("TableClient", () => { describe("listEntities", () => { // Create required entities for testing list operations - before(/** @this Mocha.Context */ async function() { - if (!isPlaybackMode()) { - this.timeout(10000); - await client.createEntity({ - partitionKey: listPartitionKey, - rowKey: "binary1", - foo: new Uint8Array([66, 97, 114]) - }); - - for (let i = 0; i < 20; i++) { + before( + /** @this Mocha.Context */ async function() { + if (!isPlaybackMode()) { + this.timeout(10000); await client.createEntity({ partitionKey: listPartitionKey, - rowKey: `${i}`, - foo: "testEntity" + rowKey: "binary1", + foo: new Uint8Array([66, 97, 114]) }); + + for (let i = 0; i < 20; i++) { + await client.createEntity({ + partitionKey: listPartitionKey, + rowKey: `${i}`, + foo: "testEntity" + }); + } } } - }); + ); type StringEntity = { foo: string }; type NumberEntity = { foo: number }; type DateEntity = { foo: Date }; diff --git a/sdk/tables/data-tables/test/integration/tableserviceclient.spec.ts b/sdk/tables/data-tables/test/integration/tableserviceclient.spec.ts index 9aad3812eb94..ba3c836446b0 100644 --- a/sdk/tables/data-tables/test/integration/tableserviceclient.spec.ts +++ b/sdk/tables/data-tables/test/integration/tableserviceclient.spec.ts @@ -14,10 +14,12 @@ describe("TableServiceClient", () => { const suffix = isNode ? "node" : "browser"; const authMode = !isNode || !isLiveMode() ? "SASConnectionString" : "AccountConnectionString"; - beforeEach(/** @this Mocha.Context */ function() { - recorder = record(this, recordedEnvironmentSetup); - client = createTableServiceClient(authMode); - }); + beforeEach( + /** @this Mocha.Context */ function() { + recorder = record(this, recordedEnvironmentSetup); + client = createTableServiceClient(authMode); + } + ); afterEach(async function() { await recorder.stop(); @@ -49,31 +51,35 @@ describe("TableServiceClient", () => { describe("listTables", () => { const tableNames: string[] = []; const expectedTotalItems = 20; - before(/** @this Mocha.Context */ async function() { - // Create tables to be listed - if (!isPlaybackMode()) { - this.timeout(10000); - for (let i = 0; i < 20; i++) { - const tableName = `ListTableTest${suffix}${i}`; - await client.createTable(tableName); - tableNames.push(tableName); + before( + /** @this Mocha.Context */ async function() { + // Create tables to be listed + if (!isPlaybackMode()) { + this.timeout(10000); + for (let i = 0; i < 20; i++) { + const tableName = `ListTableTest${suffix}${i}`; + await client.createTable(tableName); + tableNames.push(tableName); + } } } - }); + ); - after(/** @this Mocha.Context */ async function() { - // Cleanup tables - if (!isPlaybackMode()) { - this.timeout(10000); - try { - for (const table of tableNames) { - await client.deleteTable(table); + after( + /** @this Mocha.Context */ async function() { + // Cleanup tables + if (!isPlaybackMode()) { + this.timeout(10000); + try { + for (const table of tableNames) { + await client.deleteTable(table); + } + } catch (error) { + console.warn(`Failed to delete a table during cleanup`); } - } catch (error) { - console.warn(`Failed to delete a table during cleanup`); } } - }); + ); it("should list all", async () => { const tables = client.listTables(); diff --git a/sdk/tables/data-tables/test/unit/utils.spec.ts b/sdk/tables/data-tables/test/unit/utils.spec.ts index 2ecd65bd4dca..3559606b22a0 100644 --- a/sdk/tables/data-tables/test/unit/utils.spec.ts +++ b/sdk/tables/data-tables/test/unit/utils.spec.ts @@ -10,12 +10,14 @@ import { ConnectionString } from "../../src/utils/internalModels"; describe("Utility Helpers", () => { describe("extractConnectionStringParts", () => { describe("Account Connection String", () => { - beforeEach(/** @this Mocha.Context */ function() { - if (!isNode) { - // Account connection string is not supported for Browsers - this.skip(); + beforeEach( + /** @this Mocha.Context */ function() { + if (!isNode) { + // Account connection string is not supported for Browsers + this.skip(); + } } - }); + ); it("should handle connection string without TableEndpoint", () => { const validConnectionString = "DefaultEndpointsProtocol=https;AccountName=testaccount;AccountKey=REDACTED;EndpointSuffix=core.windows.net"; diff --git a/sdk/template/template/test/public/configurationClient.spec.ts b/sdk/template/template/test/public/configurationClient.spec.ts index 2a089f279f4d..36706d5e28f2 100644 --- a/sdk/template/template/test/public/configurationClient.spec.ts +++ b/sdk/template/template/test/public/configurationClient.spec.ts @@ -52,34 +52,36 @@ describe("[AAD] ConfigurationClient functional tests", function() { // NOTE: use of "function" and not ES6 arrow-style functions with the // beforeEach hook is IMPORTANT due to the use of `this` in the function // body. - beforeEach(/** @this Mocha.Context */ function(this: Context) { - // The recorder has some convenience methods, and we need to store a - // reference to it so that we can `stop()` the recorder later in the - // `afterEach` hook. - recorder = record(this, { - // == Recorder Environment Setup == Add the replaceable variables from - // above - replaceableVariables, - - // We don't use this in the template, but if we had any query parameters - // we wished to discard, we could add them here - queryParametersToSkip: [], - - // Finally, we need to remove the AAD `access_token` from any requests. - // This is very important, as it cannot be removed using environment - // variable or query parameter replacement. The - // `customizationsOnRecordings` field allows us to make arbitrary - // replacements within recordings. - customizationsOnRecordings: [ - (recording: any): any => - recording.replace(/"access_token":"[^"]*"/g, `"access_token":"access_token"`) - ] - }); - - // We'll be able to refer to the instantiated `client` in tests, since we - // initialize it before each test - client = createConfigurationClient(); - }); + beforeEach( + /** @this Mocha.Context */ function(this: Context) { + // The recorder has some convenience methods, and we need to store a + // reference to it so that we can `stop()` the recorder later in the + // `afterEach` hook. + recorder = record(this, { + // == Recorder Environment Setup == Add the replaceable variables from + // above + replaceableVariables, + + // We don't use this in the template, but if we had any query parameters + // we wished to discard, we could add them here + queryParametersToSkip: [], + + // Finally, we need to remove the AAD `access_token` from any requests. + // This is very important, as it cannot be removed using environment + // variable or query parameter replacement. The + // `customizationsOnRecordings` field allows us to make arbitrary + // replacements within recordings. + customizationsOnRecordings: [ + (recording: any): any => + recording.replace(/"access_token":"[^"]*"/g, `"access_token":"access_token"`) + ] + }); + + // We'll be able to refer to the instantiated `client` in tests, since we + // initialize it before each test + client = createConfigurationClient(); + } + ); // After each test, we need to stop the recording. afterEach(async function() { diff --git a/sdk/test-utils/multi-version/test/multiVersion.spec.ts b/sdk/test-utils/multi-version/test/multiVersion.spec.ts index d171af10d85b..6d0584cd5f7c 100644 --- a/sdk/test-utils/multi-version/test/multiVersion.spec.ts +++ b/sdk/test-utils/multi-version/test/multiVersion.spec.ts @@ -41,7 +41,9 @@ versionsToTest(serviceVersions, {}, (serviceVersion, onVersions) => { console.log(`creating test client for service version ${serviceVersion}`); }); - afterEach(async function() { /** empty */}); + afterEach(async function() { + /** empty */ + }); it("test case 2", function() { if (serviceVersion === "7.0") { @@ -50,7 +52,9 @@ versionsToTest(serviceVersions, {}, (serviceVersion, onVersions) => { }); describe("nested test suite 3a", function() { - it("nested test 4a", function() { /** empty */}); + it("nested test 4a", function() { + /** empty */ + }); }); onVersions(["7.0"]).describe("nested test suite 3b", function() { diff --git a/sdk/textanalytics/ai-text-analytics/test/public/apiKey.spec.ts b/sdk/textanalytics/ai-text-analytics/test/public/apiKey.spec.ts index 22b29fc1f50a..08d82c723afe 100644 --- a/sdk/textanalytics/ai-text-analytics/test/public/apiKey.spec.ts +++ b/sdk/textanalytics/ai-text-analytics/test/public/apiKey.spec.ts @@ -25,19 +25,23 @@ describe("[API Key] TextAnalyticsClient", /** @this Mocha.Context */ function() const CLITimeout = this.timeout(); const fastTimeout = 10000; - beforeEach(/** @this Mocha.Context */ function() { - recorder = createRecorder(this); - client = createClient("APIKey"); - }); + beforeEach( + /** @this Mocha.Context */ function() { + recorder = createRecorder(this); + client = createClient("APIKey"); + } + ); afterEach(async function() { await recorder.stop(); }); describe("fast tests", function() { - before(/** @this Mocha.Context */ function() { - this.timeout(fastTimeout); - }); + before( + /** @this Mocha.Context */ function() { + this.timeout(fastTimeout); + } + ); it("#analyzeSentiment", async function() { const results = await client.analyzeSentiment(testDataEn); @@ -85,9 +89,11 @@ describe("[API Key] TextAnalyticsClient", /** @this Mocha.Context */ function() describe("LROs", function() { const pollingInterval = isPlaybackMode() ? 0 : 2000; - before(/** @this Mocha.Context */ function() { - this.timeout(isPlaybackMode() ? fastTimeout : CLITimeout); - }); + before( + /** @this Mocha.Context */ function() { + this.timeout(isPlaybackMode() ? fastTimeout : CLITimeout); + } + ); describe("#health", function() { it("input strings", async function() { diff --git a/sdk/textanalytics/ai-text-analytics/test/public/textAnalyticsClient.spec.ts b/sdk/textanalytics/ai-text-analytics/test/public/textAnalyticsClient.spec.ts index f7da52f42d39..042db8123bc1 100644 --- a/sdk/textanalytics/ai-text-analytics/test/public/textAnalyticsClient.spec.ts +++ b/sdk/textanalytics/ai-text-analytics/test/public/textAnalyticsClient.spec.ts @@ -43,24 +43,28 @@ describe("[AAD] TextAnalyticsClient", /** @this Mocha.Context */ function() { let getId: () => string; - beforeEach(/** @this Mocha.Context */ function() { - recorder = createRecorder(this); - client = createClient("AAD"); - let nextId = 0; - getId = function() { - nextId += 1; - return nextId.toString(); - }; - }); + beforeEach( + /** @this Mocha.Context */ function() { + recorder = createRecorder(this); + client = createClient("AAD"); + let nextId = 0; + getId = function() { + nextId += 1; + return nextId.toString(); + }; + } + ); afterEach(async function() { await recorder.stop(); }); describe("fast tests", function() { - before(/** @this Mocha.Context */ function() { - this.timeout(fastTimeout); - }); + before( + /** @this Mocha.Context */ function() { + this.timeout(fastTimeout); + } + ); describe("#analyzeSentiment", function() { it("client throws on empty list", async function() { @@ -926,9 +930,11 @@ describe("[AAD] TextAnalyticsClient", /** @this Mocha.Context */ function() { describe("LROs", function() { const pollingInterval = isPlaybackMode() ? 0 : 2000; - before(/** @this Mocha.Context */ function() { - this.timeout(isPlaybackMode() ? fastTimeout : CLITimeout); - }); + before( + /** @this Mocha.Context */ function() { + this.timeout(isPlaybackMode() ? fastTimeout : CLITimeout); + } + ); describe("#analyze", function() { it("single entity recognition action", async function() { From 5dcd6e1f5615a987bba770dc0d609ea0ae15a138 Mon Sep 17 00:00:00 2001 From: deyaaeldeen Date: Mon, 22 Mar 2021 20:47:05 +0000 Subject: [PATCH 6/9] missed cases --- .../keyvault-certificates/test/utils/lro/restore/operation.ts | 4 ++-- .../keyvault-keys/test/utils/lro/restore/operation.ts | 4 ++-- .../keyvault-secrets/test/utils/lro/restore/operation.ts | 4 ++-- .../ai-metrics-advisor/test/public/datafeed.spec.ts | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sdk/keyvault/keyvault-certificates/test/utils/lro/restore/operation.ts b/sdk/keyvault/keyvault-certificates/test/utils/lro/restore/operation.ts index 357da1323045..ee50a6c3e574 100644 --- a/sdk/keyvault/keyvault-certificates/test/utils/lro/restore/operation.ts +++ b/sdk/keyvault/keyvault-certificates/test/utils/lro/restore/operation.ts @@ -54,7 +54,7 @@ export interface RestoreCertificateBackupPollOperation /** * Reaches to the service and updates the restore certificate's poll operation. * @param options - The optional parameters, which are an abortSignal from \@azure/abort-controller and a function that triggers the poller's onProgress function. - * @this + * @this Mocha.Context */ async function update( this: RestoreCertificateBackupPollOperation, @@ -93,7 +93,7 @@ async function cancel(this: RestoreCertificateBackupPollOperation): Promise { /** * Serializes the create key's poll operation - * @this + * @this Mocha.Context */ function toString(this: RestoreKeyBackupPollOperation): string { return JSON.stringify({ diff --git a/sdk/keyvault/keyvault-secrets/test/utils/lro/restore/operation.ts b/sdk/keyvault/keyvault-secrets/test/utils/lro/restore/operation.ts index cfef7d26394c..74f6328f152e 100644 --- a/sdk/keyvault/keyvault-secrets/test/utils/lro/restore/operation.ts +++ b/sdk/keyvault/keyvault-secrets/test/utils/lro/restore/operation.ts @@ -54,7 +54,7 @@ export interface RestoreSecretBackupPollOperation /** * Reaches to the service and updates the restore secret's poll operation. * @param options - The optional parameters, which are an abortSignal from \@azure/abort-controller and a function that triggers the poller's onProgress function. - * @this + * @this Mocha.Context */ async function update( this: RestoreSecretBackupPollOperation, @@ -93,7 +93,7 @@ async function cancel(this: RestoreSecretBackupPollOperation): Promise { /** * Serializes the create secret's poll operation - * @this + * @this Mocha.Context */ function toString(this: RestoreSecretBackupPollOperation): string { return JSON.stringify({ diff --git a/sdk/metricsadvisor/ai-metrics-advisor/test/public/datafeed.spec.ts b/sdk/metricsadvisor/ai-metrics-advisor/test/public/datafeed.spec.ts index e6a5c6635dcb..15fe8aa5035d 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/test/public/datafeed.spec.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/test/public/datafeed.spec.ts @@ -808,7 +808,7 @@ matrix([[true, false]] as const, async (useAad) => { }); /** - * @this + * @this Mocha.Context * eslint-disable-next-line \@typescript-eslint/explicit-module-boundary-types */ export async function verifyDataFeedDeletion( From 0319bd0bbb346d90aba7551a5b6e759367c96f5d Mon Sep 17 00:00:00 2001 From: deyaaeldeen Date: Mon, 22 Mar 2021 22:29:45 +0000 Subject: [PATCH 7/9] address feedback --- sdk/core/core-lro/test/utils/testOperation.ts | 4 ++-- sdk/core/logger/src/debug.ts | 4 ++-- .../keyvault-certificates/test/utils/lro/restore/operation.ts | 4 ++-- .../keyvault-keys/test/utils/lro/restore/operation.ts | 4 ++-- .../keyvault-secrets/test/utils/lro/restore/operation.ts | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sdk/core/core-lro/test/utils/testOperation.ts b/sdk/core/core-lro/test/utils/testOperation.ts index c6fbbfad6fde..b887b0ea056f 100644 --- a/sdk/core/core-lro/test/utils/testOperation.ts +++ b/sdk/core/core-lro/test/utils/testOperation.ts @@ -70,7 +70,7 @@ async function update( return makeOperation(newState); } -/** @this Mocha.Context */ +/** @this TestOperation */ async function cancel( this: TestOperation, options: { abortSignal?: AbortSignal } = {} @@ -101,7 +101,7 @@ async function cancel( }); } -/** @this Mocha.Context */ +/** @this TestOperation */ function toString(this: TestOperation): string { return JSON.stringify({ state: this.state diff --git a/sdk/core/logger/src/debug.ts b/sdk/core/logger/src/debug.ts index bdd5172672a5..1c29423fe62a 100644 --- a/sdk/core/logger/src/debug.ts +++ b/sdk/core/logger/src/debug.ts @@ -155,7 +155,7 @@ function createDebugger(namespace: string): Debugger { return newDebugger; } -/** @this Mocha.Context */ +/** @this Debugger */ function destroy(this: Debugger): boolean { const index = debuggers.indexOf(this); if (index >= 0) { @@ -165,7 +165,7 @@ function destroy(this: Debugger): boolean { return false; } -/** @this Mocha.Context */ +/** @this Debugger */ function extend(this: Debugger, namespace: string): Debugger { const newDebugger = createDebugger(`${this.namespace}:${namespace}`); newDebugger.log = this.log; diff --git a/sdk/keyvault/keyvault-certificates/test/utils/lro/restore/operation.ts b/sdk/keyvault/keyvault-certificates/test/utils/lro/restore/operation.ts index ee50a6c3e574..e9eabd39902f 100644 --- a/sdk/keyvault/keyvault-certificates/test/utils/lro/restore/operation.ts +++ b/sdk/keyvault/keyvault-certificates/test/utils/lro/restore/operation.ts @@ -54,7 +54,7 @@ export interface RestoreCertificateBackupPollOperation /** * Reaches to the service and updates the restore certificate's poll operation. * @param options - The optional parameters, which are an abortSignal from \@azure/abort-controller and a function that triggers the poller's onProgress function. - * @this Mocha.Context + * @this RestoreCertificateBackupPollOperation */ async function update( this: RestoreCertificateBackupPollOperation, @@ -93,7 +93,7 @@ async function cancel(this: RestoreCertificateBackupPollOperation): Promise { /** * Serializes the create key's poll operation - * @this Mocha.Context + * @this RestoreKeyBackupPollOperation */ function toString(this: RestoreKeyBackupPollOperation): string { return JSON.stringify({ diff --git a/sdk/keyvault/keyvault-secrets/test/utils/lro/restore/operation.ts b/sdk/keyvault/keyvault-secrets/test/utils/lro/restore/operation.ts index 74f6328f152e..be58e9a61eee 100644 --- a/sdk/keyvault/keyvault-secrets/test/utils/lro/restore/operation.ts +++ b/sdk/keyvault/keyvault-secrets/test/utils/lro/restore/operation.ts @@ -54,7 +54,7 @@ export interface RestoreSecretBackupPollOperation /** * Reaches to the service and updates the restore secret's poll operation. * @param options - The optional parameters, which are an abortSignal from \@azure/abort-controller and a function that triggers the poller's onProgress function. - * @this Mocha.Context + * @this RestoreSecretBackupPollOperation */ async function update( this: RestoreSecretBackupPollOperation, @@ -93,7 +93,7 @@ async function cancel(this: RestoreSecretBackupPollOperation): Promise { /** * Serializes the create secret's poll operation - * @this Mocha.Context + * @this RestoreSecretBackupPollOperation */ function toString(this: RestoreSecretBackupPollOperation): string { return JSON.stringify({ From 66be9bb00070c6bca01668dac2b60d31cce713c2 Mon Sep 17 00:00:00 2001 From: deyaaeldeen Date: Mon, 22 Mar 2021 22:36:20 +0000 Subject: [PATCH 8/9] missed case --- sdk/core/core-lro/test/utils/testOperation.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/core/core-lro/test/utils/testOperation.ts b/sdk/core/core-lro/test/utils/testOperation.ts index b887b0ea056f..8741abce9efb 100644 --- a/sdk/core/core-lro/test/utils/testOperation.ts +++ b/sdk/core/core-lro/test/utils/testOperation.ts @@ -21,7 +21,7 @@ export interface TestOperationState extends PollOperationState { export interface TestOperation extends PollOperation {} -/** @this Mocha.Context */ +/** @this TestOperation */ async function update( this: TestOperation, options: { From 0c9fee87ce4e3e7185ed7c225f8db06d659f78a3 Mon Sep 17 00:00:00 2001 From: deyaaeldeen Date: Mon, 22 Mar 2021 23:20:11 +0000 Subject: [PATCH 9/9] revert changes to metrics adviser's datafeed --- .../test/public/datafeed.spec.ts | 89 +++++++++---------- 1 file changed, 44 insertions(+), 45 deletions(-) diff --git a/sdk/metricsadvisor/ai-metrics-advisor/test/public/datafeed.spec.ts b/sdk/metricsadvisor/ai-metrics-advisor/test/public/datafeed.spec.ts index 15fe8aa5035d..7fc3b4a41450 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/test/public/datafeed.spec.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/test/public/datafeed.spec.ts @@ -36,44 +36,43 @@ matrix([[true, false]] as const, async (useAad) => { let mySqlFeedName: string; let postgreSqlFeedName: string; - beforeEach( - /** @this Mocha.Context */ function() { - ({ recorder, client } = createRecordedAdminClient(this, makeCredential(useAad))); - if (recorder && !feedName) { - feedName = recorder.getUniqueName("js-test-datafeed-"); - } - if (recorder && !appInsightsFeedName) { - appInsightsFeedName = recorder.getUniqueName("js-test-appInsightsFeed-"); - } - if (recorder && !sqlServerFeedName) { - sqlServerFeedName = recorder.getUniqueName("js-test-sqlServerFeed-"); - } - if (recorder && !cosmosFeedName) { - cosmosFeedName = recorder.getUniqueName("js-test-cosmosFeed-"); - } - if (recorder && !dataExplorerFeedName) { - dataExplorerFeedName = recorder.getUniqueName("js-test-dataExplorerFeed-"); - } - if (recorder && !azureTableFeedName) { - azureTableFeedName = recorder.getUniqueName("js-test-tableFeed-"); - } - if (recorder && !httpRequestFeedName) { - httpRequestFeedName = recorder.getUniqueName("js-test-httpRequestFeed-"); - } - if (recorder && !influxDbFeedName) { - influxDbFeedName = recorder.getUniqueName("js-test-influxdbFeed-"); - } - if (recorder && !mongoDbFeedName) { - mongoDbFeedName = recorder.getUniqueName("js-test-mongoDbFeed-"); - } - if (recorder && !mySqlFeedName) { - mySqlFeedName = recorder.getUniqueName("js-test-mySqlFeed-"); - } - if (recorder && !postgreSqlFeedName) { - postgreSqlFeedName = recorder.getUniqueName("js-test-postgreSqlFeed-"); - } + beforeEach(function() { + // eslint-disable-next-line no-invalid-this + ({ recorder, client } = createRecordedAdminClient(this, makeCredential(useAad))); + if (recorder && !feedName) { + feedName = recorder.getUniqueName("js-test-datafeed-"); } - ); + if (recorder && !appInsightsFeedName) { + appInsightsFeedName = recorder.getUniqueName("js-test-appInsightsFeed-"); + } + if (recorder && !sqlServerFeedName) { + sqlServerFeedName = recorder.getUniqueName("js-test-sqlServerFeed-"); + } + if (recorder && !cosmosFeedName) { + cosmosFeedName = recorder.getUniqueName("js-test-cosmosFeed-"); + } + if (recorder && !dataExplorerFeedName) { + dataExplorerFeedName = recorder.getUniqueName("js-test-dataExplorerFeed-"); + } + if (recorder && !azureTableFeedName) { + azureTableFeedName = recorder.getUniqueName("js-test-tableFeed-"); + } + if (recorder && !httpRequestFeedName) { + httpRequestFeedName = recorder.getUniqueName("js-test-httpRequestFeed-"); + } + if (recorder && !influxDbFeedName) { + influxDbFeedName = recorder.getUniqueName("js-test-influxdbFeed-"); + } + if (recorder && !mongoDbFeedName) { + mongoDbFeedName = recorder.getUniqueName("js-test-mongoDbFeed-"); + } + if (recorder && !mySqlFeedName) { + mySqlFeedName = recorder.getUniqueName("js-test-mySqlFeed-"); + } + if (recorder && !postgreSqlFeedName) { + postgreSqlFeedName = recorder.getUniqueName("js-test-postgreSqlFeed-"); + } + }); afterEach(async function() { if (recorder) { @@ -234,7 +233,7 @@ matrix([[true, false]] as const, async (useAad) => { } }); - it("retrieves an Azure Blob datafeed", /** @this Mocha.Context */ async function() { + it("retrieves an Azure Blob datafeed", async function() { // accessing environment variables here so they are already replaced by test env ones const expectedSource: DataFeedSource = { dataSourceType: "AzureBlob", @@ -246,6 +245,7 @@ matrix([[true, false]] as const, async (useAad) => { }; if (!createdAzureBlobDataFeedId) { + // eslint-disable-next-line no-invalid-this this.skip(); } @@ -273,8 +273,9 @@ matrix([[true, false]] as const, async (useAad) => { ); }); - it("updates an Azure Blob datafeed", /** @this Mocha.Context */ async function() { + it("updates an Azure Blob datafeed", async function() { if (!createdAzureBlobDataFeedId) { + // eslint-disable-next-line no-invalid-this this.skip(); } const expectedSourceParameter = { @@ -337,7 +338,7 @@ matrix([[true, false]] as const, async (useAad) => { applicationId: testEnv.METRICS_ADVISOR_AZURE_APPINSIGHTS_APPLICATION_ID, apiKey: testEnv.METRICS_ADVISOR_AZURE_APPINSIGHTS_API_KEY, query: - "let gran=60m; let starttime=datetime(@StartTime); let endtime=starttime + gran; requests | where timestamp >= starttime and timestamp < endtime | summarize request_count = count(), duration_avg_ms = avg(duration), duration_95th_ms = percentile(duration, 95), duration_max_ms = max(duration) by resultCode" + "let gran=60m; let starttime=datetime(@StartTime); let endtime=starttime + gran; requests | where timestamp >= starttime and timestamp < endtime | summarize request_count = count(), duration_avg_ms = avg(duration), duration_95th_ms = percentile(duration, 95), duration_max_ms = max(duration) by resultCode" } }; const actual = await client.createDataFeed({ @@ -364,7 +365,7 @@ matrix([[true, false]] as const, async (useAad) => { ); assert.equal( actual.source.dataSourceParameter.query, - "let gran=60m; let starttime=datetime(@StartTime); let endtime=starttime + gran; requests | where timestamp >= starttime and timestamp < endtime | summarize request_count = count(), duration_avg_ms = avg(duration), duration_95th_ms = percentile(duration, 95), duration_max_ms = max(duration) by resultCode" + "let gran=60m; let starttime=datetime(@StartTime); let endtime=starttime + gran; requests | where timestamp >= starttime and timestamp < endtime | summarize request_count = count(), duration_avg_ms = avg(duration), duration_95th_ms = percentile(duration, 95), duration_max_ms = max(duration) by resultCode" ); } }); @@ -807,10 +808,7 @@ matrix([[true, false]] as const, async (useAad) => { }); }); -/** - * @this Mocha.Context - * eslint-disable-next-line \@typescript-eslint/explicit-module-boundary-types - */ +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types export async function verifyDataFeedDeletion( // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types this: any, @@ -818,6 +816,7 @@ export async function verifyDataFeedDeletion( createdDataFeedId: string ): Promise { if (!createdDataFeedId) { + // eslint-disable-next-line no-invalid-this this.skip(); }