Skip to content

Commit bb28433

Browse files
authored
Upgrade prettier dev-dependency to v2.5.1 in test-utils (Azure#19720)
Upgraded prettier dev-dependency version to latest 2.5.1. Files were re-formatted as well. There are only format changes in this PR, no manual changes except for package.json files. Main format changes with Prettier 2.x in this PR include: Trailing commas by default. Whitespace added after every function keyword.
1 parent c06170f commit bb28433

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+580
-579
lines changed

common/config/rush/pnpm-lock.yaml

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/test-utils/perf/karma.conf.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
process.env.CHROME_BIN = require("puppeteer").executablePath();
33
require("dotenv").config({ path: "../.env" });
44

5-
module.exports = function(config) {
5+
module.exports = function (config) {
66
config.set({
77
// base path that will be used to resolve all patterns (eg. files, exclude)
88
basePath: "./",
@@ -16,7 +16,7 @@ module.exports = function(config) {
1616
// list of files / patterns to load in the browser
1717
files: [
1818
"dist-test/index.browser.js",
19-
{ pattern: "dist-test/index.browser.js.map", type: "html", included: false, served: true }
19+
{ pattern: "dist-test/index.browser.js.map", type: "html", included: false, served: true },
2020
],
2121

2222
// list of files / patterns to exclude
@@ -25,7 +25,7 @@ module.exports = function(config) {
2525
// preprocess matching files before serving them to the browser
2626
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
2727
preprocessors: {
28-
"**/*.js": ["sourcemap", "env"]
28+
"**/*.js": ["sourcemap", "env"],
2929
// IMPORTANT: COMMENT following line if you want to debug in your browsers!!
3030
// Preprocess source file to calculate code coverage, however this will make source file unreadable
3131
//"dist-test/index.browser.js": ["coverage"]
@@ -58,8 +58,8 @@ module.exports = function(config) {
5858
customLaunchers: {
5959
ChromeHeadlessNoSandbox: {
6060
base: "ChromeHeadless",
61-
flags: ["--no-sandbox", "--disable-web-security"]
62-
}
61+
flags: ["--no-sandbox", "--disable-web-security"],
62+
},
6363
},
6464

6565
// Continuous Integration mode
@@ -76,6 +76,6 @@ module.exports = function(config) {
7676
browserConsoleLogOptions: {
7777
// We would usually hide the logs from the tests, but we don't need to do this inside of the recorder package because we are not recording the tests.
7878
// // terminal: process.env.TEST_MODE !== "record"
79-
}
79+
},
8080
});
8181
};

sdk/test-utils/perf/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"karma-chrome-launcher": "^3.0.0",
7878
"karma-coverage": "^2.0.0",
7979
"karma-env-preprocessor": "^0.1.1",
80-
"prettier": "^1.16.4",
80+
"prettier": "^2.5.1",
8181
"rimraf": "^3.0.0",
8282
"typescript": "~4.2.0",
8383
"ts-node": "^8.3.0"

sdk/test-utils/perf/src/batchPerfTest.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { AbortSignalLike, AbortController } from "@azure/abort-controller";
55
import {
66
TestProxyHttpClient,
77
TestProxyHttpClientV1,
8-
testProxyHttpPolicy
8+
testProxyHttpPolicy,
99
} from "./testProxyHttpClient";
1010
import { HttpClient } from "@azure/core-http";
1111
import { Pipeline } from "@azure/core-rest-pipeline";
@@ -15,9 +15,9 @@ import { PerfParallel } from "./parallel";
1515
/**
1616
* Enables writing perf tests where the number of operations are dynamic for the method/call being tested.
1717
*/
18-
export abstract class BatchPerfTest<TOptions = Record<string, unknown>> extends PerfTestBase<
19-
TOptions
20-
> {
18+
export abstract class BatchPerfTest<
19+
TOptions = Record<string, unknown>
20+
> extends PerfTestBase<TOptions> {
2121
private readonly testProxy!: string;
2222
public testProxyHttpClient!: TestProxyHttpClient;
2323
public testProxyHttpClientV1!: TestProxyHttpClientV1;

sdk/test-utils/perf/src/options.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -85,51 +85,51 @@ export interface DefaultPerfOptions {
8585
export const defaultPerfOptions: PerfOptionDictionary<DefaultPerfOptions> = {
8686
help: {
8787
description: "Shows all of the available options",
88-
shortName: "h"
88+
shortName: "h",
8989
},
9090
parallel: {
9191
description: "How many of the same test to call at the same time",
9292
shortName: "p",
93-
defaultValue: 1
93+
defaultValue: 1,
9494
},
9595
duration: {
9696
description: "When to stop calling tests at all",
9797
shortName: "d",
98-
defaultValue: 10
98+
defaultValue: 10,
9999
},
100100
warmup: {
101101
description: "Duration of warmup in seconds",
102102
shortName: "w",
103-
defaultValue: 5
103+
defaultValue: 5,
104104
},
105105
iterations: {
106106
description: "Times to repeat the whole process, after warmup",
107107
shortName: "i",
108-
defaultValue: 1
108+
defaultValue: 1,
109109
},
110110
"no-cleanup": {
111-
description: "Disables test cleanup"
111+
description: "Disables test cleanup",
112112
},
113113
"test-proxies": {
114114
description: "URIs of TestProxy servers (separated by ';')",
115-
defaultValue: undefined
115+
defaultValue: undefined,
116116
},
117117
insecure: {
118118
description:
119119
"Applied when test-proxies option is defined, connects with https(insecurely by disabling SSL validation)",
120120
shortName: "ins",
121-
defaultValue: false
121+
defaultValue: false,
122122
},
123123
"milliseconds-to-log": {
124124
description: "Log frequency in milliseconds",
125125
shortName: "mtl",
126-
defaultValue: 1000
126+
defaultValue: 1000,
127127
},
128128
"list-transitive-dependencies": {
129129
description: "List all dependencies, instead of only direct ones, before test run",
130130
shortName: "ltd",
131-
defaultValue: false
132-
}
131+
defaultValue: false,
132+
},
133133
};
134134

135135
/**
@@ -173,7 +173,7 @@ export function parsePerfOption<TOptions>(
173173
result[optionName as keyof TOptions] = {
174174
...option,
175175
longName,
176-
value
176+
value,
177177
};
178178
}
179179

@@ -211,7 +211,7 @@ export function validateOptions<TOptions>(options: PerfOptionDictionary<TOptions
211211
function getBooleanOptionDetails<TOptions>(options: PerfOptionDictionary<TOptions>) {
212212
const booleanProps: { boolean: string[]; default: { [key: string]: boolean } } = {
213213
boolean: [],
214-
default: {}
214+
default: {},
215215
};
216216

217217
for (const key in options) {

sdk/test-utils/perf/src/perfTestBase.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
DefaultPerfOptions,
99
defaultPerfOptions,
1010
validateOptions,
11-
ParsedPerfOptions
11+
ParsedPerfOptions,
1212
} from "./options";
1313
import { PerfParallel } from "./parallel";
1414
import { AbortController } from "@azure/abort-controller";
@@ -40,7 +40,7 @@ export abstract class PerfTestBase<TOptions = Record<string, unknown>> {
4040
if (this.options) {
4141
validateOptions({
4242
...this.options,
43-
...defaultPerfOptions
43+
...defaultPerfOptions,
4444
});
4545
}
4646

@@ -54,7 +54,7 @@ export abstract class PerfTestBase<TOptions = Record<string, unknown>> {
5454
// ```
5555
return parsePerfOption({
5656
...this.options,
57-
...defaultPerfOptions
57+
...defaultPerfOptions,
5858
} as PerfOptionDictionary<TOptions & DefaultPerfOptions>);
5959
}
6060

sdk/test-utils/perf/src/policy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
RequestPolicy,
44
RequestPolicyOptions,
55
WebResource,
6-
HttpOperationResponse
6+
HttpOperationResponse,
77
} from "@azure/core-http";
88
import * as url from "url";
99

sdk/test-utils/perf/src/program.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
PerfOptionDictionary,
88
parsePerfOption,
99
defaultPerfOptions,
10-
DefaultPerfOptions
10+
DefaultPerfOptions,
1111
} from "./options";
1212
import { PerfParallel } from "./parallel";
1313
import { exec } from "child_process";
@@ -103,19 +103,19 @@ export class PerfProgram {
103103
const weightedAverage = totalOperations / operationsPerSecond;
104104
console.log(
105105
`Completed ${totalOperations.toLocaleString(undefined, {
106-
maximumFractionDigits: 0
106+
maximumFractionDigits: 0,
107107
})} ` +
108108
`operations in a weighted-average of ` +
109109
`${weightedAverage.toLocaleString(undefined, {
110110
maximumFractionDigits: 2,
111-
minimumFractionDigits: 2
111+
minimumFractionDigits: 2,
112112
})}s ` +
113113
`(${operationsPerSecond.toLocaleString(undefined, {
114-
maximumFractionDigits: 2
114+
maximumFractionDigits: 2,
115115
})} ops/s, ` +
116116
`${secondsPerOperation.toLocaleString(undefined, {
117117
maximumFractionDigits: 3,
118-
minimumFractionDigits: 3
118+
minimumFractionDigits: 3,
119119
})} s/op)`
120120
);
121121
}
@@ -141,8 +141,9 @@ export class PerfProgram {
141141
// of operations running.
142142
const millisecondsToLog = Number(this.parsedDefaultOptions["milliseconds-to-log"].value);
143143
console.log(
144-
`\n=== ${title} mode, iteration ${iterationIndex + 1}. Logs every ${millisecondsToLog /
145-
1000}s ===`
144+
`\n=== ${title} mode, iteration ${iterationIndex + 1}. Logs every ${
145+
millisecondsToLog / 1000
146+
}s ===`
146147
);
147148
console.log(`ElapsedTime\tCurrent\t\tTotal\t\tAverage`);
148149
let lastCompleted = 0;
@@ -177,7 +178,7 @@ export class PerfProgram {
177178
this.tests.map((test, i = 0) => {
178179
parallels[i] = {
179180
completedOperations: 0,
180-
lastMillisecondsElapsed: 0
181+
lastMillisecondsElapsed: 0,
181182
};
182183
return test.runAll(parallels[i], durationMilliseconds, abortController);
183184
})

0 commit comments

Comments
 (0)