Skip to content

Commit

Permalink
[perf] Migrate @azure-tests/perf-container-registry to ESM (#32217)
Browse files Browse the repository at this point in the history
### Packages impacted by this PR

- @azure-tests/perf-container-registry

### Issues associated with this PR

- #31338

### Describe the problem that is addressed by this PR

Migrates @azure-tests/perf-container-registry to ESM via 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)

---------

Co-authored-by: Scott Beddall <scbedd@microsoft.com>
  • Loading branch information
mpodwysocki and scbedd authored Dec 17, 2024
1 parent e063608 commit 5239cb7
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 27 deletions.
61 changes: 47 additions & 14 deletions sdk/containerregistry/perf-tests/container-registry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,40 @@
"name": "@azure-tests/perf-container-registry",
"version": "1.0.0",
"description": "",
"main": "",
"main": "./dist/commonjs/index.js",
"module": "./dist/esm/index.js",
"sdk-type": "perf-test",
"keywords": [],
"author": "",
"license": "ISC",
"author": "Microsoft Corporation",
"license": "MIT",
"dependencies": {
"@azure-tools/test-perf": "^1.0.0",
"@azure/container-registry": "^1.1.0-beta.1",
"dotenv": "^16.0.0"
"@azure/container-registry": "^1.1.0",
"dotenv": "^16.0.0",
"tslib": "^2.8.1"
},
"devDependencies": {
"@azure-tools/test-utils-vitest": "^1.0.0",
"@azure/dev-tool": "^1.0.0",
"@types/node": "^18.0.0",
"eslint": "^9.9.0",
"ts-node": "^10.0.0",
"tslib": "^2.2.0",
"typescript": "~5.6.2"
},
"private": true,
"scripts": {
"build": "tsc -p .",
"build": "npm run clean && dev-tool run build-package",
"build:samples": "echo skipped",
"build:test": "echo skipped",
"check-format": "dev-tool run vendored prettier --list-different --config ../../../../.prettierrc.json --ignore-path ../../../../.prettierignore \"test/**/*.ts\" \"*.{js,json}\"",
"check-format": "dev-tool run vendored prettier --list-different --config ../../../../.prettierrc.json --ignore-path ../../../../.prettierignore \"src/**/*.ts\" \"*.{js,json}\"",
"clean": "dev-tool run vendored rimraf --glob dist dist-esm test-dist types *.tgz *.log",
"format": "dev-tool run vendored prettier --write --config ../../../../.prettierrc.json --ignore-path ../../../../.prettierignore \"test/**/*.ts\" \"*.{js,json}\"",
"format": "dev-tool run vendored prettier --write --config ../../../../.prettierrc.json --ignore-path ../../../../.prettierignore \"src/**/*.ts\" \"*.{js,json}\"",
"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": "eslint -c ../../../../common/tools/eslint-plugin-azure-sdk/eslint.perftests.config.mjs src",
"lint:fix": "eslint -c ../../../../common/tools/eslint-plugin-azure-sdk/eslint.perftests.config.mjs src --fix --fix-type [problem,suggestion]",
"pack": "npm pack 2>&1",
"perf-test:node": "npm run build && node dist-esm/index.spec.js",
"perf-test:node": "npm run build && node dist/esm/index.js",
"prebuild": "npm run clean",
"test": "echo skipped",
"test:browser": "echo skipped",
Expand All @@ -42,5 +44,36 @@
"unit-test:browser": "echo skipped",
"unit-test:node": "echo skipped",
"update-snippets": "echo skipped"
}
},
"type": "module",
"tshy": {
"exports": {
"./package.json": "./package.json",
".": "./src/index.ts"
},
"dialects": [
"esm",
"commonjs"
],
"selfLink": false
},
"files": [
"dist/",
"README.md",
"LICENSE"
],
"exports": {
"./package.json": "./package.json",
".": {
"import": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./dist/commonjs/index.d.ts",
"default": "./dist/commonjs/index.js"
}
}
},
"types": "./dist/commonjs/index.d.ts"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@

import { PerfTest, getEnvVar } from "@azure-tools/test-perf";
import { ContainerRegistryClient } from "@azure/container-registry";

// Expects the .env file at the same level
import * as dotenv from "dotenv";
dotenv.config();
import "dotenv/config";

export abstract class ContainerRegistryTest<TOptions> extends PerfTest<TOptions> {
client: ContainerRegistryClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Licensed under the MIT License.

import { createPerfProgram } from "@azure-tools/test-perf";
import { ArtifactListTest } from "./listArtifacts.spec";
import { RepositoryListTest } from "./listRepositories.spec";
import { ArtifactListTest } from "./listArtifacts.spec.js";
import { RepositoryListTest } from "./listRepositories.spec.js";

const perfProgram = createPerfProgram(RepositoryListTest, ArtifactListTest);
perfProgram.run();
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { PerfOptionDictionary, getEnvVar } from "@azure-tools/test-perf";
import { ContainerRepository } from "@azure/container-registry";
import { ContainerRegistryTest, ContainerRegistryTestOptions } from "./client.spec";
import { ContainerRegistryTest, ContainerRegistryTestOptions } from "./client.spec.js";

export class ArtifactListTest extends ContainerRegistryTest<ContainerRegistryTestOptions> {
repository: ContainerRepository;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { PerfOptionDictionary } from "@azure-tools/test-perf";
import { ContainerRegistryTest, ContainerRegistryTestOptions } from "./client.spec";
import { ContainerRegistryTest, ContainerRegistryTestOptions } from "./client.spec.js";

export class RepositoryListTest extends ContainerRegistryTest<ContainerRegistryTestOptions> {
public options: PerfOptionDictionary<ContainerRegistryTestOptions> = {};
Expand Down
20 changes: 15 additions & 5 deletions sdk/containerregistry/perf-tests/container-registry/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
{
"extends": "../../../../tsconfig",
"compilerOptions": {
"module": "CommonJS",
"lib": ["ES6", "ESNext.AsyncIterable"],
"noEmit": true
"module": "NodeNext",
"moduleResolution": "NodeNext",
"rootDir": ".",
"paths": {
"@azure-tests/perf-container-registry": ["./src/index"]
}
},
"compileOnSave": true,
"include": ["./test/**/*.ts"]
"include": [
"src/**/*.ts",
"src/**/*.mts",
"src/**/*.cts",
"samples-dev/**/*.ts",
"test/**/*.ts",
"test/**/*.mts",
"test/**/*.cts"
]
}

0 comments on commit 5239cb7

Please sign in to comment.