diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 07510e3e840..5d8f9605b86 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -1329,6 +1329,25 @@ packages: - supports-color dev: false + /@azure/app-configuration@1.8.0: + resolution: {integrity: sha512-RO4IGZMa3hI1yVhvb5rPr+r+UDxe4VDxbntFZIc5fsUPGqZbKzmGR2wABEtlrC2SU5YX6tL+NS3xWb4vf1M9lQ==} + engines: {node: '>=18.0.0'} + dependencies: + '@azure/abort-controller': 2.1.2 + '@azure/core-auth': 1.9.0 + '@azure/core-client': 1.9.2 + '@azure/core-http-compat': 2.1.2 + '@azure/core-lro': 2.7.2 + '@azure/core-paging': 1.6.2 + '@azure/core-rest-pipeline': 1.17.0 + '@azure/core-tracing': 1.2.0 + '@azure/core-util': 1.11.0 + '@azure/logger': 1.1.4 + tslib: 2.8.1 + transitivePeerDependencies: + - supports-color + dev: false + /@azure/arm-compute@21.6.0: resolution: {integrity: sha512-Qk6kxoqMgzOvceUBqD1WTHrPh/iaxlTLQPp241u3iNVOE4FVSTqSzTxjG1tr/UL1rBWGvoLPZExUFddo+Qd5KQ==} engines: {node: '>=18.0.0'} @@ -1443,6 +1462,11 @@ packages: - supports-color dev: false + /@azure/core-asynciterator-polyfill@1.0.2: + resolution: {integrity: sha512-3rkP4LnnlWawl0LZptJOdXNrT/fHp2eQMadoasa6afspXdpGrtPZuAQc2PD0cpgyuoXtUWyC3tv7xfntjGS5Dw==} + engines: {node: '>=12.0.0'} + dev: false + /@azure/core-auth@1.9.0: resolution: {integrity: sha512-FPwHpZywuyasDSLMqJ6fhbOK3TqUdviZNF8OqRGA4W5Ewib2lEEZ+pBsYcBa88B2NGO/SEnYPGhyBqNlE8ilSw==} engines: {node: '>=18.0.0'} @@ -1478,6 +1502,30 @@ packages: - supports-color dev: false + /@azure/core-http@1.2.6: + resolution: {integrity: sha512-odtH7UMKtekc5YQ86xg9GlVHNXR6pq2JgJ5FBo7/jbOjNGdBqcrIVrZx2bevXVJz/uUTSx6vUf62gzTXTfqYSQ==} + engines: {node: '>=8.0.0'} + deprecated: This package is no longer supported. Please migrate to use @azure/core-rest-pipeline + dependencies: + '@azure/abort-controller': 1.1.0 + '@azure/core-asynciterator-polyfill': 1.0.2 + '@azure/core-auth': 1.9.0 + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/logger': 1.1.4 + '@types/node-fetch': 2.6.11 + '@types/tunnel': 0.0.1 + form-data: 3.0.2 + node-fetch: 2.7.0 + process: 0.11.10 + tough-cookie: 4.1.4 + tslib: 2.8.1 + tunnel: 0.0.6 + uuid: 8.3.2 + xml2js: 0.4.23 + transitivePeerDependencies: + - encoding + dev: false + /@azure/core-lro@2.7.2: resolution: {integrity: sha512-0YIpccoX8m/k00O7mDDMdJpbr6mf1yWo2dfmxt5A8XVZVVMz2SSKaEbMCeJRvgQ0IaSlqhjT47p4hVIRRy90xw==} engines: {node: '>=18.0.0'} @@ -1528,6 +1576,15 @@ packages: tslib: 2.8.1 dev: false + /@azure/core-tracing@1.0.0-preview.11: + resolution: {integrity: sha512-frF0pJc9HTmKncVokhBxCqipjbql02DThQ1ZJ9wLi7SDMLdPAFyDI5xZNzX5guLz+/DtPkY+SGK2li9FIXqshQ==} + engines: {node: '>=8.0.0'} + dependencies: + '@opencensus/web-types': 0.0.7 + '@opentelemetry/api': 1.0.0-rc.0 + tslib: 2.8.1 + dev: false + /@azure/core-tracing@1.2.0: resolution: {integrity: sha512-UKTiEJPkWcESPYJz3X5uKRYyOcJD+4nYph+KpfdPRnQJVrZfk0KJgdnaAWKfhsBBtAf/D58Az4AvCJEmWgIBAg==} engines: {node: '>=18.0.0'} @@ -1805,6 +1862,19 @@ packages: - supports-color dev: false + /@azure/template@1.0.11: + resolution: {integrity: sha512-C3cRndvh39WU3zI1GrXxTzAsGXjMa9CvOtizT9/6HFwnHx6wLkByV4fBU4Y9k8pivwcw63/rV6eNpeGkUua3ag==} + engines: {node: '>=8.0.0'} + dependencies: + '@azure/core-auth': 1.9.0 + '@azure/core-http': 1.2.6 + '@azure/core-tracing': 1.0.0-preview.11 + '@azure/logger': 1.1.4 + tslib: 2.8.1 + transitivePeerDependencies: + - encoding + dev: false + /@azure/web-pubsub-client@1.0.0-beta.2: resolution: {integrity: sha512-6OUjadAauR3l9oIafFG3As3Fh3JDha4UAJVwVmakKtgHuDfHsWZkAtdivlSBChfc0hqEvw2BuozVnZeIUdCaPg==} engines: {node: '>=14.0.0'} @@ -2850,6 +2920,11 @@ packages: resolution: {integrity: sha512-U69T3ItWHvLwGg5eJ0n3I62nWuE6ilHlmz7zM0npLBRvPRd7e6NYmg54vvRtP5mZG7kZqZCFVdsTWo7BPtBujg==} dev: false + /@opencensus/web-types@0.0.7: + resolution: {integrity: sha512-xB+w7ZDAu3YBzqH44rCmG9/RlrOmFuDPt/bpf17eJr8eZSrLt7nc7LnWdxM9Mmoj/YKMHpxRg28txu3TcpiL+g==} + engines: {node: '>=6.0'} + dev: false + /@opentelemetry/api-logs@0.54.0: resolution: {integrity: sha512-9HhEh5GqFrassUndqJsyW7a0PzfyWr2eV2xwzHLIS+wX3125+9HE9FMRAKmJRwxZhgZGwH3HNQQjoMGZqmOeVA==} engines: {node: '>=14'} @@ -2864,6 +2939,11 @@ packages: '@opentelemetry/api': 1.9.0 dev: false + /@opentelemetry/api@1.0.0-rc.0: + resolution: {integrity: sha512-iXKByCMfrlO5S6Oh97BuM56tM2cIBB0XsL/vWF/AtJrJEKx4MC/Xdu0xDsGXMGcNWpqF7ujMsjjnp0+UHBwnDQ==} + engines: {node: '>=8.0.0'} + dev: false + /@opentelemetry/api@1.9.0: resolution: {integrity: sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg==} engines: {node: '>=8.0.0'} @@ -4132,6 +4212,12 @@ packages: resolution: {integrity: sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==} dev: false + /@types/tunnel@0.0.1: + resolution: {integrity: sha512-AOqu6bQu5MSWwYvehMXLukFHnupHrpZ8nvgae5Ggie9UwzDR1CCwoXgSSWNZJuyOlCdfdsWMA5F2LlmvyoTv8A==} + dependencies: + '@types/node': 20.17.6 + dev: false + /@types/underscore@1.13.0: resolution: {integrity: sha512-L6LBgy1f0EFQZ+7uSA57+n2g/s4Qs5r06Vwrwn0/nuK1de+adz00NWaztRQ30aEqw5qOaWbPI8u2cGQ52lj6VA==} dev: false @@ -6950,6 +7036,15 @@ packages: resolution: {integrity: sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A==} dev: false + /form-data@3.0.2: + resolution: {integrity: sha512-sJe+TQb2vIaIyO783qN6BlMYWMw3WBOHA1Ay2qxsnjuafEOQFJ2JakedOQirT6D5XPRxDvS7AHYyem9fTpb4LQ==} + engines: {node: '>= 6'} + dependencies: + asynckit: 0.4.0 + combined-stream: 1.0.8 + mime-types: 2.1.35 + dev: false + /form-data@4.0.1: resolution: {integrity: sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==} engines: {node: '>= 6'} @@ -10052,6 +10147,10 @@ packages: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} dev: false + /sax@1.4.1: + resolution: {integrity: sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg==} + dev: false + /seek-bzip@1.0.6: resolution: {integrity: sha512-e1QtP3YL5tWww8uKaOCQ18UxIT2laNBXHjV/S2WYCiK4udiv8lkG89KRIoCjUagnAmCBurjF4zEVX2ByBbnCjQ==} hasBin: true @@ -10981,6 +11080,11 @@ packages: safe-buffer: 5.2.1 dev: false + /tunnel@0.0.6: + resolution: {integrity: sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==} + engines: {node: '>=0.6.11 <=0.7.0 || >=0.7.3'} + dev: false + /type-check@0.3.2: resolution: {integrity: sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==} engines: {node: '>= 0.8.0'} @@ -11853,6 +11957,19 @@ packages: optional: true dev: false + /xml2js@0.4.23: + resolution: {integrity: sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==} + engines: {node: '>=4.0.0'} + dependencies: + sax: 1.4.1 + xmlbuilder: 11.0.1 + dev: false + + /xmlbuilder@11.0.1: + resolution: {integrity: sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==} + engines: {node: '>=4.0'} + dev: false + /xmlbuilder@12.0.0: resolution: {integrity: sha512-lMo8DJ8u6JRWp0/Y4XLa/atVDr75H9litKlb2E5j3V3MesoL50EBgZDWoLT3F/LztVnG67GjPXLZpqcky/UMnQ==} engines: {node: '>=6.0'} @@ -22815,11 +22932,12 @@ packages: dev: false file:projects/perf-template.tgz: - resolution: {integrity: sha512-JFCNoKOfUy/Fpku2+O3FUNBUQizLMDZLTCA2LfIMd6O1RFZB8nddRc+x9VNhMhmPhIAaAhg03Z2iZLlTiHEJZw==, tarball: file:projects/perf-template.tgz} + resolution: {integrity: sha512-kmbAc3bouxAlOjHvI8nrh8wa9dJShOSqRDKs84u6EZrIqLW0O/MO2ZLMMlMyIySWutUiiazwuYPvcGuczabYew==, tarball: file:projects/perf-template.tgz} name: '@rush-temp/perf-template' version: 0.0.0 dependencies: - '@azure/app-configuration': 1.5.0-beta.2 + '@azure/app-configuration': 1.8.0 + '@azure/template': 1.0.11 '@types/node': 18.19.64 dotenv: 16.4.5 eslint: 9.14.0 @@ -22827,8 +22945,7 @@ packages: tslib: 2.8.1 typescript: 5.6.3 transitivePeerDependencies: - - '@swc/core' - - '@swc/wasm' + - encoding - jiti - supports-color dev: false @@ -23864,7 +23981,7 @@ packages: dev: false file:projects/template-dpg.tgz: - resolution: {integrity: sha512-wYF0Ghijqe5ChRQ1Mm3WPgFCrVjGItpUywmLmFcIjFev16RdOA0aQf3YpC6tvVBZHM00vuW+GJ+aEpAdUL9ZAQ==, tarball: file:projects/template-dpg.tgz} + resolution: {integrity: sha512-UJwkAC81L049EHeAKs0ou6XCuvhFYRC0eddCEuuTg5a9/y65Jm/zVZQm9WieV/cIgQVUcQSH6zz/4Fg7jqnvvg==, tarball: file:projects/template-dpg.tgz} name: '@rush-temp/template-dpg' version: 0.0.0 dependencies: @@ -23874,6 +23991,8 @@ packages: '@types/chai': 4.3.20 '@types/mocha': 10.0.9 '@types/node': 18.19.64 + '@vitest/browser': 2.1.5(@types/node@18.19.64)(playwright@1.49.0)(typescript@5.6.3)(vitest@2.1.5) + '@vitest/coverage-istanbul': 2.1.5(vitest@2.1.5) chai: 4.3.10 dotenv: 16.4.5 eslint: 9.14.0 @@ -23889,19 +24008,33 @@ packages: karma-sourcemap-loader: 0.3.8 mocha: 10.8.2 nyc: 17.1.0 + playwright: 1.49.0 puppeteer: 23.7.0(typescript@5.6.3) ts-node: 10.9.2(@types/node@18.19.64)(typescript@5.6.3) tslib: 2.8.1 typescript: 5.6.3 util: 0.12.5 + vitest: 2.1.5(@types/node@18.19.64)(@vitest/browser@2.1.5) transitivePeerDependencies: - - '@swc/core' - - '@swc/wasm' + - '@edge-runtime/vm' + - '@vitest/ui' - bufferutil - - debug + - happy-dom - jiti + - jsdom + - less + - lightningcss + - msw + - safaridriver + - sass + - sass-embedded + - stylus + - sugarss - supports-color + - terser - utf-8-validate + - vite + - webdriverio dev: false file:projects/template.tgz: diff --git a/sdk/template/perf-tests/template/package.json b/sdk/template/perf-tests/template/package.json index b992b672aea..ab81ed080dc 100644 --- a/sdk/template/perf-tests/template/package.json +++ b/sdk/template/perf-tests/template/package.json @@ -4,23 +4,23 @@ "version": "1.0.0", "description": "Template project demonstrating use of the perf framework.", "main": "", + "type": "module", "keywords": [], "author": "", - "license": "ISC", + "license": "MIT", "dependencies": { "@azure-tools/test-perf": "^1.0.0", - "@azure/app-configuration": "1.5.0-beta.2", - "@azure/core-util": "^1.6.1", - "@azure/identity": "^4.0.1", - "@azure/template": "^1.0.11-beta.1 || ^1.0.12-beta.1", + "@azure/app-configuration": "1.8.0", + "@azure/core-util": "^1.11.0", + "@azure/identity": "^4.5.0", + "@azure/template": "^1.0.11", "dotenv": "^16.0.0" }, "devDependencies": { "@azure/dev-tool": "^1.0.0", "@types/node": "^18.0.0", "eslint": "^9.9.0", - "ts-node": "^10.0.0", - "tslib": "^2.2.0", + "tslib": "^2.8.1", "typescript": "~5.6.2" }, "private": true, @@ -34,8 +34,8 @@ "integration-test": "echo skipped", "integration-test:browser": "echo skipped", "integration-test:node": "echo skipped", - "lint": "eslint -c ../../../../common/tools/eslint-plugin-azure-sdk/eslint.perftests.config.mjs test", - "lint:fix": "eslint -c ../../../../common/tools/eslint-plugin-azure-sdk/eslint.perftests.config.mjs test --fix --fix-type [problem,suggestion]", + "lint": "dev-tool run vendored eslint -c ../../../../common/tools/eslint-plugin-azure-sdk/eslint.perftests.config.mjs test", + "lint:fix": "dev-tool run vendored eslint -c ../../../../common/tools/eslint-plugin-azure-sdk/eslint.perftests.config.mjs test --fix --fix-type [problem,suggestion]", "pack": "npm pack 2>&1", "perf-test:node": "npm run build && node dist-esm/index.spec.js", "test": "echo skipped", diff --git a/sdk/template/perf-tests/template/test/getConfigurationSetting.spec.ts b/sdk/template/perf-tests/template/test/getConfigurationSetting.spec.ts index 19550dae9f5..eca43f5235b 100644 --- a/sdk/template/perf-tests/template/test/getConfigurationSetting.spec.ts +++ b/sdk/template/perf-tests/template/test/getConfigurationSetting.spec.ts @@ -3,7 +3,7 @@ import { randomUUID } from "@azure/core-util"; import { PerfOptionDictionary } from "@azure-tools/test-perf"; -import { TemplateTest } from "./templateBase.spec"; +import { TemplateTest } from "./templateBase.spec.js"; interface GetConfigurationSettingTestOptions { /** diff --git a/sdk/template/perf-tests/template/test/index.spec.ts b/sdk/template/perf-tests/template/test/index.spec.ts index a5517b2d86c..0558c41549f 100644 --- a/sdk/template/perf-tests/template/test/index.spec.ts +++ b/sdk/template/perf-tests/template/test/index.spec.ts @@ -2,7 +2,7 @@ // Licensed under the MIT License. import { createPerfProgram } from "@azure-tools/test-perf"; -import { GetConfigurationSettingTest } from "./getConfigurationSetting.spec"; +import { GetConfigurationSettingTest } from "./getConfigurationSetting.spec.js"; const perfProgram = createPerfProgram(GetConfigurationSettingTest); diff --git a/sdk/template/perf-tests/template/test/templateBase.spec.ts b/sdk/template/perf-tests/template/test/templateBase.spec.ts index 26ae16ad276..54265774bb3 100644 --- a/sdk/template/perf-tests/template/test/templateBase.spec.ts +++ b/sdk/template/perf-tests/template/test/templateBase.spec.ts @@ -5,10 +5,7 @@ import { AppConfigurationClient } from "@azure/app-configuration"; import { PerfTest, getEnvVar } from "@azure-tools/test-perf"; import { ConfigurationClient } from "@azure/template"; import { DefaultAzureCredential } from "@azure/identity"; - -// Expects the .env file at the same level -import * as dotenv from "dotenv"; -dotenv.config(); +import "dotenv/config"; export abstract class TemplateTest extends PerfTest { // Since the template project's client is limited in scope (and only supports getConfigurationSetting), diff --git a/sdk/template/perf-tests/template/tsconfig.json b/sdk/template/perf-tests/template/tsconfig.json index 95d3617b53e..99aafee93f1 100644 --- a/sdk/template/perf-tests/template/tsconfig.json +++ b/sdk/template/perf-tests/template/tsconfig.json @@ -1,10 +1,11 @@ { "extends": "../../../../tsconfig", "compilerOptions": { - "module": "CommonJS", + "module": "NodeNext", + "moduleResolution": "nodenext", "declarationDir": "./typings/latest", "lib": ["ES6", "ESNext.AsyncIterable"], - "noEmit": true + "outDir": "./dist-esm" }, "compileOnSave": true, "include": ["./test/**/*.ts"] diff --git a/sdk/template/template-dpg/.mocharc.json b/sdk/template/template-dpg/.mocharc.json deleted file mode 100644 index 332e7113dd5..00000000000 --- a/sdk/template/template-dpg/.mocharc.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "extension": ["ts"], - "timeout": "1200000", - "loader": "ts-node/esm" -} diff --git a/sdk/template/template-dpg/CHANGELOG.md b/sdk/template/template-dpg/CHANGELOG.md index a718d47456e..683acc95d91 100644 --- a/sdk/template/template-dpg/CHANGELOG.md +++ b/sdk/template/template-dpg/CHANGELOG.md @@ -1,6 +1,17 @@ # Release History -## 1.0.0-beta.1 (2023-05-26) +## 1.0.0-beta.2 (unreleased) ### Features Added -- Introducing the Azure SDK for JavaScript Template DPG project +- Test Release Pipeline + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + +## 1.0.0-beta.1 (2023-08-11) + +### Features Added +- Test Release Pipeline diff --git a/sdk/template/template-dpg/api-extractor.json b/sdk/template/template-dpg/api-extractor.json index b078dd27ab6..e36762d3aa0 100644 --- a/sdk/template/template-dpg/api-extractor.json +++ b/sdk/template/template-dpg/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/latest/template-dpg.d.ts" + "publicTrimmedFilePath": "dist/template-dpg.d.ts" }, "messages": { "tsdocMessageReporting": { diff --git a/sdk/template/template-dpg/karma.conf.cjs b/sdk/template/template-dpg/karma.conf.cjs deleted file mode 100644 index faf1fb3e2f4..00000000000 --- a/sdk/template/template-dpg/karma.conf.cjs +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// https://github.com/karma-runner/karma-chrome-launcher -process.env.CHROME_BIN = require("puppeteer").executablePath(); -require("dotenv").config(); -const { relativeRecordingsPath } = require("@azure-tools/test-recorder"); - -process.env.RECORDINGS_RELATIVE_PATH = relativeRecordingsPath(); - -module.exports = function (config) { - config.set({ - // base path that will be used to resolve all patterns (eg. files, exclude) - basePath: "./", - - // frameworks to use - // available frameworks: https://npmjs.org/browse/keyword/karma-adapter - frameworks: ["mocha"], - - plugins: [ - "karma-mocha", - "karma-mocha-reporter", - "karma-chrome-launcher", - "karma-firefox-launcher", - "karma-env-preprocessor", - "karma-coverage", - "karma-sourcemap-loader", - "karma-junit-reporter", - ], - - // list of files / patterns to load in the browser - files: [ - "dist-test/index.browser.js", - { pattern: "dist-test/index.browser.js.map", type: "html", included: false, served: true }, - ], - - // list of files / patterns to exclude - exclude: [], - - // preprocess matching files before serving them to the browser - // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor - preprocessors: { - "**/*.js": ["sourcemap", "env"], - // IMPORTANT: COMMENT following line if you want to debug in your browsers!! - // Preprocess source file to calculate code coverage, however this will make source file unreadable - //"dist-test/index.browser.js": ["coverage"] - }, - - // inject following environment values into browser testing with window.__env__ - // environment values MUST be exported or set with same console running "karma start" - // https://www.npmjs.com/package/karma-env-preprocessor - envPreprocessor: [ - "TEST_MODE", - "WIDGET_SERVICE_ENDPOINT", - "AZURE_CLIENT_ID", - "AZURE_CLIENT_SECRET", - "AZURE_TENANT_ID", - "RECORDINGS_RELATIVE_PATH", - ], - // test results reporter to use - // possible values: 'dots', 'progress' - // available reporters: https://npmjs.org/browse/keyword/karma-reporter - reporters: ["mocha", "coverage", "junit"], - - coverageReporter: { - // specify a common output directory - dir: "coverage-browser/", - reporters: [ - { type: "json", subdir: ".", file: "coverage.json" }, - { type: "lcovonly", subdir: ".", file: "lcov.info" }, - { type: "html", subdir: "html" }, - { type: "cobertura", subdir: ".", file: "cobertura-coverage.xml" }, - ], - }, - - junitReporter: { - outputDir: "", // results will be saved as $outputDir/$browserName.xml - outputFile: "test-results.browser.xml", // if included, results will be saved as $outputDir/$browserName/$outputFile - suite: "", // suite will become the package name attribute in xml testsuite element - useBrowserName: false, // add browser name to report and classes names - nameFormatter: undefined, // function (browser, result) to customize the name attribute in xml testcase element - classNameFormatter: undefined, // function (browser, result) to customize the classname attribute in xml testcase element - properties: {}, // key value pair of properties to add to the section of the report - }, - - // web server port - port: 9876, - - // enable / disable colors in the output (reporters and logs) - colors: true, - - // level of logging - // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG - logLevel: config.LOG_INFO, - - // enable / disable watching file and executing tests whenever any file changes - autoWatch: false, - - // start these browsers - // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher - // 'ChromeHeadless', 'Chrome', 'Firefox', 'Edge', 'IE' - browsers: ['ChromeHeadlessNoSandbox'], - - customLaunchers: { - ChromeHeadlessNoSandbox: { - base: 'ChromeHeadless', - flags: ['--no-sandbox', "--disable-web-security"] - } - }, - - // Continuous Integration mode - // if true, Karma captures browsers, runs the tests and exits - singleRun: true, - - // Concurrency level - // how many browser should be started simultaneous - concurrency: 1, - - browserNoActivityTimeout: 600000, - browserDisconnectTimeout: 10000, - browserDisconnectTolerance: 3, - - client: { - mocha: { - // change Karma's debug.html to the mocha web reporter - reporter: "html", - timeout: "600000", - }, - }, - }); -}; diff --git a/sdk/template/template-dpg/package.json b/sdk/template/template-dpg/package.json index 31631eee850..3c39b53e78b 100644 --- a/sdk/template/template-dpg/package.json +++ b/sdk/template/template-dpg/package.json @@ -3,61 +3,94 @@ "version": "1.0.0-beta.1", "description": "Widget Service", "sdk-type": "client", - "main": "dist/index.js", - "module": "dist-esm/src/index.js", - "react-native": { - "./dist/index.js": "./dist-esm/src/index.js" - }, + "main": "./dist/commonjs/index.js", + "module": "./dist/esm/index.js", "type": "module", "exports": { + "./package.json": "./package.json", ".": { - "types": "./types/src/index.d.ts", - "require": "./dist/index.cjs", - "import": "./dist-esm/src/index.js" + "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" + } }, "./api": { - "types": "./types/src/api/index.d.ts", - "import": "./dist-esm/src/api/index.js" + "browser": { + "types": "./dist/browser/api/index.d.ts", + "default": "./dist/browser/api/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/index.d.ts", + "default": "./dist/react-native/api/index.js" + }, + "import": { + "types": "./dist/esm/api/index.d.ts", + "default": "./dist/esm/api/index.js" + }, + "require": { + "types": "./dist/commonjs/api/index.d.ts", + "default": "./dist/commonjs/api/index.js" + } }, "./rest": { - "types": "./types/src/rest/index.d.ts", - "import": "./dist-esm/src/rest/index.js" + "browser": { + "types": "./dist/browser/rest/index.d.ts", + "default": "./dist/browser/rest/index.js" + }, + "react-native": { + "types": "./dist/react-native/rest/index.d.ts", + "default": "./dist/react-native/rest/index.js" + }, + "import": { + "types": "./dist/esm/rest/index.d.ts", + "default": "./dist/esm/rest/index.js" + }, + "require": { + "types": "./dist/commonjs/rest/index.d.ts", + "default": "./dist/commonjs/rest/index.js" + } } }, "//metadata": {}, - "types": "types/latest/template-dpg.d.ts", + "types": "./dist/commonjs/index.d.ts", "scripts": { - "build": "tsc -p . && dev-tool run bundle && dev-tool run extract-api && npm run build:output", - "build:output": "node scripts/renameOutput.mjs", + "build": "npm run clean && dev-tool run build-package && dev-tool run extract-api", "build:samples": "echo Obsolete", "build:test": "echo skipped. actual commands inlined in browser test scripts", - "build:test:browser": "tsc -p . && dev-tool run bundle", - "build:test:node": "tsc -p . && 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}\"", "clean": "dev-tool run vendored rimraf --glob dist dist-* temp types *.tgz *.log", "customize": "dev-tool customization apply -s sources/generated/src -c sources/customizations/src && npm run format", "execute:samples": "dev-tool samples run samples-dev", - "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 \"sources/customizations/**/*.ts\" \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"", "integration-test": "npm run integration-test:node && npm run integration-test:browser", - "integration-test:browser": "tsc -p . && dev-tool run bundle && dev-tool run test:browser", - "integration-test:node": "dev-tool run test:node-js-input -- --timeout 5000000 'dist-esm/test/**/*.spec.js'", + "integration-test:browser": "npm run clean && dev-tool run build-package && dev-tool run build-test && dev-tool run test:vitest --browser", + "integration-test:node": "dev-tool run test:vitest", "lint": "eslint README.md package.json api-extractor.json src test", "lint:fix": "eslint README.md package.json api-extractor.json src test --fix --fix-type [problem,suggestion]", "pack": "npm pack 2>&1", - "test": "npm run clean && tsc -p . && npm run unit-test:node && dev-tool run bundle && npm run unit-test:browser && npm run integration-test", + "test": "npm run clean && dev-tool run build-package && npm run unit-test:node && dev-tool run bundle && npm run unit-test:browser && npm run integration-test", "test:browser": "npm run clean && npm run build && npm run integration-test:browser", - "test:node": "npm run clean && tsc -p . && npm run integration-test:node", + "test:node": "npm run clean && dev-tool run build-package && npm run integration-test:node", "unit-test": "npm run unit-test:node && npm run unit-test:browser", - "unit-test:browser": "tsc -p . && dev-tool run bundle && dev-tool run test:browser", - "unit-test:node": "dev-tool run test:node-ts-input -- \"test/internal/unit/{,!(browser)/**/}*.spec.ts\" \"test/public/{,!(browser)/**/}*.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", - "types/src", "README.md", "LICENSE" ], @@ -79,40 +112,44 @@ "sideEffects": false, "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json", "devDependencies": { - "@azure-tools/test-credential": "^1.0.4", - "@azure-tools/test-recorder": "^3.0.0", - "@azure-tools/test-utils": "^1.0.1", + "@azure-tools/test-credential": "^2.0.0", + "@azure-tools/test-recorder": "^4.1.0", + "@azure-tools/test-utils-vitest": "^1.0.0", "@azure/dev-tool": "^1.0.0", "@azure/eslint-plugin-azure-sdk": "^3.0.0", - "@types/chai": "^4.3.1", - "@types/mocha": "^10.0.0", "@types/node": "^18.0.0", - "chai": "^4.3.6", + "@vitest/browser": "^2.1.5", + "@vitest/coverage-istanbul": "^2.1.5", "dotenv": "^16.0.0", "eslint": "^9.9.0", - "karma": "^6.4.0", - "karma-chrome-launcher": "^3.1.1", - "karma-coverage": "^2.2.0", - "karma-edge-launcher": "^0.4.2", - "karma-env-preprocessor": "^0.1.1", - "karma-firefox-launcher": "^2.1.2", - "karma-junit-reporter": "^2.0.1", - "karma-mocha": "^2.0.1", - "karma-mocha-reporter": "^2.2.5", - "karma-sourcemap-loader": "^0.3.8", - "mocha": "^10.0.0", - "nyc": "^17.0.0", - "puppeteer": "^23.0.2", - "ts-node": "^10.0.0", + "playwright": "^1.49.0", "typescript": "~5.6.2", - "util": "^0.12.4" + "vitest": "^2.1.5" }, "dependencies": { - "@azure-rest/core-client": "^1.1.2", - "@azure/core-auth": "^1.4.1", - "@azure/core-rest-pipeline": "^1.8.1", - "@azure/core-util": "^1.1.0", - "@azure/logger": "^1.0.3", - "tslib": "^2.4.0" - } + "@azure-rest/core-client": "^2.3.1", + "@azure/core-auth": "^1.9.0", + "@azure/core-rest-pipeline": "^1.18.0", + "@azure/core-util": "^1.11.0", + "@azure/logger": "^1.1.4", + "tslib": "^2.8.1" + }, + "tshy": { + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts", + "./api": "./src/api/index.ts", + "./rest": "./src/rest/index.ts" + }, + "dialects": [ + "esm", + "commonjs" + ], + "esmDialects": [ + "browser", + "react-native" + ], + "selfLink": false + }, + "browser": "./dist/browser/index.js" } diff --git a/sdk/template/template-dpg/scripts/renameOutput.mjs b/sdk/template/template-dpg/scripts/renameOutput.mjs deleted file mode 100644 index 5a672148041..00000000000 --- a/sdk/template/template-dpg/scripts/renameOutput.mjs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import * as fs from "fs"; -import * as path from "path"; -import * as url from "url"; - -const __dirname = url.fileURLToPath(new URL('.', import.meta.url)); -const destinationPath = path.join(__dirname, "../dist/"); - -const inputFile = path.join(destinationPath, "index.js"); -const inputMapFile = path.join(destinationPath, "index.js.map"); - -if (fs.existsSync(inputFile) && fs.existsSync(inputMapFile)) { - fs.renameSync(inputFile, path.join(destinationPath, "index.cjs")); - fs.renameSync(inputMapFile, path.join(destinationPath, "index.cjs.map")); -} diff --git a/sdk/template/template-dpg/test/public/widgetService.spec.ts b/sdk/template/template-dpg/test/public/widgetService.spec.ts index 21f40933702..fdbad5d261d 100644 --- a/sdk/template/template-dpg/test/public/widgetService.spec.ts +++ b/sdk/template/template-dpg/test/public/widgetService.spec.ts @@ -1,10 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { expect } from "chai"; -import type { Context } from "mocha"; import { WidgetServiceClient } from "../../src/index.js"; import { Recorder, assertEnvironmentVariable } from "@azure-tools/test-recorder"; +import { describe, it, expect, beforeEach, afterEach } from "vitest"; // When the recorder observes the values of these environment variables in any // recorded HTTP request or response, it will replace them with the values they @@ -36,7 +35,7 @@ function createClient(recorder: Recorder): WidgetServiceClient { return client; } -describe("WidgetServiceClient", function () { +describe("WidgetServiceClient", () => { // Declare the client and recorder instances. We will set them using the // beforeEach hook. let recorder: Recorder; @@ -45,11 +44,11 @@ describe("WidgetServiceClient", 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(async function (this: Context) { + beforeEach(async (ctx) => { // 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 = new Recorder(this.currentTest); + recorder = new Recorder(ctx); // Start the recorder before each test. await recorder.start({ @@ -65,12 +64,12 @@ describe("WidgetServiceClient", function () { }); // After each test, we need to stop the recording. - afterEach(async function () { + afterEach(async () => { await recorder.stop(); }); - describe("Widgets CRUD", function () { - it("should create a widget", async function () { + describe("Widgets CRUD", () => { + it("should create a widget", async () => { const widget = await client.createWidget(10, "red"); // eslint-disable-next-line no-unused-expressions expect(widget).to.exist; @@ -80,13 +79,13 @@ describe("WidgetServiceClient", function () { expect(widget.weight).to.equal(10); }); - it("should get a widget", async function () { + it("should get a widget", async () => { const widget = await client.createWidget(10, "red"); const retrievedWidget = await client.getWidget(widget.id); expect(retrievedWidget).to.deep.equal(widget); }); - it("should update a widget", async function () { + it("should update a widget", async () => { const widget = await client.createWidget(10, "red"); const updatedWidget = await client.updateWidget(widget.id, { weight: 20 }); // eslint-disable-next-line no-unused-expressions @@ -96,7 +95,7 @@ describe("WidgetServiceClient", function () { expect(updatedWidget.weight).to.equal(20); }); - it("should delete a widget", async function () { + it("should delete a widget", async () => { const widget = await client.createWidget(10, "red"); await client.deleteWidget(widget.id); try { diff --git a/sdk/template/template-dpg/tsconfig.browser.config.json b/sdk/template/template-dpg/tsconfig.browser.config.json new file mode 100644 index 00000000000..f772e6eb3b7 --- /dev/null +++ b/sdk/template/template-dpg/tsconfig.browser.config.json @@ -0,0 +1,10 @@ +{ + "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/template/template-dpg/tsconfig.json b/sdk/template/template-dpg/tsconfig.json index 8e7e6a94251..8516b654ef9 100644 --- a/sdk/template/template-dpg/tsconfig.json +++ b/sdk/template/template-dpg/tsconfig.json @@ -1,14 +1,16 @@ { "extends": "../../../tsconfig", "compilerOptions": { - "outDir": "./dist-esm", - "declarationDir": "./types", - "paths": { "@azure/template-dpg": ["./src/index.js"] }, + "paths": { + "@azure/template-dpg": ["./src/index.js"] + }, "module": "NodeNext", "moduleResolution": "NodeNext", "lib": ["esnext"], "rootDir": "." }, - "ts-node": { "esm": true }, - "include": ["src/**/*.ts", "test/**/*.ts", "samples-dev/**/*.ts"] + "ts-node": { + "esm": true + }, + "include": ["src/**/*.ts", "src/**/*.mts", "src/**/*.cts", "samples-dev/**/*.ts", "test/**/*.ts"] } diff --git a/sdk/template/template-dpg/vitest.browser.config.ts b/sdk/template/template-dpg/vitest.browser.config.ts new file mode 100644 index 00000000000..b9401dbaf2b --- /dev/null +++ b/sdk/template/template-dpg/vitest.browser.config.ts @@ -0,0 +1,16 @@ +// 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"], + hookTimeout: 500000, + testTimeout: 500000, + }, + }), +); diff --git a/sdk/template/template-dpg/vitest.config.ts b/sdk/template/template-dpg/vitest.config.ts new file mode 100644 index 00000000000..b073a7d2a97 --- /dev/null +++ b/sdk/template/template-dpg/vitest.config.ts @@ -0,0 +1,16 @@ +// 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"], + hookTimeout: 500000, + testTimeout: 500000, + }, + }), +); diff --git a/sdk/template/template/CHANGELOG.md b/sdk/template/template/CHANGELOG.md index c1b690a7346..d6fdf1328bf 100644 --- a/sdk/template/template/CHANGELOG.md +++ b/sdk/template/template/CHANGELOG.md @@ -1,6 +1,22 @@ # Release History -## 1.0.11-beta.1 (unreleased) +## 1.0.13-beta.1 (unreleased) + +### Features Added +- Test Release Pipeline + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + +## 1.0.12 (2021-06-15) + +### Features Added +- Test Release Pipeline + +## 1.0.11 (2021-06-15) ### Features Added - Test Release Pipeline diff --git a/sdk/template/template/package.json b/sdk/template/template/package.json index 1388bf7bf3f..49409eb75e8 100644 --- a/sdk/template/template/package.json +++ b/sdk/template/template/package.json @@ -1,6 +1,6 @@ { "name": "@azure/template", - "version": "1.0.11-beta.1", + "version": "1.0.13-beta.1", "description": "Example project for learning how to build a client library", "sdk-type": "client", "main": "./dist/commonjs/index.js", diff --git a/sdk/template/template/src/constants.ts b/sdk/template/template/src/constants.ts index f818ac0569a..bcdbffcd27c 100644 --- a/sdk/template/template/src/constants.ts +++ b/sdk/template/template/src/constants.ts @@ -1,4 +1,4 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -export const SDK_VERSION: string = "1.0.11-beta.1"; +export const SDK_VERSION: string = "1.0.13-beta.1"; diff --git a/sdk/template/template/src/generated/generatedClientContext.ts b/sdk/template/template/src/generated/generatedClientContext.ts index 27d9ca58a27..3749c63147c 100644 --- a/sdk/template/template/src/generated/generatedClientContext.ts +++ b/sdk/template/template/src/generated/generatedClientContext.ts @@ -33,7 +33,7 @@ export class GeneratedClientContext extends coreClient.ServiceClient { requestContentType: "application/json; charset=utf-8" }; - const packageDetails = `azsdk-js-template/1.0.11-beta.1`; + const packageDetails = `azsdk-js-template/1.0.13-beta.1`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` diff --git a/sdk/template/template/swagger/README.md b/sdk/template/template/swagger/README.md index 786761c9b45..50c5f01394d 100644 --- a/sdk/template/template/swagger/README.md +++ b/sdk/template/template/swagger/README.md @@ -15,7 +15,7 @@ output-folder: ../ source-code-folder-path: ./src/generated input-file: ./appconfiguration.json add-credentials: false -package-version: 1.0.11-beta.1 +package-version: 1.0.13-beta.1 disable-async-iterators: true hide-clients: true use-extension: