[EngSys] Fix format checking error (#27602)
Some files are not formated in commits that were merged without CI. This PR updates them with the result from `rush format`, and also fixes `format` script for ts-http-runtime
This commit is contained in:
Родитель
49626ced63
Коммит
d44ad35a73
|
@ -96,15 +96,18 @@ function ignoreExternalModules(warning: RollupWarning): boolean {
|
|||
);
|
||||
}
|
||||
|
||||
function createWarningInhibitors({ ignoreMissingNodeBuiltins }: MakeOnWarnForTestingOptions = {}): Array<(warning: RollupWarning) => boolean> {return [
|
||||
ignoreChaiCircularDependency,
|
||||
ignoreRheaPromiseCircularDependency,
|
||||
ignoreNiseSinonEval,
|
||||
ignoreOpenTelemetryCircularDependency,
|
||||
ignoreOpenTelemetryThisIsUndefined,
|
||||
ignoreMissingExportsFromEmpty,
|
||||
...ignoreMissingNodeBuiltins ? [ignoreExternalModules] : [],
|
||||
];
|
||||
function createWarningInhibitors({
|
||||
ignoreMissingNodeBuiltins,
|
||||
}: MakeOnWarnForTestingOptions = {}): Array<(warning: RollupWarning) => boolean> {
|
||||
return [
|
||||
ignoreChaiCircularDependency,
|
||||
ignoreRheaPromiseCircularDependency,
|
||||
ignoreNiseSinonEval,
|
||||
ignoreOpenTelemetryCircularDependency,
|
||||
ignoreOpenTelemetryThisIsUndefined,
|
||||
ignoreMissingExportsFromEmpty,
|
||||
...(ignoreMissingNodeBuiltins ? [ignoreExternalModules] : []),
|
||||
];
|
||||
}
|
||||
|
||||
interface MakeOnWarnForTestingOptions {
|
||||
|
@ -115,7 +118,9 @@ interface MakeOnWarnForTestingOptions {
|
|||
* Construct a warning handler for the shared rollup configuration
|
||||
* that ignores certain warnings that are not relevant to testing.
|
||||
*/
|
||||
export function makeOnWarnForTesting(opts: MakeOnWarnForTestingOptions = {}): (warning: RollupWarning, warn: WarningHandlerWithDefault) => void {
|
||||
export function makeOnWarnForTesting(
|
||||
opts: MakeOnWarnForTestingOptions = {}
|
||||
): (warning: RollupWarning, warn: WarningHandlerWithDefault) => void {
|
||||
const warningInhibitors = createWarningInhibitors(opts);
|
||||
return (warning, warn) => {
|
||||
if (!warningInhibitors.some((inhibited) => inhibited(warning))) {
|
||||
|
|
|
@ -40,7 +40,9 @@ export async function customize(originalDir: string, customDir: string, outDir:
|
|||
return;
|
||||
}
|
||||
|
||||
_originalFolderName = originalDir.replace(commonPrefix(originalDir, customDir), "").replace(/\\/g, "/") ?? _originalFolderName;
|
||||
_originalFolderName =
|
||||
originalDir.replace(commonPrefix(originalDir, customDir), "").replace(/\\/g, "/") ??
|
||||
_originalFolderName;
|
||||
|
||||
// Bring files only present in custom into the output
|
||||
copyFilesInCustom(originalDir, customDir, outDir);
|
||||
|
@ -295,9 +297,9 @@ function isSelfImport(module: string, file: SourceFile): boolean {
|
|||
projectPath = projectPath.getParent() as Directory;
|
||||
}
|
||||
// e.g: ./sources/generated/src
|
||||
const relativeOriginal = originalDir.replace(/\\/g, '/').replace(projectPath.getPath(), ".");
|
||||
const relativeOriginal = originalDir.replace(/\\/g, "/").replace(projectPath.getPath(), ".");
|
||||
// e.g: ./sources/customizations
|
||||
const relativeCustom = customDir.replace(/\\/g, '/').replace(projectPath.getPath(), ".");
|
||||
const relativeCustom = customDir.replace(/\\/g, "/").replace(projectPath.getPath(), ".");
|
||||
// e.g: ./sources/
|
||||
const prefix = commonPrefix(relativeOriginal, relativeCustom);
|
||||
// e.g generated/src
|
||||
|
@ -310,7 +312,7 @@ function isSelfImport(module: string, file: SourceFile): boolean {
|
|||
return false;
|
||||
}
|
||||
const moduleRelative = module.substring(index + originalSuffix.length);
|
||||
const sanitizedPath = file.getFilePath().replace(/\\/g, '/').replace(/\.ts$/, ".js");
|
||||
const sanitizedPath = file.getFilePath().replace(/\\/g, "/").replace(/\.ts$/, ".js");
|
||||
if (sanitizedPath.endsWith(moduleRelative)) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -187,7 +187,10 @@ export function createAssetsJson(project: ProjectInfo): Promise<void> {
|
|||
const execPromise = promisify(exec);
|
||||
|
||||
async function getRecordingsDirectory(project: ProjectInfo): Promise<string> {
|
||||
const { stdout } = await execPromise(`${await getTestProxyExecutable()} config locate -a assets.json`, { cwd: project.path });
|
||||
const { stdout } = await execPromise(
|
||||
`${await getTestProxyExecutable()} config locate -a assets.json`,
|
||||
{ cwd: project.path }
|
||||
);
|
||||
const lines = stdout.split("\n");
|
||||
|
||||
// the directory is the second-to-last line of output (there's some other log output that comes out from the test proxy first, and the last line is empty)
|
||||
|
@ -200,7 +203,11 @@ export async function linkRecordingsDirectory() {
|
|||
const recordingsDirectory = await getRecordingsDirectory(project);
|
||||
const projectRelativeToRoot = path.relative(root, project.path);
|
||||
|
||||
const trueRecordingsDirectory = path.join(recordingsDirectory, projectRelativeToRoot, 'recordings/');
|
||||
const trueRecordingsDirectory = path.join(
|
||||
recordingsDirectory,
|
||||
projectRelativeToRoot,
|
||||
"recordings/"
|
||||
);
|
||||
const relativeRecordingsDirectory = path.relative(project.path, trueRecordingsDirectory);
|
||||
|
||||
const symlinkLocation = path.join(project.path, "_recordings");
|
||||
|
@ -210,7 +217,9 @@ export async function linkRecordingsDirectory() {
|
|||
if (stat.isSymbolicLink()) {
|
||||
await fs.unlink(symlinkLocation);
|
||||
} else {
|
||||
log.warn("Could not create symbolic link to recordings directory: a file exists at _recordings already.");
|
||||
log.warn(
|
||||
"Could not create symbolic link to recordings directory: a file exists at _recordings already."
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -272,7 +281,8 @@ export async function isProxyToolActive(): Promise<boolean> {
|
|||
await axios.get(`http://localhost:${process.env.TEST_PROXY_HTTP_PORT ?? 5000}/info/available`);
|
||||
|
||||
log.info(
|
||||
`Proxy tool seems to be active at http://localhost:${process.env.TEST_PROXY_HTTP_PORT ?? 5000
|
||||
`Proxy tool seems to be active at http://localhost:${
|
||||
process.env.TEST_PROXY_HTTP_PORT ?? 5000
|
||||
}\n`
|
||||
);
|
||||
return true;
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
{
|
||||
"extends": "../../../config/rush-project.json",
|
||||
"extends": "../../../config/rush-project.json"
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"declarationDir": "./types/latest",
|
||||
"outDir": "./dist-esm",
|
||||
"outDir": "./dist-esm"
|
||||
},
|
||||
"compileOnSave": true,
|
||||
"exclude": ["node_modules"],
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
"clean": "rimraf dist dist-* temp types *.tgz *.log",
|
||||
"execute:samples": "echo skipped",
|
||||
"extract-api": "tsc -p . && api-extractor run --local",
|
||||
"format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
|
||||
"format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
|
||||
"integration-test:browser": "echo skipped",
|
||||
"integration-test:node": "echo skipped",
|
||||
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
|
||||
|
|
|
@ -66,7 +66,11 @@ describe("DevCenter Dev Boxes Operations Test", () => {
|
|||
|
||||
assert.equal(devBoxCreateResponse.status, "201", "Dev Box creation should return 201 Created.");
|
||||
|
||||
const devBoxCreatePoller = getLongRunningPoller(client, devBoxCreateResponse, testPollingOptions);
|
||||
const devBoxCreatePoller = getLongRunningPoller(
|
||||
client,
|
||||
devBoxCreateResponse,
|
||||
testPollingOptions
|
||||
);
|
||||
const devBoxCreateResult = await devBoxCreatePoller.pollUntilDone();
|
||||
|
||||
if (isUnexpected(devBoxCreateResult)) {
|
||||
|
@ -97,7 +101,11 @@ describe("DevCenter Dev Boxes Operations Test", () => {
|
|||
|
||||
assert.equal(devBoxDeleteResponse.status, "202", "Delete Dev Box should return 202 Accepted.");
|
||||
|
||||
const devBoxDeletePoller = getLongRunningPoller(client, devBoxDeleteResponse, testPollingOptions);
|
||||
const devBoxDeletePoller = getLongRunningPoller(
|
||||
client,
|
||||
devBoxDeleteResponse,
|
||||
testPollingOptions
|
||||
);
|
||||
const devBoxDeleteResult = await devBoxDeletePoller.pollUntilDone();
|
||||
|
||||
if (isUnexpected(devBoxDeleteResult)) {
|
||||
|
|
|
@ -79,7 +79,11 @@ describe("DevCenter Environments Operations Test", () => {
|
|||
"Environment creation should return 201 created."
|
||||
);
|
||||
|
||||
const environmentCreatePoller = getLongRunningPoller(client, environmentCreateResponse, testPollingOptions);
|
||||
const environmentCreatePoller = getLongRunningPoller(
|
||||
client,
|
||||
environmentCreateResponse,
|
||||
testPollingOptions
|
||||
);
|
||||
const environmentCreateResult = await environmentCreatePoller.pollUntilDone();
|
||||
|
||||
if (isUnexpected(environmentCreateResult)) {
|
||||
|
@ -119,7 +123,11 @@ describe("DevCenter Environments Operations Test", () => {
|
|||
"Environment delete should return 202 accepted."
|
||||
);
|
||||
|
||||
const environmentDeletePoller = getLongRunningPoller(client, environmentDeleteResponse, testPollingOptions);
|
||||
const environmentDeletePoller = getLongRunningPoller(
|
||||
client,
|
||||
environmentDeleteResponse,
|
||||
testPollingOptions
|
||||
);
|
||||
const environmentDeleteResult = await environmentDeletePoller.pollUntilDone();
|
||||
|
||||
if (isUnexpected(environmentDeleteResult)) {
|
||||
|
|
|
@ -21,7 +21,7 @@ interface ReceiverOptions {
|
|||
* Useful when relevant code is updated
|
||||
* Introduced when prefetch feature was added to Event Hubs
|
||||
*/
|
||||
"log-median-batch-size": boolean
|
||||
"log-median-batch-size": boolean;
|
||||
}
|
||||
|
||||
const connectionString = getEnvVar("EVENTHUB_CONNECTION_STRING");
|
||||
|
@ -67,9 +67,10 @@ export class SubscribeTest extends EventPerfTest<ReceiverOptions> {
|
|||
},
|
||||
"log-median-batch-size": {
|
||||
required: false,
|
||||
description: "Logs more information related to the batch size, such as median, max, average, etc",
|
||||
description:
|
||||
"Logs more information related to the batch size, such as median, max, average, etc",
|
||||
defaultValue: false,
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
constructor() {
|
||||
|
@ -121,9 +122,17 @@ export class SubscribeTest extends EventPerfTest<ReceiverOptions> {
|
|||
await consumer.close();
|
||||
// The following might just be noise if we don't think there are related changes to the code
|
||||
if (this.parsedOptions["log-median-batch-size"].value) {
|
||||
console.log(`\tBatch count: ${this.callbackCallsCount}, Batch count per sec: ${this.callbackCallsCount / this.parsedOptions.duration.value}`);
|
||||
console.log(
|
||||
`\tBatch count: ${this.callbackCallsCount}, Batch count per sec: ${
|
||||
this.callbackCallsCount / this.parsedOptions.duration.value
|
||||
}`
|
||||
);
|
||||
console.log(`\tmessagesPerBatch: ${this.messagesPerBatch}`);
|
||||
console.log(`\tmessagesPerBatch... median: ${median(this.messagesPerBatch)}, avg: ${this.messagesPerBatch.reduce((a, b) => a + b, 0) / this.messagesPerBatch.length}, max: ${Math.max(...this.messagesPerBatch)}, min: ${Math.min(...this.messagesPerBatch)}`);
|
||||
console.log(
|
||||
`\tmessagesPerBatch... median: ${median(this.messagesPerBatch)}, avg: ${
|
||||
this.messagesPerBatch.reduce((a, b) => a + b, 0) / this.messagesPerBatch.length
|
||||
}, max: ${Math.max(...this.messagesPerBatch)}, min: ${Math.min(...this.messagesPerBatch)}`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -171,8 +180,7 @@ function median(values: number[]) {
|
|||
|
||||
const half = Math.floor(values.length / 2);
|
||||
|
||||
if (values.length % 2)
|
||||
return values[half];
|
||||
if (values.length % 2) return values[half];
|
||||
|
||||
return (values[half - 1] + values[half]) / 2.0;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,11 @@ describe("analysis (browser)", () => {
|
|||
const urlParts = testingContainerUrl.split("?");
|
||||
const url = `${urlParts[0]}/contoso-allinone.jpg?${urlParts[1]}`;
|
||||
|
||||
const poller = await client.beginAnalyzeDocumentFromUrl("prebuilt-receipt", url, testPollingOptions);
|
||||
const poller = await client.beginAnalyzeDocumentFromUrl(
|
||||
"prebuilt-receipt",
|
||||
url,
|
||||
testPollingOptions
|
||||
);
|
||||
const { documents: receipts } = await poller.pollUntilDone();
|
||||
|
||||
assert.ok(
|
||||
|
|
|
@ -7,11 +7,7 @@ export abstract class SecretTest<TOptions = Record<string, unknown>> extends Per
|
|||
|
||||
constructor() {
|
||||
super();
|
||||
this.secretClient = new SecretClient(
|
||||
keyVaultUri,
|
||||
credential,
|
||||
this.configureClientOptions({})
|
||||
);
|
||||
this.secretClient = new SecretClient(keyVaultUri, credential, this.configureClientOptions({}));
|
||||
}
|
||||
|
||||
async deleteAndPurgeSecrets(...names: string[]) {
|
||||
|
|
|
@ -38,10 +38,11 @@ export async function main() {
|
|||
};
|
||||
|
||||
const result = await logsQueryClient.queryResource(
|
||||
logsResourceId,
|
||||
logsResourceId,
|
||||
kustoQuery,
|
||||
{ duration: Durations.sevenDays },
|
||||
queryLogsOptions);
|
||||
queryLogsOptions
|
||||
);
|
||||
|
||||
const executionTime =
|
||||
result.statistics && result.statistics.query && (result.statistics.query as any).executionTime;
|
||||
|
|
|
@ -7,7 +7,7 @@ import { useAzureMonitor, AzureMonitorOpenTelemetryOptions } from "@azure/monito
|
|||
import * as dotenv from "dotenv";
|
||||
dotenv.config();
|
||||
|
||||
export abstract class MonitorOpenTelemetryTest<TOptions> extends PerfTest<TOptions> {
|
||||
export abstract class MonitorOpenTelemetryTest<TOptions> extends PerfTest<TOptions> {
|
||||
constructor() {
|
||||
super();
|
||||
const options: AzureMonitorOpenTelemetryOptions = {
|
||||
|
|
|
@ -24,7 +24,7 @@ export class SpanExportTest extends MonitorOpenTelemetryTest<MonitorOpenTelemetr
|
|||
function doWork(parent: Span, tracer: Tracer) {
|
||||
const ctx = trace.setSpan(context.active(), parent);
|
||||
const span = tracer.startSpan("doWork", undefined, ctx);
|
||||
for (let i = 0; i <= 1; i += 1) {
|
||||
for (let i = 0; i <= 1; i += 1) {
|
||||
continue;
|
||||
}
|
||||
span.setAttribute("key", "value");
|
||||
|
|
|
@ -32,10 +32,7 @@ export class LockRenewer {
|
|||
* A map of link names to individual maps for each
|
||||
* link that map a message ID to its auto-renewal timer.
|
||||
*/
|
||||
private _messageRenewLockTimers = new Map<
|
||||
string,
|
||||
Map<string, NodeJS.Timeout | undefined>
|
||||
>();
|
||||
private _messageRenewLockTimers = new Map<string, Map<string, NodeJS.Timeout | undefined>>();
|
||||
|
||||
// just here for make unit testing a bit easier.
|
||||
private _calculateRenewAfterDuration: typeof calculateRenewAfterDuration;
|
||||
|
|
Загрузка…
Ссылка в новой задаче