diff --git a/sdk/keyvault/keyvault-certificates/package.json b/sdk/keyvault/keyvault-certificates/package.json index 66da8394c9a2..e9d7ef3fe693 100644 --- a/sdk/keyvault/keyvault-certificates/package.json +++ b/sdk/keyvault/keyvault-certificates/package.json @@ -49,13 +49,13 @@ "check-format": "prettier --list-different --config ../../.prettierrc.json \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", "clean": "rimraf dist-esm dist-test typings *.tgz *.log samples/typescript/dist", "execute:js-samples": "node ../../../common/scripts/run-samples.js samples/javascript/", - "execute:ts-samples": "node ../../../common/scripts/run-samples.js samples/typescript/dist/samples/typescript/src/", + "execute:ts-samples": "node ../../../common/scripts/run-samples.js samples/typescript/dist/keyvault-certificates/samples/typescript/src/", "execute:samples": "npm run build:samples && npm run execute:js-samples && npm run execute:ts-samples", "extract-api": "tsc -p . && api-extractor run --local", "format": "prettier --write --config ../../.prettierrc.json \"src/**/*.ts\" \"samples/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", "integration-test:browser": "karma start --single-run", - "integration-test:node": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 180000 --full-trace dist-esm/keyvault-certificates/test/*.test.js", - "integration-test:node:no-timeout": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --no-timeouts --full-trace dist-esm/keyvault-certificates/test/*.test.js", + "integration-test:node": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 180000 --full-trace dist-esm/**/*.spec.js", + "integration-test:node:no-timeout": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --no-timeouts --full-trace dist-esm/**/*.spec.js", "integration-test": "npm run integration-test:node && npm run integration-test:browser", "lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]", "lint": "eslint package.json api-extractor.json src test --ext .ts -f html -o keyvault-certificates-lintReport.html", diff --git a/sdk/keyvault/keyvault-certificates/rollup.base.config.js b/sdk/keyvault/keyvault-certificates/rollup.base.config.js index 85be63fb59f8..72b70b695033 100644 --- a/sdk/keyvault/keyvault-certificates/rollup.base.config.js +++ b/sdk/keyvault/keyvault-certificates/rollup.base.config.js @@ -57,7 +57,7 @@ export function nodeConfig(test = false) { if (test) { // entry point is every test file - baseConfig.input = ["dist-esm/keyvault-certificates/test/*.test.js"]; + baseConfig.input = ["dist-esm/**/*.spec.js"]; baseConfig.plugins.unshift( multiEntry({ exports: false }), json() // This allows us to import/require the package.json file, to get the version and test it against the user agent. @@ -131,7 +131,7 @@ export function browserConfig(test = false) { baseConfig.external = ["fs", "fs-extra", "child_process", "path", "crypto", "constants"]; if (test) { baseConfig.external.push("os"); - baseConfig.input = ["dist-esm/keyvault-certificates/test/*.test.js"]; + baseConfig.input = ["dist-esm/**/*.spec.js"]; baseConfig.plugins.unshift( multiEntry({ exports: false }), json() // This allows us to import/require the package.json file, to get the version and test it against the user agent. diff --git a/sdk/keyvault/keyvault-certificates/test/challengeBasedAuthenticationPolicy.test.ts b/sdk/keyvault/keyvault-certificates/test/internal/challengeBasedAuthenticationPolicy.spc.ts similarity index 95% rename from sdk/keyvault/keyvault-certificates/test/challengeBasedAuthenticationPolicy.test.ts rename to sdk/keyvault/keyvault-certificates/test/internal/challengeBasedAuthenticationPolicy.spc.ts index acbceaf0f498..c1d0763c1ac2 100644 --- a/sdk/keyvault/keyvault-certificates/test/challengeBasedAuthenticationPolicy.test.ts +++ b/sdk/keyvault/keyvault-certificates/test/internal/challengeBasedAuthenticationPolicy.spc.ts @@ -2,17 +2,18 @@ // Licensed under the MIT license. import * as assert from "assert"; -import { CertificateClient } from "../src"; +import { createSandbox } from "sinon"; import { env, Recorder } from "@azure/test-utils-recorder"; -import { authenticate } from "./utils/testAuthentication"; -import TestClient from "./utils/testClient"; + import { AuthenticationChallengeCache, AuthenticationChallenge, parseWWWAuthenticate -} from "../../keyvault-common/src"; -import { createSandbox } from "sinon"; -import { testPollerProperties } from "./utils/recorderUtils"; +} from "../../../keyvault-common/src"; +import { CertificateClient } from "../../src"; +import { testPollerProperties } from '../utils/recorderUtils'; +import { authenticate } from "../utils/testAuthentication"; +import TestClient from "../utils/testClient"; // Following the philosophy of not testing the insides if we can test the outsides... // I present you with this "Get Out of Jail Free" card (in reference to Monopoly). diff --git a/sdk/keyvault/keyvault-certificates/test/userAgent.test.ts b/sdk/keyvault/keyvault-certificates/test/internal/userAgent.spec.ts similarity index 71% rename from sdk/keyvault/keyvault-certificates/test/userAgent.test.ts rename to sdk/keyvault/keyvault-certificates/test/internal/userAgent.spec.ts index 21ddadb74cfa..b8758871c0e4 100644 --- a/sdk/keyvault/keyvault-certificates/test/userAgent.test.ts +++ b/sdk/keyvault/keyvault-certificates/test/internal/userAgent.spec.ts @@ -2,9 +2,9 @@ // Licensed under the MIT license. import * as assert from "assert"; -import { version } from "../package.json"; -import { SDK_VERSION } from "../src/core/utils/constants"; -import { packageVersion } from "../src/core/keyVaultClientContext"; +import { version } from "../../package.json"; +import { SDK_VERSION } from "../../src/core/utils/constants"; +import { packageVersion } from "../../src/core/keyVaultClientContext"; describe("Certificates client's user agent", () => { // The tests follow diff --git a/sdk/keyvault/keyvault-certificates/test/CRUD.test.ts b/sdk/keyvault/keyvault-certificates/test/public/CRUD.spec.ts similarity index 98% rename from sdk/keyvault/keyvault-certificates/test/CRUD.test.ts rename to sdk/keyvault/keyvault-certificates/test/public/CRUD.spec.ts index 0c6b41119fe8..b3c663dd5ddd 100644 --- a/sdk/keyvault/keyvault-certificates/test/CRUD.test.ts +++ b/sdk/keyvault/keyvault-certificates/test/public/CRUD.spec.ts @@ -5,17 +5,18 @@ import os from "os"; import fs from "fs"; import childProcess from "child_process"; import * as assert from "assert"; -import { CertificateClient } from "../src"; import { env, Recorder } from "@azure/test-utils-recorder"; -import { testPollerProperties } from "./utils/recorderUtils"; -import { authenticate } from "./utils/testAuthentication"; -import TestClient from "./utils/testClient"; import { AbortController } from "@azure/abort-controller"; -import { assertThrowsAbortError } from "./utils/utils.common"; import { SecretClient } from "@azure/keyvault-secrets"; import { ClientSecretCredential } from "@azure/identity"; import { isNode } from "@azure/core-http"; +import { CertificateClient } from "../../src"; +import { assertThrowsAbortError } from "../utils/utils.common"; +import { testPollerProperties } from "../utils/recorderUtils"; +import { authenticate } from "../utils/testAuthentication"; +import TestClient from "../utils/testClient"; + describe("Certificates client - create, read, update and delete", () => { const prefix = `recover${env.CERTIFICATE_NAME || "CertificateName"}`; let suffix: string; diff --git a/sdk/keyvault/keyvault-certificates/test/list.test.ts b/sdk/keyvault/keyvault-certificates/test/public/list.spec.ts similarity index 97% rename from sdk/keyvault/keyvault-certificates/test/list.test.ts rename to sdk/keyvault/keyvault-certificates/test/public/list.spec.ts index 62b32f559fc7..be9af2ea2f4f 100644 --- a/sdk/keyvault/keyvault-certificates/test/list.test.ts +++ b/sdk/keyvault/keyvault-certificates/test/public/list.spec.ts @@ -1,15 +1,17 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import * as assert from "assert"; import chai from "chai"; -import { CertificateClient } from "../src"; +import * as assert from "assert"; import { env, isPlaybackMode, Recorder, isRecordMode } from "@azure/test-utils-recorder"; -import { testPollerProperties } from "./utils/recorderUtils"; -import { authenticate } from "./utils/testAuthentication"; -import TestClient from "./utils/testClient"; import { isNode } from "@azure/core-http"; -import { assertThrowsAbortError } from "./utils/utils.common"; + +import { CertificateClient } from "../../src"; +import { assertThrowsAbortError } from "../utils/utils.common"; +import { testPollerProperties } from "../utils/recorderUtils"; +import { authenticate } from "../utils/testAuthentication"; +import TestClient from "../utils/testClient"; + const { expect } = chai; describe("Certificates client - list certificates in various ways", () => { diff --git a/sdk/keyvault/keyvault-certificates/test/lro.create.test.ts b/sdk/keyvault/keyvault-certificates/test/public/lro.create.spec.ts similarity index 93% rename from sdk/keyvault/keyvault-certificates/test/lro.create.test.ts rename to sdk/keyvault/keyvault-certificates/test/public/lro.create.spec.ts index 79c58e2eb934..cbe2cb774853 100644 --- a/sdk/keyvault/keyvault-certificates/test/lro.create.test.ts +++ b/sdk/keyvault/keyvault-certificates/test/public/lro.create.spec.ts @@ -2,12 +2,13 @@ // Licensed under the MIT license. import * as assert from "assert"; -import { CertificateClient, KeyVaultCertificate, DefaultCertificatePolicy } from "../src"; -import { testPollerProperties } from "./utils/recorderUtils"; -import { env, Recorder } from "@azure/test-utils-recorder"; -import { authenticate } from "./utils/testAuthentication"; -import TestClient from "./utils/testClient"; import { PollerStoppedError } from "@azure/core-lro"; +import { env, Recorder } from "@azure/test-utils-recorder"; + +import { CertificateClient, KeyVaultCertificate, DefaultCertificatePolicy } from "../../src"; +import { testPollerProperties } from "../utils/recorderUtils"; +import { authenticate } from "../utils/testAuthentication"; +import TestClient from "../utils/testClient"; describe("Certificates client - LRO - create", () => { const certificatePrefix = `recover${env.CERTIFICATE_NAME || "CertificateName"}`; diff --git a/sdk/keyvault/keyvault-certificates/test/lro.delete.test.ts b/sdk/keyvault/keyvault-certificates/test/public/lro.delete.spec.ts similarity index 94% rename from sdk/keyvault/keyvault-certificates/test/lro.delete.test.ts rename to sdk/keyvault/keyvault-certificates/test/public/lro.delete.spec.ts index 82e5dbd98d25..89fd83181863 100644 --- a/sdk/keyvault/keyvault-certificates/test/lro.delete.test.ts +++ b/sdk/keyvault/keyvault-certificates/test/public/lro.delete.spec.ts @@ -2,12 +2,13 @@ // Licensed under the MIT license. import * as assert from "assert"; -import { CertificateClient, DeletedCertificate, DefaultCertificatePolicy } from "../src"; -import { testPollerProperties } from "./utils/recorderUtils"; -import { env, Recorder } from "@azure/test-utils-recorder"; -import { authenticate } from "./utils/testAuthentication"; -import TestClient from "./utils/testClient"; import { PollerStoppedError } from "@azure/core-lro"; +import { env, Recorder } from "@azure/test-utils-recorder"; + +import { CertificateClient, DeletedCertificate, DefaultCertificatePolicy } from "../../src"; +import { testPollerProperties } from "../utils/recorderUtils"; +import { authenticate } from "../utils/testAuthentication"; +import TestClient from "../utils/testClient"; describe("Certificates client - lro - delete", () => { const certificatePrefix = `recover${env.CERTIFICATE_NAME || "CertificateName"}`; diff --git a/sdk/keyvault/keyvault-certificates/test/lro.operation.test.ts b/sdk/keyvault/keyvault-certificates/test/public/lro.operation.spec.ts similarity index 94% rename from sdk/keyvault/keyvault-certificates/test/lro.operation.test.ts rename to sdk/keyvault/keyvault-certificates/test/public/lro.operation.spec.ts index 6c0100e0a48c..225a2e13f489 100644 --- a/sdk/keyvault/keyvault-certificates/test/lro.operation.test.ts +++ b/sdk/keyvault/keyvault-certificates/test/public/lro.operation.spec.ts @@ -2,16 +2,17 @@ // Licensed under the MIT license. import * as assert from "assert"; +import { env, Recorder } from "@azure/test-utils-recorder"; + import { CertificateClient, CertificateOperation, DefaultCertificatePolicy, KeyVaultCertificateWithPolicy -} from "../src"; -import { testPollerProperties } from "./utils/recorderUtils"; -import { env, Recorder } from "@azure/test-utils-recorder"; -import { authenticate } from "./utils/testAuthentication"; -import TestClient from "./utils/testClient"; +} from "../../src"; +import { testPollerProperties } from "../utils/recorderUtils"; +import { authenticate } from "../utils/testAuthentication"; +import TestClient from "../utils/testClient"; describe("Certificates client - LRO - certificate operation", () => { const certificatePrefix = `recover${env.CERTIFICATE_NAME || "CertificateName"}`; diff --git a/sdk/keyvault/keyvault-certificates/test/lro.recover.test.ts b/sdk/keyvault/keyvault-certificates/test/public/lro.recover.spec.ts similarity index 94% rename from sdk/keyvault/keyvault-certificates/test/lro.recover.test.ts rename to sdk/keyvault/keyvault-certificates/test/public/lro.recover.spec.ts index 4111c6736cc5..dae1ece5d3fa 100644 --- a/sdk/keyvault/keyvault-certificates/test/lro.recover.test.ts +++ b/sdk/keyvault/keyvault-certificates/test/public/lro.recover.spec.ts @@ -2,13 +2,14 @@ // Licensed under the MIT license. import * as assert from "assert"; -import { CertificateClient, DeletedCertificate, DefaultCertificatePolicy } from "../src"; -import { testPollerProperties } from "./utils/recorderUtils"; import { env, Recorder } from "@azure/test-utils-recorder"; -import { authenticate } from "./utils/testAuthentication"; -import TestClient from "./utils/testClient"; import { PollerStoppedError } from "@azure/core-lro"; -import { assertThrowsAbortError } from "./utils/utils.common"; + +import { CertificateClient, DeletedCertificate, DefaultCertificatePolicy } from "../../src"; +import { assertThrowsAbortError } from "../utils/utils.common"; +import { testPollerProperties } from "../utils/recorderUtils"; +import { authenticate } from "../utils/testAuthentication"; +import TestClient from "../utils/testClient"; describe("Certificates client - LRO - recoverDelete", () => { const certificatePrefix = `recover${env.CERTIFICATE_NAME || "CertificateName"}`; diff --git a/sdk/keyvault/keyvault-certificates/test/mergeAndImport.test.ts b/sdk/keyvault/keyvault-certificates/test/public/mergeAndImport.spec.ts similarity index 94% rename from sdk/keyvault/keyvault-certificates/test/mergeAndImport.test.ts rename to sdk/keyvault/keyvault-certificates/test/public/mergeAndImport.spec.ts index c895f4cff2d9..1b4ed7b7b146 100644 --- a/sdk/keyvault/keyvault-certificates/test/mergeAndImport.test.ts +++ b/sdk/keyvault/keyvault-certificates/test/public/mergeAndImport.spec.ts @@ -3,15 +3,16 @@ import fs from "fs"; import childProcess from "child_process"; -import { CertificateClient } from "../src"; -import { testPollerProperties } from "./utils/recorderUtils"; +import { isNode } from "@azure/core-http"; import { env, Recorder } from "@azure/test-utils-recorder"; -import { authenticate } from "./utils/testAuthentication"; -import TestClient from "./utils/testClient"; import { SecretClient } from "@azure/keyvault-secrets"; import { ClientSecretCredential } from "@azure/identity"; -import { base64ToUint8Array, stringToUint8Array } from "../src/utils"; -import { isNode } from "@azure/core-http"; + +import { CertificateClient } from "../../src"; +import { base64ToUint8Array, stringToUint8Array } from "../../src/utils"; +import { testPollerProperties } from "../utils/recorderUtils"; +import { authenticate } from "../utils/testAuthentication"; +import TestClient from "../utils/testClient"; describe("Certificates client - merge and import certificates", () => { const prefix = `merge${env.CERTIFICATE_NAME || "CertificateName"}`; diff --git a/sdk/keyvault/keyvault-certificates/test/recoverBackupRestore.test.ts b/sdk/keyvault/keyvault-certificates/test/public/recoverBackupRestore.spec.ts similarity index 94% rename from sdk/keyvault/keyvault-certificates/test/recoverBackupRestore.test.ts rename to sdk/keyvault/keyvault-certificates/test/public/recoverBackupRestore.spec.ts index bc6b2cbb271f..037ca96268cb 100644 --- a/sdk/keyvault/keyvault-certificates/test/recoverBackupRestore.test.ts +++ b/sdk/keyvault/keyvault-certificates/test/public/recoverBackupRestore.spec.ts @@ -2,14 +2,15 @@ // Licensed under the MIT license. import * as assert from "assert"; -import { CertificateClient } from "../src"; import { env, isPlaybackMode, Recorder, delay, isRecordMode } from "@azure/test-utils-recorder"; -import { authenticate } from "./utils/testAuthentication"; -import TestClient from "./utils/testClient"; -import { testPollerProperties } from "./utils/recorderUtils"; -import { assertThrowsAbortError } from "./utils/utils.common"; import { isNode } from "@azure/core-http"; +import { CertificateClient } from "../../src"; +import { testPollerProperties } from "../utils/recorderUtils"; +import { assertThrowsAbortError } from "../utils/utils.common"; +import { authenticate } from "../utils/testAuthentication"; +import TestClient from "../utils/testClient"; + describe("Certificates client - restore certificates and recover backups", () => { const prefix = `recover${env.CERTIFICATE_NAME || "CertificateName"}`; let suffix: string; diff --git a/sdk/keyvault/keyvault-certificates/tests.yml b/sdk/keyvault/keyvault-certificates/tests.yml index f6f36fb0890a..dd5041399c35 100644 --- a/sdk/keyvault/keyvault-certificates/tests.yml +++ b/sdk/keyvault/keyvault-certificates/tests.yml @@ -5,6 +5,7 @@ extends: parameters: PackageName: "@azure/keyvault-certificates" ResourceServiceDirectory: keyvault + TestMinMax: true EnvVars: AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id) AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id) diff --git a/sdk/keyvault/keyvault-keys/package.json b/sdk/keyvault/keyvault-keys/package.json index 66dea665fccc..f35234206fe3 100644 --- a/sdk/keyvault/keyvault-keys/package.json +++ b/sdk/keyvault/keyvault-keys/package.json @@ -41,13 +41,13 @@ "check-format": "prettier --list-different --config ../../.prettierrc.json \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", "clean": "rimraf dist dist-esm dist-test types *.tgz *.log dist-browser statistics.html coverage && rimraf src/**/*.js && rimraf test/**/*.js", "execute:js-samples": "node ../../../common/scripts/run-samples.js samples/javascript/", - "execute:ts-samples": "node ../../../common/scripts/run-samples.js samples/typescript/dist/samples/typescript/src/", + "execute:ts-samples": "node ../../../common/scripts/run-samples.js samples/typescript/dist/keyvault-keys/samples/typescript/src/", "execute:samples": "npm run build:samples && npm run execute:js-samples && npm run execute:ts-samples", "extract-api": "tsc -p . && api-extractor run --local", "format": "prettier --write --config ../../.prettierrc.json \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", "integration-test:browser": "karma start --single-run", - "integration-test:node": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 180000 --full-trace dist-esm/keyvault-keys/test/*.test.js", - "integration-test:node:no-timeout": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --no-timeouts --full-trace dist-esm/keyvault-keys/test/*.test.js", + "integration-test:node": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 180000 --full-trace dist-esm/**/*.spec.js", + "integration-test:node:no-timeout": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --no-timeouts --full-trace dist-esm/**/*.spec.js", "integration-test": "npm run integration-test:node && npm run integration-test:browser", "lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]", "lint": "eslint package.json api-extractor.json src test --ext .ts -f html -o keyvault-keys-lintReport.html", diff --git a/sdk/keyvault/keyvault-keys/rollup.base.config.js b/sdk/keyvault/keyvault-keys/rollup.base.config.js index 3023bce90ab5..6f0642fefde0 100644 --- a/sdk/keyvault/keyvault-keys/rollup.base.config.js +++ b/sdk/keyvault/keyvault-keys/rollup.base.config.js @@ -57,7 +57,7 @@ export function nodeConfig(test = false) { if (test) { // entry point is every test file - baseConfig.input = ["dist-esm/keyvault-keys/test/*.test.js"]; + baseConfig.input = ["dist-esm/**/*.spec.js"]; baseConfig.plugins.unshift( multiEntry({ exports: false }), json() // This allows us to import/require the package.json file, to get the version and test it against the user agent. @@ -128,7 +128,7 @@ export function browserConfig(test = false) { baseConfig.external = ["fs-extra", "path", "crypto", "constants"]; if (test) { - baseConfig.input = ["dist-esm/keyvault-keys/test/*.test.js"]; + baseConfig.input = ["dist-esm/**/*.spec.js"]; baseConfig.plugins.unshift( multiEntry({ exports: false }), json() // This allows us to import/require the package.json file, to get the version and test it against the user agent. diff --git a/sdk/keyvault/keyvault-keys/test/challengeBasedAuthenticationPolicy.test.ts b/sdk/keyvault/keyvault-keys/test/internal/challengeBasedAuthenticationPolicy.spec.ts similarity index 96% rename from sdk/keyvault/keyvault-keys/test/challengeBasedAuthenticationPolicy.test.ts rename to sdk/keyvault/keyvault-keys/test/internal/challengeBasedAuthenticationPolicy.spec.ts index 7d7eaaabc8ce..e08a92a5f214 100644 --- a/sdk/keyvault/keyvault-keys/test/challengeBasedAuthenticationPolicy.test.ts +++ b/sdk/keyvault/keyvault-keys/test/internal/challengeBasedAuthenticationPolicy.spec.ts @@ -2,16 +2,17 @@ // Licensed under the MIT license. import * as assert from "assert"; -import { KeyClient } from "../src"; +import { createSandbox } from "sinon"; import { env, Recorder } from "@azure/test-utils-recorder"; -import { authenticate } from "./utils/testAuthentication"; -import TestClient from "./utils/testClient"; + import { AuthenticationChallengeCache, AuthenticationChallenge, parseWWWAuthenticate -} from "../../keyvault-common/src"; -import { createSandbox } from "sinon"; +} from "../../../keyvault-common/src"; +import { KeyClient } from "../../src"; +import { authenticate } from "../utils/testAuthentication"; +import TestClient from "../utils/testClient"; // Following the philosophy of not testing the insides if we can test the outsides... // I present you with this "Get Out of Jail Free" card (in reference to Monopoly). diff --git a/sdk/keyvault/keyvault-keys/test/userAgent.test.ts b/sdk/keyvault/keyvault-keys/test/internal/userAgent.spec.ts similarity index 71% rename from sdk/keyvault/keyvault-keys/test/userAgent.test.ts rename to sdk/keyvault/keyvault-keys/test/internal/userAgent.spec.ts index 17a3d4201934..6e5a998e6fc8 100644 --- a/sdk/keyvault/keyvault-keys/test/userAgent.test.ts +++ b/sdk/keyvault/keyvault-keys/test/internal/userAgent.spec.ts @@ -2,9 +2,9 @@ // Licensed under the MIT license. import * as assert from "assert"; -import { version } from "../package.json"; -import { SDK_VERSION } from "../src/core/utils/constants"; -import { packageVersion } from "../src/core/keyVaultClientContext"; +import { version } from "../../package.json"; +import { SDK_VERSION } from "../../src/core/utils/constants"; +import { packageVersion } from "../../src/core/keyVaultClientContext"; describe("Keys client's user agent", () => { // The tests follow diff --git a/sdk/keyvault/keyvault-keys/test/CRUD.test.ts b/sdk/keyvault/keyvault-keys/test/public/CRUD.spec.ts similarity index 98% rename from sdk/keyvault/keyvault-keys/test/CRUD.test.ts rename to sdk/keyvault/keyvault-keys/test/public/CRUD.spec.ts index a7fb4a6b2151..7afcc983bbc9 100644 --- a/sdk/keyvault/keyvault-keys/test/CRUD.test.ts +++ b/sdk/keyvault/keyvault-keys/test/public/CRUD.spec.ts @@ -2,14 +2,15 @@ // Licensed under the MIT license. import * as assert from "assert"; -import { KeyClient, CreateEcKeyOptions, UpdateKeyPropertiesOptions, GetKeyOptions } from "../src"; import { RestError } from "@azure/core-http"; -import { testPollerProperties } from "./utils/recorderUtils"; -import { env, Recorder } from "@azure/test-utils-recorder"; -import { authenticate } from "./utils/testAuthentication"; -import TestClient from "./utils/testClient"; import { AbortController } from "@azure/abort-controller"; -import { assertThrowsAbortError } from "./utils/utils.common"; +import { env, Recorder } from "@azure/test-utils-recorder"; + +import { KeyClient, CreateEcKeyOptions, UpdateKeyPropertiesOptions, GetKeyOptions } from "../../src"; +import { assertThrowsAbortError } from "../utils/utils.common"; +import { testPollerProperties } from "../utils/recorderUtils"; +import { authenticate } from "../utils/testAuthentication"; +import TestClient from "../utils/testClient"; describe("Keys client - create, read, update and delete operations", () => { const keyPrefix = `recover${env.KEY_NAME || "KeyName"}`; diff --git a/sdk/keyvault/keyvault-keys/test/crypto.test.ts b/sdk/keyvault/keyvault-keys/test/public/crypto.spec.ts similarity index 94% rename from sdk/keyvault/keyvault-keys/test/crypto.test.ts rename to sdk/keyvault/keyvault-keys/test/public/crypto.spec.ts index d2b172c276aa..2a4d223d9bc6 100644 --- a/sdk/keyvault/keyvault-keys/test/crypto.test.ts +++ b/sdk/keyvault/keyvault-keys/test/public/crypto.spec.ts @@ -4,15 +4,16 @@ import * as assert from "assert"; import { createHash, publicEncrypt } from "crypto"; import * as constants from "constants"; -import { ClientSecretCredential } from "@azure/identity"; -import { CryptographyClient, KeyVaultKey, KeyClient } from "../src"; -import { convertJWKtoPEM } from "../src/cryptographyClient"; -import { authenticate } from "./utils/testAuthentication"; -import TestClient from "./utils/testClient"; -import { stringToUint8Array, uint8ArrayToString } from "./utils/crypto"; import { isRecordMode, Recorder } from "@azure/test-utils-recorder"; +import { ClientSecretCredential } from "@azure/identity"; import { isNode } from "@azure/core-http"; +import { CryptographyClient, KeyVaultKey, KeyClient } from "../../src"; +import { convertJWKtoPEM } from "../../src/cryptographyClient"; +import { authenticate } from "../utils/testAuthentication"; +import TestClient from "../utils/testClient"; +import { stringToUint8Array, uint8ArrayToString } from "../utils/crypto"; + describe("CryptographyClient (all decrypts happen remotely)", () => { let client: KeyClient; let testClient: TestClient; diff --git a/sdk/keyvault/keyvault-keys/test/import.test.ts b/sdk/keyvault/keyvault-keys/test/public/import.spec.ts similarity index 96% rename from sdk/keyvault/keyvault-keys/test/import.test.ts rename to sdk/keyvault/keyvault-keys/test/public/import.spec.ts index f6628fc0c545..86d0b00369a0 100644 --- a/sdk/keyvault/keyvault-keys/test/import.test.ts +++ b/sdk/keyvault/keyvault-keys/test/public/import.spec.ts @@ -2,12 +2,13 @@ // Licensed under the MIT license. import * as assert from "assert"; -import { KeyClient, JsonWebKey } from "../src"; import { env, Recorder } from "@azure/test-utils-recorder"; -import { authenticate } from "./utils/testAuthentication"; -import TestClient from "./utils/testClient"; import { isNode } from "@azure/core-http"; +import { KeyClient, JsonWebKey } from "../../src"; +import { authenticate } from "../utils/testAuthentication"; +import TestClient from "../utils/testClient"; + describe("Keys client - import keys", () => { const prefix = `merge${env.CERTIFICATE_NAME || "KeyName"}`; let suffix: string; diff --git a/sdk/keyvault/keyvault-keys/test/list.test.ts b/sdk/keyvault/keyvault-keys/test/public/list.spec.ts similarity index 96% rename from sdk/keyvault/keyvault-keys/test/list.test.ts rename to sdk/keyvault/keyvault-keys/test/public/list.spec.ts index 69f7b452a7ae..79ace4aaa2af 100644 --- a/sdk/keyvault/keyvault-keys/test/list.test.ts +++ b/sdk/keyvault/keyvault-keys/test/public/list.spec.ts @@ -2,12 +2,13 @@ // Licensed under the MIT license. import * as assert from "assert"; -import { KeyClient } from "../src"; -import { testPollerProperties } from "./utils/recorderUtils"; import { env, Recorder, isRecordMode } from "@azure/test-utils-recorder"; -import { authenticate } from "./utils/testAuthentication"; -import TestClient from "./utils/testClient"; -import { assertThrowsAbortError } from "./utils/utils.common"; + +import { KeyClient } from "../../src"; +import { assertThrowsAbortError } from "../utils/utils.common"; +import { testPollerProperties } from "../utils/recorderUtils"; +import { authenticate } from "../utils/testAuthentication"; +import TestClient from "../utils/testClient"; describe("Keys client - list keys in various ways", () => { const keyPrefix = `recover${env.KEY_NAME || "KeyName"}`; diff --git a/sdk/keyvault/keyvault-keys/test/lro.delete.test.ts b/sdk/keyvault/keyvault-keys/test/public/lro.delete.spec.ts similarity index 92% rename from sdk/keyvault/keyvault-keys/test/lro.delete.test.ts rename to sdk/keyvault/keyvault-keys/test/public/lro.delete.spec.ts index 707abff6621f..a278f6ed02da 100644 --- a/sdk/keyvault/keyvault-keys/test/lro.delete.test.ts +++ b/sdk/keyvault/keyvault-keys/test/public/lro.delete.spec.ts @@ -2,13 +2,14 @@ // Licensed under the MIT license. import * as assert from "assert"; -import { KeyClient, DeletedKey } from "../src"; -import { testPollerProperties } from "./utils/recorderUtils"; import { env, Recorder } from "@azure/test-utils-recorder"; -import { authenticate } from "./utils/testAuthentication"; -import TestClient from "./utils/testClient"; import { PollerStoppedError } from "@azure/core-lro"; +import { KeyClient, DeletedKey } from "../../src"; +import { testPollerProperties } from "../utils/recorderUtils"; +import { authenticate } from "../utils/testAuthentication"; +import TestClient from "../utils/testClient"; + describe("Keys client - Long Running Operations - delete", () => { const keyPrefix = `recover${env.CERTIFICATE_NAME || "KeyName"}`; let keySuffix: string; diff --git a/sdk/keyvault/keyvault-keys/test/lro.recoverDelete.test.ts b/sdk/keyvault/keyvault-keys/test/public/lro.recoverDelete.spec.ts similarity index 92% rename from sdk/keyvault/keyvault-keys/test/lro.recoverDelete.test.ts rename to sdk/keyvault/keyvault-keys/test/public/lro.recoverDelete.spec.ts index b85420148f0d..0b73af9c279b 100644 --- a/sdk/keyvault/keyvault-keys/test/lro.recoverDelete.test.ts +++ b/sdk/keyvault/keyvault-keys/test/public/lro.recoverDelete.spec.ts @@ -2,13 +2,14 @@ // Licensed under the MIT license. import * as assert from "assert"; -import { KeyClient, DeletedKey } from "../src"; -import { testPollerProperties } from "./utils/recorderUtils"; import { env, Recorder } from "@azure/test-utils-recorder"; -import { authenticate } from "./utils/testAuthentication"; -import TestClient from "./utils/testClient"; import { PollerStoppedError } from "@azure/core-lro"; -import { assertThrowsAbortError } from "./utils/utils.common"; + +import { KeyClient, DeletedKey } from "../../src"; +import { assertThrowsAbortError } from "../utils/utils.common"; +import { testPollerProperties } from "../utils/recorderUtils"; +import { authenticate } from "../utils/testAuthentication"; +import TestClient from "../utils/testClient"; describe("Keys client - Long Running Operations - recoverDelete", () => { const keyPrefix = `recover${env.CERTIFICATE_NAME || "KeyName"}`; diff --git a/sdk/keyvault/keyvault-keys/test/recoverBackupRestore.test.ts b/sdk/keyvault/keyvault-keys/test/public/recoverBackupRestore.spec.ts similarity index 95% rename from sdk/keyvault/keyvault-keys/test/recoverBackupRestore.test.ts rename to sdk/keyvault/keyvault-keys/test/public/recoverBackupRestore.spec.ts index 8f3526b2abbf..e84b06477db7 100644 --- a/sdk/keyvault/keyvault-keys/test/recoverBackupRestore.test.ts +++ b/sdk/keyvault/keyvault-keys/test/public/recoverBackupRestore.spec.ts @@ -2,13 +2,14 @@ // Licensed under the MIT license. import * as assert from "assert"; -import { KeyClient } from "../src"; import { isNode } from "@azure/core-http"; -import { testPollerProperties } from "./utils/recorderUtils"; import { env, Recorder, delay, isRecordMode, isPlaybackMode } from "@azure/test-utils-recorder"; -import { authenticate } from "./utils/testAuthentication"; -import TestClient from "./utils/testClient"; -import { assertThrowsAbortError } from "./utils/utils.common"; + +import { KeyClient } from "../../src"; +import { assertThrowsAbortError } from "../utils/utils.common"; +import { testPollerProperties } from "../utils/recorderUtils"; +import { authenticate } from "../utils/testAuthentication"; +import TestClient from "../utils/testClient"; describe("Keys client - restore keys and recover backups", () => { const keyPrefix = `recover${env.KEY_NAME || "KeyName"}`; diff --git a/sdk/keyvault/keyvault-keys/tests.yml b/sdk/keyvault/keyvault-keys/tests.yml index 5e800fcc4fe6..28bd746f03a9 100644 --- a/sdk/keyvault/keyvault-keys/tests.yml +++ b/sdk/keyvault/keyvault-keys/tests.yml @@ -5,6 +5,7 @@ extends: parameters: PackageName: "@azure/keyvault-keys" ResourceServiceDirectory: keyvault + TestMinMax: true EnvVars: AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id) AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id) diff --git a/sdk/keyvault/keyvault-secrets/package.json b/sdk/keyvault/keyvault-secrets/package.json index 1509900515b3..131b077da480 100644 --- a/sdk/keyvault/keyvault-secrets/package.json +++ b/sdk/keyvault/keyvault-secrets/package.json @@ -52,13 +52,13 @@ "check-format": "prettier --list-different --config ../../.prettierrc.json \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", "clean": "rimraf dist dist-esm dist-test types *.tgz *.log dist-browser statistics.html coverage && rimraf src/**/*.js && rimraf test/**/*.js", "execute:js-samples": "node ../../../common/scripts/run-samples.js samples/javascript/", - "execute:ts-samples": "node ../../../common/scripts/run-samples.js samples/typescript/dist/samples/typescript/src/", + "execute:ts-samples": "node ../../../common/scripts/run-samples.js samples/typescript/dist/keyvault-secrets/samples/typescript/src/", "execute:samples": "npm run build:samples && npm run execute:js-samples && npm run execute:ts-samples", "extract-api": "tsc -p . && api-extractor run --local", "format": "prettier --write --config ../../.prettierrc.json \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", "integration-test:browser": "karma start --single-run", - "integration-test:node": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 180000 --full-trace dist-esm/keyvault-secrets/test/**/*.spec.js", - "integration-test:node:no-timeout": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --no-timeouts --full-trace dist-esm/keyvault-secrets/test/**/*.spec.js", + "integration-test:node": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 180000 --full-trace dist-esm/**/*.spec.js", + "integration-test:node:no-timeout": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --no-timeouts --full-trace dist-esm/**/*.spec.js", "integration-test": "npm run integration-test:node && npm run integration-test:browser", "lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]", "lint": "eslint package.json api-extractor.json src test --ext .ts -f html -o keyvault-secrets-lintReport.html", diff --git a/sdk/keyvault/keyvault-secrets/rollup.base.config.js b/sdk/keyvault/keyvault-secrets/rollup.base.config.js index 04105e552dc6..b9aafc627dd1 100644 --- a/sdk/keyvault/keyvault-secrets/rollup.base.config.js +++ b/sdk/keyvault/keyvault-secrets/rollup.base.config.js @@ -57,7 +57,7 @@ export function nodeConfig(test = false) { if (test) { // entry point is every test file - baseConfig.input = ["dist-esm/keyvault-secrets/test/**/*.spec.js"]; + baseConfig.input = ["dist-esm/**/*.spec.js"]; baseConfig.plugins.unshift( multiEntry({ exports: false }), json() // This allows us to import/require the package.json file, to get the version and test it against the user agent. @@ -127,7 +127,7 @@ export function browserConfig(test = false) { }; if (test) { - baseConfig.input = ["dist-esm/keyvault-secrets/test/**/*.spec.js"]; + baseConfig.input = ["dist-esm/**/*.spec.js"]; baseConfig.plugins.unshift( multiEntry({ exports: false }), json() // This allows us to import/require the package.json file, to get the version and test it against the user agent. diff --git a/sdk/keyvault/keyvault-secrets/test/internal/challengeBasedAuthenticationPolicy.spec.ts b/sdk/keyvault/keyvault-secrets/test/internal/challengeBasedAuthenticationPolicy.spec.ts index 5a1e215ed816..af362a4f19fb 100644 --- a/sdk/keyvault/keyvault-secrets/test/internal/challengeBasedAuthenticationPolicy.spec.ts +++ b/sdk/keyvault/keyvault-secrets/test/internal/challengeBasedAuthenticationPolicy.spec.ts @@ -2,16 +2,17 @@ // Licensed under the MIT license. import * as assert from "assert"; -import { SecretClient } from "../../src"; import { env, Recorder } from "@azure/test-utils-recorder"; -import { authenticate } from "../utils/testAuthentication"; -import TestClient from "../utils/testClient"; +import { createSandbox } from "sinon"; + import { AuthenticationChallengeCache, AuthenticationChallenge, parseWWWAuthenticate } from "../../../keyvault-common/src"; -import { createSandbox } from "sinon"; +import { SecretClient } from "../../src"; +import { authenticate } from "../utils/testAuthentication"; +import TestClient from "../utils/testClient"; // Following the philosophy of not testing the insides if we can test the outsides... // I present you with this "Get Out of Jail Free" card (in reference to Monopoly). diff --git a/sdk/keyvault/keyvault-secrets/test/public/CRUD.spec.ts b/sdk/keyvault/keyvault-secrets/test/public/CRUD.spec.ts index 3acb099c7475..ec127fa594f3 100644 --- a/sdk/keyvault/keyvault-secrets/test/public/CRUD.spec.ts +++ b/sdk/keyvault/keyvault-secrets/test/public/CRUD.spec.ts @@ -2,13 +2,14 @@ // Licensed under the MIT license. import * as assert from "assert"; +import { env, Recorder } from "@azure/test-utils-recorder"; +import { AbortController } from "@azure/abort-controller"; + import { SecretClient } from "../../src"; +import { assertThrowsAbortError } from "../utils/utils.common"; import { testPollerProperties } from "../utils/recorderUtils"; -import { env, Recorder } from "@azure/test-utils-recorder"; import { authenticate } from "../utils/testAuthentication"; import TestClient from "../utils/testClient"; -import { AbortController } from "@azure/abort-controller"; -import { assertThrowsAbortError } from "../utils/utils.common"; describe("Secret client - create, read, update and delete operations", () => { const secretValue = "SECRET_VALUE"; diff --git a/sdk/keyvault/keyvault-secrets/test/public/list.spec.ts b/sdk/keyvault/keyvault-secrets/test/public/list.spec.ts index bad9223d2827..11ed3f520333 100644 --- a/sdk/keyvault/keyvault-secrets/test/public/list.spec.ts +++ b/sdk/keyvault/keyvault-secrets/test/public/list.spec.ts @@ -3,12 +3,14 @@ import * as assert from "assert"; import chai from "chai"; +import { env, Recorder, isRecordMode } from "@azure/test-utils-recorder"; + import { SecretClient } from "../../src"; +import { assertThrowsAbortError } from "../utils/utils.common"; import { testPollerProperties } from "../utils/recorderUtils"; -import { env, Recorder, isRecordMode } from "@azure/test-utils-recorder"; import { authenticate } from "../utils/testAuthentication"; import TestClient from "../utils/testClient"; -import { assertThrowsAbortError } from "../utils/utils.common"; + const { expect } = chai; describe("Secret client - list secrets in various ways", () => { 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 11d6d0e8d257..339f14fe59ba 100644 --- a/sdk/keyvault/keyvault-secrets/test/public/lro.delete.spec.ts +++ b/sdk/keyvault/keyvault-secrets/test/public/lro.delete.spec.ts @@ -2,13 +2,14 @@ // Licensed under the MIT license. import * as assert from "assert"; +import { env, Recorder } from "@azure/test-utils-recorder"; +import { PollerStoppedError } from "@azure/core-lro"; + import { SecretClient, DeletedSecret } from "../../src"; +import { assertThrowsAbortError } from "../utils/utils.common"; import { testPollerProperties } from "../utils/recorderUtils"; -import { env, Recorder } from "@azure/test-utils-recorder"; import { authenticate } from "../utils/testAuthentication"; import TestClient from "../utils/testClient"; -import { PollerStoppedError } from "@azure/core-lro"; -import { assertThrowsAbortError } from "../utils/utils.common"; describe("Secrets client - Long Running Operations - delete", () => { const secretPrefix = `recover${env.CERTIFICATE_NAME || "SecretName"}`; 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 c805bdd93647..c67c299ac2c7 100644 --- a/sdk/keyvault/keyvault-secrets/test/public/lro.recover.spec.ts +++ b/sdk/keyvault/keyvault-secrets/test/public/lro.recover.spec.ts @@ -2,13 +2,14 @@ // Licensed under the MIT license. import * as assert from "assert"; +import { env, Recorder } from "@azure/test-utils-recorder"; +import { PollerStoppedError } from "@azure/core-lro"; + import { SecretClient, SecretProperties } from "../../src"; +import { assertThrowsAbortError } from "../utils/utils.common"; import { testPollerProperties } from "../utils/recorderUtils"; -import { env, Recorder } from "@azure/test-utils-recorder"; import { authenticate } from "../utils/testAuthentication"; import TestClient from "../utils/testClient"; -import { PollerStoppedError } from "@azure/core-lro"; -import { assertThrowsAbortError } from "../utils/utils.common"; describe("Secrets client - Long Running Operations - recoverDelete", () => { const secretPrefix = `recover${env.CERTIFICATE_NAME || "SecretName"}`; diff --git a/sdk/keyvault/keyvault-secrets/test/public/recoverBackupRestore.spec.ts b/sdk/keyvault/keyvault-secrets/test/public/recoverBackupRestore.spec.ts index 1fda75a01b3f..fa9d14678df3 100644 --- a/sdk/keyvault/keyvault-secrets/test/public/recoverBackupRestore.spec.ts +++ b/sdk/keyvault/keyvault-secrets/test/public/recoverBackupRestore.spec.ts @@ -2,13 +2,14 @@ // Licensed under the MIT license. import * as assert from "assert"; -import { SecretClient } from "../../src"; import { isNode } from "@azure/core-http"; -import { testPollerProperties } from "../utils/recorderUtils"; import { env, isPlaybackMode, Recorder, delay, isRecordMode } from "@azure/test-utils-recorder"; + +import { SecretClient } from "../../src"; +import { assertThrowsAbortError } from "../utils/utils.common"; +import { testPollerProperties } from "../utils/recorderUtils"; import { authenticate } from "../utils/testAuthentication"; import TestClient from "../utils/testClient"; -import { assertThrowsAbortError } from "../utils/utils.common"; describe("Secret client - restore secrets and recover backups", () => { const secretPrefix = `CRUD${env.SECRET_NAME || "SecretName"}`;