[documenttranslator] Migrate @azure-rest/ai-document-translator to ESM/vitest (#31904)
### Packages impacted by this PR - @azure-rest/ai-document-translator ### Issues associated with this PR - https://github.com/Azure/azure-sdk-for-js/issues/31338 ### Describe the problem that is addressed by this PR Migrates the `@azure-rest/ai-document-translator` package to ESM/vitest using code automation. ### What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen? ### Are there test cases added in this PR? _(If not, why?)_ ### Provide a list of related PRs _(if any)_ ### Command used to generate this PR:**_(Applicable only to SDK release request PRs)_ ### Checklists - [ ] Added impacted package name to the issue description - [ ] Does this PR needs any fixes in the SDK Generator?** _(If so, create an Issue in the [Autorest/typescript](https://github.com/Azure/autorest.typescript) repository and link it here)_ - [ ] Added a changelog (if necessary)
This commit is contained in:
Родитель
146170b71e
Коммит
f536ddce4f
|
@ -11740,7 +11740,7 @@ packages:
|
|||
dev: false
|
||||
|
||||
file:projects/ai-document-translator.tgz:
|
||||
resolution: {integrity: sha512-y7JZQ/Mi46HtLeR4IJQ8gtPpFbp1H+8s3XZniOxnhXzUkl/X2nwm5BjeHfi4v7HqIItJLwd1UZSEJHIY+a7RyA==, tarball: file:projects/ai-document-translator.tgz}
|
||||
resolution: {integrity: sha512-2c7EutaKrQ4OFiUWGK/oVUN+u3kzE+GE0KPxnrdJAINHuEUCmaSw+Herjnmy2U8emKx2PdimEXDFuh6QjNumPw==, tarball: file:projects/ai-document-translator.tgz}
|
||||
name: '@rush-temp/ai-document-translator'
|
||||
version: 0.0.0
|
||||
dependencies:
|
||||
|
@ -11750,6 +11750,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.15.0
|
||||
|
@ -11767,18 +11769,32 @@ packages:
|
|||
karma-sourcemap-loader: 0.3.8
|
||||
mocha: 10.8.2
|
||||
nyc: 17.1.0
|
||||
playwright: 1.49.0
|
||||
source-map-support: 0.5.21
|
||||
ts-node: 10.9.2(@types/node@18.19.64)(typescript@5.6.3)
|
||||
tslib: 2.8.1
|
||||
typescript: 5.6.3
|
||||
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/ai-form-recognizer.tgz:
|
||||
|
|
|
@ -197,7 +197,7 @@ Please refer to the samples folder to see code samples, including:
|
|||
|
||||
Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
|
||||
|
||||
```javascript
|
||||
```ts
|
||||
import { setLogLevel } from "@azure/logger";
|
||||
|
||||
setLogLevel("info");
|
||||
|
|
|
@ -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/ai-document-translator.d.ts"
|
||||
"publicTrimmedFilePath": "dist/ai-document-translator.d.ts"
|
||||
},
|
||||
"messages": {
|
||||
"tsdocMessageReporting": {
|
||||
|
|
|
@ -1,127 +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: ["source-map-support", "mocha"],
|
||||
|
||||
plugins: [
|
||||
"karma-mocha",
|
||||
"karma-mocha-reporter",
|
||||
"karma-chrome-launcher",
|
||||
"karma-firefox-launcher",
|
||||
"karma-env-preprocessor",
|
||||
"karma-coverage",
|
||||
"karma-sourcemap-loader",
|
||||
"karma-junit-reporter",
|
||||
"karma-json-to-file-reporter",
|
||||
"karma-source-map-support",
|
||||
"karma-json-preprocessor",
|
||||
],
|
||||
|
||||
// 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.js": ["coverage"]
|
||||
},
|
||||
|
||||
envPreprocessor: [
|
||||
"TEST_MODE",
|
||||
"ENDPOINT",
|
||||
"DOCUMENT_TRANSLATOR_API_KEY",
|
||||
"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 <properties> 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,
|
||||
|
||||
// --no-sandbox allows our tests to run in Linux without having to change the system.
|
||||
// --disable-web-security allows us to authenticate from the browser without having to write tests using interactive auth, which would be far more complex.
|
||||
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: false,
|
||||
|
||||
// Concurrency level
|
||||
// how many browser should be started simultaneous
|
||||
concurrency: 1,
|
||||
|
||||
browserNoActivityTimeout: 60000000,
|
||||
browserDisconnectTimeout: 10000,
|
||||
browserDisconnectTolerance: 3,
|
||||
|
||||
client: {
|
||||
mocha: {
|
||||
// change Karma's debug.html to the mocha web reporter
|
||||
reporter: "html",
|
||||
timeout: 0,
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
|
@ -13,9 +13,9 @@
|
|||
"isomorphic"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist-esm/src/index.js",
|
||||
"types": "./types/ai-document-translator.d.ts",
|
||||
"main": "./dist/commonjs/index.js",
|
||||
"module": "./dist/esm/index.js",
|
||||
"types": "./dist/commonjs/index.d.ts",
|
||||
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/documenttranslator/ai-document-translator/README.md",
|
||||
"repository": "github:Azure/azure-sdk-for-js",
|
||||
"bugs": {
|
||||
|
@ -23,8 +23,6 @@
|
|||
},
|
||||
"files": [
|
||||
"dist/",
|
||||
"dist-esm/src/",
|
||||
"types/ai-document-translator.d.ts",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
],
|
||||
|
@ -55,21 +53,21 @@
|
|||
}
|
||||
},
|
||||
"scripts": {
|
||||
"build": "npm run clean && tsc -p . && dev-tool run bundle && dev-tool run extract-api",
|
||||
"build:browser": "tsc -p . && dev-tool run bundle",
|
||||
"build:debug": "tsc -p . && dev-tool run bundle && dev-tool run extract-api",
|
||||
"build:node": "tsc -p . && dev-tool run bundle",
|
||||
"build": "npm run clean && dev-tool run build-package && dev-tool run extract-api",
|
||||
"build:browser": "dev-tool run build-package && dev-tool run bundle",
|
||||
"build:debug": "dev-tool run build-package && dev-tool run bundle && dev-tool run extract-api",
|
||||
"build:node": "dev-tool run build-package && dev-tool run bundle",
|
||||
"build:samples": "echo Obsolete.",
|
||||
"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\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
|
||||
"clean": "dev-tool run vendored rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log",
|
||||
"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 \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
|
||||
"generate:client": "autorest --typescript swagger/README.md && npm run format",
|
||||
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
|
||||
"integration-test:browser": "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 package.json api-extractor.json src test",
|
||||
"lint:fix": "eslint package.json api-extractor.json src test --fix --fix-type [problem,suggestion]",
|
||||
"pack": "npm pack 2>&1",
|
||||
|
@ -77,47 +75,71 @@
|
|||
"test:browser": "npm run clean && npm run build:test && npm run unit-test:browser",
|
||||
"test:node": "npm run clean && npm run build:test && npm run unit-test:node",
|
||||
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
|
||||
"unit-test:browser": "dev-tool run test:browser",
|
||||
"unit-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 --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"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"autoPublish": false,
|
||||
"dependencies": {
|
||||
"@azure-rest/core-client": "^1.0.0",
|
||||
"@azure-tools/test-recorder": "^3.0.0",
|
||||
"@azure/core-auth": "^1.3.0",
|
||||
"@azure/core-rest-pipeline": "^1.1.0",
|
||||
"@azure/logger": "^1.0.0",
|
||||
"tslib": "^2.2.0"
|
||||
"@azure-rest/core-client": "^2.3.1",
|
||||
"@azure/core-auth": "^1.9.0",
|
||||
"@azure/core-rest-pipeline": "^1.18.0",
|
||||
"@azure/logger": "^1.1.4",
|
||||
"tslib": "^2.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@azure-tools/test-credential": "^1.0.0",
|
||||
"@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",
|
||||
"@azure/identity": "^4.0.1",
|
||||
"@types/chai": "^4.1.6",
|
||||
"@types/mocha": "^10.0.0",
|
||||
"@azure/identity": "^4.5.0",
|
||||
"@types/node": "^18.0.0",
|
||||
"chai": "^4.2.0",
|
||||
"@vitest/browser": "^2.1.5",
|
||||
"@vitest/coverage-istanbul": "^2.1.5",
|
||||
"dotenv": "^16.0.0",
|
||||
"eslint": "^9.9.0",
|
||||
"karma": "^6.2.0",
|
||||
"karma-chrome-launcher": "^3.0.0",
|
||||
"karma-coverage": "^2.0.0",
|
||||
"karma-env-preprocessor": "^0.1.1",
|
||||
"karma-firefox-launcher": "^1.1.0",
|
||||
"karma-json-preprocessor": "^0.3.3",
|
||||
"karma-json-to-file-reporter": "^1.0.1",
|
||||
"karma-junit-reporter": "^2.0.1",
|
||||
"karma-mocha": "^2.0.1",
|
||||
"karma-mocha-reporter": "^2.2.5",
|
||||
"karma-source-map-support": "~1.4.0",
|
||||
"karma-sourcemap-loader": "^0.3.8",
|
||||
"mocha": "^10.0.0",
|
||||
"nyc": "^17.0.0",
|
||||
"source-map-support": "^0.5.9",
|
||||
"ts-node": "^10.0.0",
|
||||
"typescript": "~5.6.2"
|
||||
"playwright": "^1.49.0",
|
||||
"typescript": "~5.6.2",
|
||||
"vitest": "^2.1.5"
|
||||
},
|
||||
"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",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,14 +10,12 @@
|
|||
*/
|
||||
|
||||
import DocumentTranslator from "@azure-rest/ai-document-translator";
|
||||
|
||||
import * as dotenv from "dotenv";
|
||||
dotenv.config();
|
||||
import "dotenv/config";
|
||||
|
||||
const endpoint = process.env["ENDPOINT"] || "document-translator endpoint";
|
||||
const apiKey = process.env["DOCUMENT_TRANSLATOR_API_KEY"] || "<api key>";
|
||||
|
||||
export async function main() {
|
||||
export async function main(): Promise<void> {
|
||||
console.log("== List supported document formats sample ==");
|
||||
|
||||
const client = DocumentTranslator(endpoint, { key: apiKey });
|
||||
|
|
|
@ -14,10 +14,9 @@
|
|||
* @azsdk-weight 40
|
||||
*/
|
||||
|
||||
import DocumentTranslator, { StartTranslationDetails } from "@azure-rest/ai-document-translator";
|
||||
|
||||
import * as dotenv from "dotenv";
|
||||
dotenv.config();
|
||||
import type { StartTranslationDetails } from "@azure-rest/ai-document-translator";
|
||||
import DocumentTranslator from "@azure-rest/ai-document-translator";
|
||||
import "dotenv/config";
|
||||
|
||||
/**
|
||||
* These are states of the Long Running Operation considered as terminal
|
||||
|
@ -49,7 +48,7 @@ const batchSubmissionRequest: StartTranslationDetails = {
|
|||
],
|
||||
};
|
||||
|
||||
export async function main() {
|
||||
export async function main(): Promise<void> {
|
||||
console.log("== Translate documents in a container sample ==");
|
||||
|
||||
// Create a new client
|
||||
|
@ -113,7 +112,7 @@ function wait(seconds: number): Promise<void> {
|
|||
}
|
||||
|
||||
// Helper function that extracts the batch id from operation-location header
|
||||
function extractBatchId(batchUrl: string = "") {
|
||||
function extractBatchId(batchUrl: string = ""): string {
|
||||
const parts = batchUrl.split("/");
|
||||
|
||||
return parts[parts.length - 1];
|
||||
|
|
|
@ -51,7 +51,7 @@ import type {
|
|||
StartTranslation429Response,
|
||||
StartTranslation500Response,
|
||||
StartTranslation503Response,
|
||||
} from "./responses";
|
||||
} from "./responses.js";
|
||||
import type {
|
||||
CancelTranslationParameters,
|
||||
GetDocumentStatusParameters,
|
||||
|
@ -62,7 +62,7 @@ import type {
|
|||
GetTranslationStatusParameters,
|
||||
GetTranslationsStatusParameters,
|
||||
StartTranslationParameters,
|
||||
} from "./parameters";
|
||||
} from "./parameters.js";
|
||||
import type { Client, ClientOptions } from "@azure-rest/core-client";
|
||||
import { getClient } from "@azure-rest/core-client";
|
||||
import type { KeyCredential, TokenCredential } from "@azure/core-auth";
|
||||
|
|
|
@ -6,9 +6,10 @@
|
|||
* @packageDocumentation
|
||||
*/
|
||||
|
||||
import DocumentTranslator from "./documentTranslator";
|
||||
export * from "./documentTranslator";
|
||||
export * from "./models";
|
||||
export * from "./parameters";
|
||||
export * from "./responses";
|
||||
import DocumentTranslator from "./documentTranslator.js";
|
||||
export * from "./documentTranslator.js";
|
||||
export * from "./models.js";
|
||||
export * from "./parameters.js";
|
||||
export * from "./responses.js";
|
||||
// eslint-disable-next-line @azure/azure-sdk/ts-modules-only-named
|
||||
export default DocumentTranslator;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Licensed under the MIT License.
|
||||
|
||||
import type { RequestParameters } from "@azure-rest/core-client";
|
||||
import type { StartTranslationDetails } from "./models";
|
||||
import type { StartTranslationDetails } from "./models.js";
|
||||
|
||||
export interface StartTranslationBodyParam {
|
||||
body: StartTranslationDetails;
|
||||
|
|
|
@ -9,7 +9,7 @@ import type {
|
|||
DocumentsStatus,
|
||||
SupportedFileFormats,
|
||||
SupportedStorageSources,
|
||||
} from "./models";
|
||||
} from "./models.js";
|
||||
import type { HttpResponse } from "@azure-rest/core-client";
|
||||
import type { RawHttpHeaders } from "@azure/core-rest-pipeline";
|
||||
|
||||
|
|
|
@ -1,22 +1,21 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
import type { Context } from "mocha";
|
||||
import type { DocumentTranslatorClient } from "../../src";
|
||||
import type { DocumentTranslatorClient } from "../../src/index.js";
|
||||
import { Recorder } from "@azure-tools/test-recorder";
|
||||
import { assert } from "chai";
|
||||
import { createClient } from "./utils/recordedClient";
|
||||
import { createClient } from "./utils/recordedClient.js";
|
||||
import { describe, it, assert, beforeEach, afterEach } from "vitest";
|
||||
|
||||
describe("List Document Formats", () => {
|
||||
let recorder: Recorder;
|
||||
let client: DocumentTranslatorClient;
|
||||
|
||||
beforeEach(async function (this: Context) {
|
||||
recorder = new Recorder(this.currentTest);
|
||||
beforeEach(async (ctx) => {
|
||||
recorder = new Recorder(ctx);
|
||||
client = await createClient(recorder);
|
||||
});
|
||||
|
||||
afterEach(async function () {
|
||||
afterEach(async () => {
|
||||
await recorder.stop();
|
||||
});
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
/// <reference lib="esnext.asynciterable" />
|
||||
|
||||
import type { DocumentTranslatorClient } from "../../../src";
|
||||
import DocumentTranslator from "../../../src";
|
||||
import type { DocumentTranslatorClient } from "../../../src/index.js";
|
||||
import DocumentTranslator from "../../../src/index.js";
|
||||
import type { Recorder } from "@azure-tools/test-recorder";
|
||||
import { env } from "@azure-tools/test-recorder";
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
|
@ -1,11 +1,12 @@
|
|||
{
|
||||
"extends": "../../../tsconfig",
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist-esm",
|
||||
"declarationDir": "./types",
|
||||
"paths": {
|
||||
"@azure-rest/ai-document-translator": ["./src/index"]
|
||||
}
|
||||
},
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"rootDir": "."
|
||||
},
|
||||
"include": ["src/**/*.ts", "test/**/*.ts", "samples-dev/**/*.ts", "../documentTranslation.ts"]
|
||||
"include": ["src/**/*.ts", "src/**/*.mts", "src/**/*.cts", "samples-dev/**/*.ts", "test/**/*.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: 5000000,
|
||||
testTimeout: 5000000,
|
||||
},
|
||||
}),
|
||||
);
|
|
@ -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: 5000000,
|
||||
testTimeout: 5000000,
|
||||
},
|
||||
}),
|
||||
);
|
Загрузка…
Ссылка в новой задаче