From 61806875e2155edcb580f8c7497ddbf41f15a31c Mon Sep 17 00:00:00 2001 From: Matthew Podwysocki Date: Wed, 27 Nov 2024 18:18:22 -0500 Subject: [PATCH 01/12] Migration: Update package.json, tsconfig.json, and api-extractor.json --- .../identity-vscode/api-extractor.json | 4 +- sdk/identity/identity-vscode/package.json | 47 ++++++++++++------- sdk/identity/identity-vscode/tsconfig.json | 25 +++++++--- 3 files changed, 51 insertions(+), 25 deletions(-) diff --git a/sdk/identity/identity-vscode/api-extractor.json b/sdk/identity/identity-vscode/api-extractor.json index 9ce43119c136..2338e03adfca 100644 --- a/sdk/identity/identity-vscode/api-extractor.json +++ b/sdk/identity/identity-vscode/api-extractor.json @@ -1,6 +1,6 @@ { "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", - "mainEntryPointFilePath": "./types/src/index.d.ts", + "mainEntryPointFilePath": "dist/esm/index.d.ts", "docModel": { "enabled": true }, @@ -11,7 +11,7 @@ "dtsRollup": { "enabled": true, "untrimmedFilePath": "", - "publicTrimmedFilePath": "./types/identity-vscode.d.ts" + "publicTrimmedFilePath": "dist/identity-vscode.d.ts" }, "messages": { "tsdocMessageReporting": { diff --git a/sdk/identity/identity-vscode/package.json b/sdk/identity/identity-vscode/package.json index f493ac4c0783..af21d439a347 100644 --- a/sdk/identity/identity-vscode/package.json +++ b/sdk/identity/identity-vscode/package.json @@ -7,13 +7,13 @@ "module": "dist-esm/src/index.js", "types": "./types/identity-vscode.d.ts", "scripts": { - "build": "npm run clean && npm run extract-api && tsc -p . && dev-tool run bundle", + "build": "npm run clean && dev-tool run build-package && dev-tool run extract-api", "build:samples": "echo skipped", - "build:test": "tsc -p . && dev-tool run bundle", + "build:test": "dev-tool run build-package && dev-tool run bundle", "check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\" \"samples-dev/**/*.ts\"", "clean": "dev-tool run vendored rimraf --glob dist dist-* types *.tgz *.log", "execute:samples": "echo skipped", - "extract-api": "tsc -p . && dev-tool run extract-api", + "extract-api": "dev-tool run build-package && dev-tool run extract-api", "format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\" \"samples-dev/**/*.ts\"", "integration-test": "npm run integration-test:node && npm run integration-test:browser", "integration-test:browser": "echo skipped", @@ -25,14 +25,12 @@ "test:browser": "npm run clean && npm run build:test && npm run unit-test:browser && npm run integration-test:browser", "test:node": "npm run clean && npm run build:test && npm run unit-test:node && npm run integration-test:node", "unit-test": "npm run unit-test:node && npm run unit-test:browser", - "unit-test:browser": "echo skipped", - "unit-test:node": "dev-tool run test:node-ts-input -- --timeout 300000 --exclude 'test/**/browser/**/*.spec.ts' 'test/**/**/*.spec.ts'", + "unit-test:browser": "npm run clean && dev-tool run build-package && dev-tool run build-test && dev-tool run test:vitest --browser", + "unit-test:node": "dev-tool run test:vitest", "update-snippets": "echo skipped" }, "files": [ "dist/", - "dist-esm/src", - "types/identity-vscode.d.ts", "README.md", "LICENSE" ], @@ -63,25 +61,40 @@ "tslib": "^2.2.0" }, "devDependencies": { - "@azure-tools/test-recorder": "^3.0.0", - "@azure-tools/test-utils": "^1.0.1", + "@azure-tools/test-recorder": "^4.1.0", + "@azure-tools/test-utils-vitest": "^1.0.0", "@azure/core-client": "^1.7.0", "@azure/dev-tool": "^1.0.0", "@azure/eslint-plugin-azure-sdk": "^3.0.0", "@types/jws": "^3.2.2", - "@types/mocha": "^10.0.0", "@types/node": "^18.0.0", "@types/qs": "^6.5.3", - "@types/sinon": "^17.0.0", "@types/uuid": "^8.0.0", + "@vitest/browser": "^2.1.6", + "@vitest/coverage-istanbul": "^2.1.6", "dotenv": "^16.0.0", "eslint": "^9.9.0", "inherits": "^2.0.3", - "mocha": "^10.0.0", - "puppeteer": "^23.0.2", - "sinon": "^17.0.0", - "ts-node": "^10.0.0", + "playwright": "^1.49.0", "typescript": "~5.6.2", - "util": "^0.12.1" - } + "util": "^0.12.1", + "vitest": "^2.1.6" + }, + "type": "module", + "tshy": { + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts" + }, + "dialects": [ + "esm", + "commonjs" + ], + "esmDialects": [ + "browser", + "react-native" + ], + "selfLink": false + }, + "browser": "./dist/browser/index.js" } diff --git a/sdk/identity/identity-vscode/tsconfig.json b/sdk/identity/identity-vscode/tsconfig.json index 6a1899b344a8..b9a3898718df 100644 --- a/sdk/identity/identity-vscode/tsconfig.json +++ b/sdk/identity/identity-vscode/tsconfig.json @@ -2,13 +2,26 @@ "extends": "../../../tsconfig", "compilerOptions": { "target": "es6", - "lib": ["DOM"], - "declarationDir": "./types", - "outDir": "./dist-esm", + "lib": [ + "DOM" + ], "resolveJsonModule": true, "paths": { - "@azure/identity-vscode": ["./src/index"] - } + "@azure/identity-vscode": [ + "./src/index" + ] + }, + "module": "NodeNext", + "moduleResolution": "NodeNext", + "rootDir": "." }, - "include": ["src/**/*", "test/**/*", "samples-dev/**/*"] + "include": [ + "src/**/*.ts", + "src/**/*.mts", + "src/**/*.cts", + "samples-dev/**/*.ts", + "test/**/*.ts", + "test/**/*.mts", + "test/**/*.cts" + ] } From 890c05c88e200b1f1efb7a4f871610dc8aceea1e Mon Sep 17 00:00:00 2001 From: Matthew Podwysocki Date: Wed, 27 Nov 2024 18:18:22 -0500 Subject: [PATCH 02/12] Migration: Update test config --- .../tsconfig.browser.config.json | 17 +++++++++++++++++ .../identity-vscode/vitest.browser.config.ts | 17 +++++++++++++++++ sdk/identity/identity-vscode/vitest.config.ts | 15 +++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 sdk/identity/identity-vscode/tsconfig.browser.config.json create mode 100644 sdk/identity/identity-vscode/vitest.browser.config.ts create mode 100644 sdk/identity/identity-vscode/vitest.config.ts diff --git a/sdk/identity/identity-vscode/tsconfig.browser.config.json b/sdk/identity/identity-vscode/tsconfig.browser.config.json new file mode 100644 index 000000000000..b6586181d006 --- /dev/null +++ b/sdk/identity/identity-vscode/tsconfig.browser.config.json @@ -0,0 +1,17 @@ +{ + "extends": "./.tshy/build.json", + "include": [ + "./src/**/*.ts", + "./src/**/*.mts", + "./test/**/*.spec.ts", + "./test/**/*.mts" + ], + "exclude": [ + "./test/**/node/**/*.ts" + ], + "compilerOptions": { + "outDir": "./dist-test/browser", + "rootDir": ".", + "skipLibCheck": true + } +} diff --git a/sdk/identity/identity-vscode/vitest.browser.config.ts b/sdk/identity/identity-vscode/vitest.browser.config.ts new file mode 100644 index 000000000000..b48c61b2ef46 --- /dev/null +++ b/sdk/identity/identity-vscode/vitest.browser.config.ts @@ -0,0 +1,17 @@ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { defineConfig, mergeConfig } from "vitest/config"; +import viteConfig from "../../../vitest.browser.shared.config.ts"; + +export default mergeConfig( + viteConfig, + defineConfig({ + test: { + include: [ + "dist-test/browser/test/**/*.spec.js", + ], + }, + }), +); diff --git a/sdk/identity/identity-vscode/vitest.config.ts b/sdk/identity/identity-vscode/vitest.config.ts new file mode 100644 index 000000000000..39267dd2f56f --- /dev/null +++ b/sdk/identity/identity-vscode/vitest.config.ts @@ -0,0 +1,15 @@ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { defineConfig, mergeConfig } from "vitest/config"; +import viteConfig from "../../../vitest.shared.config.ts"; + +export default mergeConfig( + viteConfig, + defineConfig({ + test: { + include: ["test/**/*.spec.ts"], + }, + }), +); From 9a8320ee4503cf49e99a74e0cb2611c70f7eeceb Mon Sep 17 00:00:00 2001 From: Matthew Podwysocki Date: Wed, 27 Nov 2024 18:18:22 -0500 Subject: [PATCH 03/12] Migration: Clean up files From 84ba30a33ce60a49d47cef767a65d011092f9d62 Mon Sep 17 00:00:00 2001 From: Matthew Podwysocki Date: Wed, 27 Nov 2024 18:18:23 -0500 Subject: [PATCH 04/12] Migration: Apply codemod: "fixSourceFile" --- sdk/identity/identity-vscode/test/public/node/setup.spec.ts | 2 +- .../test/public/node/visualStudioCodeCredential.spec.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/identity/identity-vscode/test/public/node/setup.spec.ts b/sdk/identity/identity-vscode/test/public/node/setup.spec.ts index fa0189eb2baa..a67e0d9d6a83 100644 --- a/sdk/identity/identity-vscode/test/public/node/setup.spec.ts +++ b/sdk/identity/identity-vscode/test/public/node/setup.spec.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { vsCodePlugin as plugin } from "../../../src"; +import { vsCodePlugin as plugin } from "../../../src/index.js"; import { useIdentityPlugin } from "@azure/identity"; diff --git a/sdk/identity/identity-vscode/test/public/node/visualStudioCodeCredential.spec.ts b/sdk/identity/identity-vscode/test/public/node/visualStudioCodeCredential.spec.ts index 5c5b29b3b845..9d619657136f 100644 --- a/sdk/identity/identity-vscode/test/public/node/visualStudioCodeCredential.spec.ts +++ b/sdk/identity/identity-vscode/test/public/node/visualStudioCodeCredential.spec.ts @@ -8,7 +8,7 @@ import type { Recorder } from "@azure-tools/test-recorder"; import { isRecordMode } from "@azure-tools/test-recorder"; import { VisualStudioCodeCredential } from "@azure/identity"; -import assert from "assert"; +import assert from "node:assert"; import sinon from "sinon"; const mockedResponse = [ From aba5d30019a56bc946647c7b0f70fb8f7123d98c Mon Sep 17 00:00:00 2001 From: Matthew Podwysocki Date: Wed, 27 Nov 2024 18:18:23 -0500 Subject: [PATCH 05/12] Migration: Apply codemod: "fixTestingImports" --- sdk/identity/identity-vscode/test/public/node/setup.spec.ts | 1 + .../test/public/node/visualStudioCodeCredential.spec.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/sdk/identity/identity-vscode/test/public/node/setup.spec.ts b/sdk/identity/identity-vscode/test/public/node/setup.spec.ts index a67e0d9d6a83..cd7db464cb12 100644 --- a/sdk/identity/identity-vscode/test/public/node/setup.spec.ts +++ b/sdk/identity/identity-vscode/test/public/node/setup.spec.ts @@ -4,6 +4,7 @@ import { vsCodePlugin as plugin } from "../../../src/index.js"; import { useIdentityPlugin } from "@azure/identity"; +import { describe, it, assert } from "vitest"; before(function () { useIdentityPlugin(plugin); diff --git a/sdk/identity/identity-vscode/test/public/node/visualStudioCodeCredential.spec.ts b/sdk/identity/identity-vscode/test/public/node/visualStudioCodeCredential.spec.ts index 9d619657136f..a4f67d4cb104 100644 --- a/sdk/identity/identity-vscode/test/public/node/visualStudioCodeCredential.spec.ts +++ b/sdk/identity/identity-vscode/test/public/node/visualStudioCodeCredential.spec.ts @@ -9,7 +9,7 @@ import type { Recorder } from "@azure-tools/test-recorder"; import { isRecordMode } from "@azure-tools/test-recorder"; import { VisualStudioCodeCredential } from "@azure/identity"; import assert from "node:assert"; -import sinon from "sinon"; +import { describe, it, assert, expect, vi, beforeEach, afterEach } from "vitest"; const mockedResponse = [ { From 023d77806a3b5998ec1e427d981f4f23b1ccff30 Mon Sep 17 00:00:00 2001 From: Matthew Podwysocki Date: Wed, 27 Nov 2024 18:18:23 -0500 Subject: [PATCH 06/12] Migration: Apply codemod: "replaceAssertIsRejected" From 38dbff57df0d745aa511f3e5102d21c78674884b Mon Sep 17 00:00:00 2001 From: Matthew Podwysocki Date: Wed, 27 Nov 2024 18:18:24 -0500 Subject: [PATCH 07/12] Migration: Apply codemod: "replaceSinonStub" From 078d257acf01519f391656c19d9f5de4a8057e96 Mon Sep 17 00:00:00 2001 From: Matthew Podwysocki Date: Wed, 27 Nov 2024 18:18:24 -0500 Subject: [PATCH 08/12] Migration: Apply codemod: "addViHelper" From 490ccafd9deda6e2e71c8275d00c8fa29146ca6a Mon Sep 17 00:00:00 2001 From: Matthew Podwysocki Date: Wed, 27 Nov 2024 18:18:24 -0500 Subject: [PATCH 09/12] Migration: Apply codemod: "replaceSupportTracing" From d49b41ea8f8da373b55ef4f08dadcad217b3e139 Mon Sep 17 00:00:00 2001 From: Matthew Podwysocki Date: Wed, 27 Nov 2024 18:18:24 -0500 Subject: [PATCH 10/12] Migration: Apply codemod: "replaceTestUtils" From 4f86c46e88fdd00a3fc54abc92f672443a1398cb Mon Sep 17 00:00:00 2001 From: Matthew Podwysocki Date: Wed, 27 Nov 2024 18:18:34 -0500 Subject: [PATCH 11/12] Migration: rushx format --- .../identity-vscode/tsconfig.browser.config.json | 11 ++--------- sdk/identity/identity-vscode/tsconfig.json | 8 ++------ 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/sdk/identity/identity-vscode/tsconfig.browser.config.json b/sdk/identity/identity-vscode/tsconfig.browser.config.json index b6586181d006..f772e6eb3b76 100644 --- a/sdk/identity/identity-vscode/tsconfig.browser.config.json +++ b/sdk/identity/identity-vscode/tsconfig.browser.config.json @@ -1,14 +1,7 @@ { "extends": "./.tshy/build.json", - "include": [ - "./src/**/*.ts", - "./src/**/*.mts", - "./test/**/*.spec.ts", - "./test/**/*.mts" - ], - "exclude": [ - "./test/**/node/**/*.ts" - ], + "include": ["./src/**/*.ts", "./src/**/*.mts", "./test/**/*.spec.ts", "./test/**/*.mts"], + "exclude": ["./test/**/node/**/*.ts"], "compilerOptions": { "outDir": "./dist-test/browser", "rootDir": ".", diff --git a/sdk/identity/identity-vscode/tsconfig.json b/sdk/identity/identity-vscode/tsconfig.json index b9a3898718df..e7c2155a9b9b 100644 --- a/sdk/identity/identity-vscode/tsconfig.json +++ b/sdk/identity/identity-vscode/tsconfig.json @@ -2,14 +2,10 @@ "extends": "../../../tsconfig", "compilerOptions": { "target": "es6", - "lib": [ - "DOM" - ], + "lib": ["DOM"], "resolveJsonModule": true, "paths": { - "@azure/identity-vscode": [ - "./src/index" - ] + "@azure/identity-vscode": ["./src/index"] }, "module": "NodeNext", "moduleResolution": "NodeNext", From 29c0b1c70e006075bfe4ec12fd30b09beb21b2cd Mon Sep 17 00:00:00 2001 From: Matthew Podwysocki Date: Fri, 29 Nov 2024 13:02:40 -0500 Subject: [PATCH 12/12] [identity] Migrate @azure/identity-vscode to ESM/vitest --- common/config/rush/pnpm-lock.yaml | 30 ++++++++++--- sdk/identity/identity-vscode/package.json | 45 ++++++++++++------- .../identity-vscode/samples-dev/extension.ts | 4 +- .../identity-vscode/samples-dev/nodeEnv.ts | 2 +- .../test/public/node/setup.spec.ts | 4 +- .../node/visualStudioCodeCredential.spec.ts | 25 +++++------ .../tsconfig.browser.config.json | 10 ----- .../identity-vscode/vitest.browser.config.ts | 17 ------- 8 files changed, 72 insertions(+), 65 deletions(-) delete mode 100644 sdk/identity/identity-vscode/tsconfig.browser.config.json delete mode 100644 sdk/identity/identity-vscode/vitest.browser.config.ts diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 9ffa7ee25971..7cf2b62dd485 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -20628,7 +20628,7 @@ packages: dev: false file:projects/eventgrid.tgz: - resolution: {integrity: sha512-lEVmH829YPH2tBtjHpzR427SM3QuZnyTRP4kE5W46/1bi4mqZdIQjqqS15QQktmrFF34R/fLzBv9mhmUszQ/Cg==, tarball: file:projects/eventgrid.tgz} + resolution: {integrity: sha512-xNO7uSbCB0gSezDYBsFLGRv0mgFhuRovCGLgicVWr3KBzCHr9fZn2OdSSIIsBAx68K8Ha0nHjeHPC0jlhL/cCQ==, tarball: file:projects/eventgrid.tgz} name: '@rush-temp/eventgrid' version: 0.0.0 dependencies: @@ -20664,7 +20664,7 @@ packages: tsx: 4.19.2 typescript: 5.6.3 uuid: 8.3.2 - vitest: 2.1.6(@types/node@18.19.66)(@vitest/browser@2.1.6)(tsx@4.19.2) + vitest: 2.1.6(@types/node@18.19.66)(@vitest/browser@2.1.6) transitivePeerDependencies: - '@edge-runtime/vm' - '@vitest/ui' @@ -20682,6 +20682,7 @@ packages: - sugarss - supports-color - terser + - tsx - utf-8-validate - vite - webdriverio @@ -21061,7 +21062,7 @@ packages: dev: false file:projects/identity-vscode.tgz: - resolution: {integrity: sha512-7wFwOEU77YA+6eg2Xs7S8xD4eXOUfUcPc4Ic8g2JDQ1COfG1Sh6MiADCcnB8jFbjLrTLGUr/XsqI0eu9oOX/bA==, tarball: file:projects/identity-vscode.tgz} + resolution: {integrity: sha512-7ZCkOJ5EpiwE6unR/9sLeKKDm08nNFWFJQ/x352UGCqMPm1xhLAkQ090/WoEmGc0fn5qlK//QlzuSTBphKgLmw==, tarball: file:projects/identity-vscode.tgz} name: '@rush-temp/identity-vscode' version: 0.0.0 dependencies: @@ -21072,24 +21073,43 @@ packages: '@types/qs': 6.9.17 '@types/sinon': 17.0.3 '@types/uuid': 8.3.4 + '@vitest/browser': 2.1.6(@types/node@18.19.66)(playwright@1.49.0)(typescript@5.6.3)(vitest@2.1.6) + '@vitest/coverage-istanbul': 2.1.6(vitest@2.1.6) dotenv: 16.4.5 eslint: 9.15.0 inherits: 2.0.4 keytar: 7.9.0 mocha: 10.8.2 + playwright: 1.49.0 puppeteer: 23.9.0(typescript@5.6.3) sinon: 17.0.1 ts-node: 10.9.2(@types/node@18.19.66)(typescript@5.6.3) tslib: 2.8.1 typescript: 5.6.3 util: 0.12.5 + vitest: 2.1.6(@types/node@18.19.66)(@vitest/browser@2.1.6) transitivePeerDependencies: - - '@swc/core' - - '@swc/wasm' + - '@edge-runtime/vm' + - '@vitest/ui' - bufferutil + - happy-dom - jiti + - jsdom + - less + - lightningcss + - msw + - safaridriver + - sass + - sass-embedded + - stylus + - sugarss - supports-color + - terser + - tsx - utf-8-validate + - vite + - webdriverio + - yaml dev: false file:projects/identity.tgz: diff --git a/sdk/identity/identity-vscode/package.json b/sdk/identity/identity-vscode/package.json index af21d439a347..5b9ad7528706 100644 --- a/sdk/identity/identity-vscode/package.json +++ b/sdk/identity/identity-vscode/package.json @@ -3,13 +3,13 @@ "version": "1.0.1", "sdk-type": "client", "description": "Use the Azure Account extension for Visual Studio Code to authenticate with Azure Identity", - "main": "dist/index.js", - "module": "dist-esm/src/index.js", - "types": "./types/identity-vscode.d.ts", + "main": "./dist/commonjs/index.js", + "module": "./dist/esm/index.js", + "types": "./dist/commonjs/index.d.ts", "scripts": { "build": "npm run clean && dev-tool run build-package && dev-tool run extract-api", "build:samples": "echo skipped", - "build:test": "dev-tool run build-package && dev-tool run bundle", + "build:test": "echo skipped", "check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\" \"samples-dev/**/*.ts\"", "clean": "dev-tool run vendored rimraf --glob dist dist-* types *.tgz *.log", "execute:samples": "echo skipped", @@ -25,8 +25,8 @@ "test:browser": "npm run clean && npm run build:test && npm run unit-test:browser && npm run integration-test:browser", "test:node": "npm run clean && npm run build:test && npm run unit-test:node && npm run integration-test:node", "unit-test": "npm run unit-test:node && npm run unit-test:browser", - "unit-test:browser": "npm run clean && dev-tool run build-package && dev-tool run build-test && dev-tool run test:vitest --browser", - "unit-test:node": "dev-tool run test:vitest", + "unit-test:browser": "echo skipped", + "unit-test:node": "echo skipped", "update-snippets": "echo skipped" }, "files": [ @@ -56,9 +56,9 @@ "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity-vscode/README.md", "sideEffects": false, "dependencies": { - "@azure/identity": "^4.0.1", + "@azure/identity": "^4.5.0", "keytar": "^7.6.0", - "tslib": "^2.2.0" + "tslib": "^2.8.1" }, "devDependencies": { "@azure-tools/test-recorder": "^4.1.0", @@ -66,18 +66,12 @@ "@azure/core-client": "^1.7.0", "@azure/dev-tool": "^1.0.0", "@azure/eslint-plugin-azure-sdk": "^3.0.0", - "@types/jws": "^3.2.2", "@types/node": "^18.0.0", - "@types/qs": "^6.5.3", - "@types/uuid": "^8.0.0", - "@vitest/browser": "^2.1.6", "@vitest/coverage-istanbul": "^2.1.6", "dotenv": "^16.0.0", "eslint": "^9.9.0", - "inherits": "^2.0.3", "playwright": "^1.49.0", "typescript": "~5.6.2", - "util": "^0.12.1", "vitest": "^2.1.6" }, "type": "module", @@ -96,5 +90,26 @@ ], "selfLink": false }, - "browser": "./dist/browser/index.js" + "browser": "./dist/browser/index.js", + "exports": { + "./package.json": "./package.json", + ".": { + "browser": { + "types": "./dist/browser/index.d.ts", + "default": "./dist/browser/index.js" + }, + "react-native": { + "types": "./dist/react-native/index.d.ts", + "default": "./dist/react-native/index.js" + }, + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" + } + } + } } diff --git a/sdk/identity/identity-vscode/samples-dev/extension.ts b/sdk/identity/identity-vscode/samples-dev/extension.ts index 1d26392a81be..1fcdeeebe9ba 100644 --- a/sdk/identity/identity-vscode/samples-dev/extension.ts +++ b/sdk/identity/identity-vscode/samples-dev/extension.ts @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. /** @@ -20,7 +20,7 @@ import { useIdentityPlugin, DefaultAzureCredential } from "@azure/identity"; import { vsCodePlugin } from "@azure/identity-vscode"; useIdentityPlugin(vsCodePlugin); -export async function main() { +export async function main(): Promise { const credential = new DefaultAzureCredential(); // This is the scope we will use to get a token from the Microsoft Entra token endpoint. diff --git a/sdk/identity/identity-vscode/samples-dev/nodeEnv.ts b/sdk/identity/identity-vscode/samples-dev/nodeEnv.ts index d6e5a1f6de7c..12f84e6bd7b2 100644 --- a/sdk/identity/identity-vscode/samples-dev/nodeEnv.ts +++ b/sdk/identity/identity-vscode/samples-dev/nodeEnv.ts @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. /** diff --git a/sdk/identity/identity-vscode/test/public/node/setup.spec.ts b/sdk/identity/identity-vscode/test/public/node/setup.spec.ts index cd7db464cb12..d31b3f7094d3 100644 --- a/sdk/identity/identity-vscode/test/public/node/setup.spec.ts +++ b/sdk/identity/identity-vscode/test/public/node/setup.spec.ts @@ -4,8 +4,8 @@ import { vsCodePlugin as plugin } from "../../../src/index.js"; import { useIdentityPlugin } from "@azure/identity"; -import { describe, it, assert } from "vitest"; +import { beforeAll } from "vitest"; -before(function () { +beforeAll(function () { useIdentityPlugin(plugin); }); diff --git a/sdk/identity/identity-vscode/test/public/node/visualStudioCodeCredential.spec.ts b/sdk/identity/identity-vscode/test/public/node/visualStudioCodeCredential.spec.ts index a4f67d4cb104..36bb4bf1a5a9 100644 --- a/sdk/identity/identity-vscode/test/public/node/visualStudioCodeCredential.spec.ts +++ b/sdk/identity/identity-vscode/test/public/node/visualStudioCodeCredential.spec.ts @@ -1,15 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/* eslint-disable @typescript-eslint/no-non-null-asserted-optional-chain */ -/* eslint-disable @typescript-eslint/no-require-imports */ -/* eslint-disable sort-imports */ - -import type { Recorder } from "@azure-tools/test-recorder"; +import { Recorder } from "@azure-tools/test-recorder"; import { isRecordMode } from "@azure-tools/test-recorder"; import { VisualStudioCodeCredential } from "@azure/identity"; -import assert from "node:assert"; -import { describe, it, assert, expect, vi, beforeEach, afterEach } from "vitest"; +import { describe, it, assert, vi, beforeEach } from "vitest"; const mockedResponse = [ { @@ -19,12 +14,12 @@ const mockedResponse = [ ]; // TODO: Enable again once the VisualStudio cache bug is fixed. -describe.skip("VisualStudioCodeCredential", function (this: Mocha.Suite) { +describe.skip("VisualStudioCodeCredential", () => { let recorder: Recorder; - beforeEach(async function (this: Mocha.Context) {}); - - afterEach(async function () {}); + beforeEach(async (ctx) => { + recorder = new Recorder(ctx); + }); const scope = "https://graph.microsoft.com/.default"; @@ -32,8 +27,12 @@ describe.skip("VisualStudioCodeCredential", function (this: Mocha.Suite) { if (!isRecordMode()) { // In live CI or playback CI, we need to avoid actually using keytar // to try to read the Azure Account state, since it won't be available - const mock = sinon.mock(require("keytar")); - mock.expects("findCredentials").onFirstCall().returns(mockedResponse); + vi.mock("keytar", (importActual) => { + return { + ...importActual, + findCredentials: async () => mockedResponse, + }; + }); } const cred = new VisualStudioCodeCredential(recorder.configureClientOptions({})); diff --git a/sdk/identity/identity-vscode/tsconfig.browser.config.json b/sdk/identity/identity-vscode/tsconfig.browser.config.json deleted file mode 100644 index f772e6eb3b76..000000000000 --- a/sdk/identity/identity-vscode/tsconfig.browser.config.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "./.tshy/build.json", - "include": ["./src/**/*.ts", "./src/**/*.mts", "./test/**/*.spec.ts", "./test/**/*.mts"], - "exclude": ["./test/**/node/**/*.ts"], - "compilerOptions": { - "outDir": "./dist-test/browser", - "rootDir": ".", - "skipLibCheck": true - } -} diff --git a/sdk/identity/identity-vscode/vitest.browser.config.ts b/sdk/identity/identity-vscode/vitest.browser.config.ts deleted file mode 100644 index b48c61b2ef46..000000000000 --- a/sdk/identity/identity-vscode/vitest.browser.config.ts +++ /dev/null @@ -1,17 +0,0 @@ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { defineConfig, mergeConfig } from "vitest/config"; -import viteConfig from "../../../vitest.browser.shared.config.ts"; - -export default mergeConfig( - viteConfig, - defineConfig({ - test: { - include: [ - "dist-test/browser/test/**/*.spec.js", - ], - }, - }), -);