Fix perf test scripts (#14460)
This commit is contained in:
1 parent
8865ade202
commit
9bfebb4062
3 files changed
+8
-9
No files matched your search
+2
-2
@@ -161,8 +161,8 @@
|
||||
"test:dist": "cross-env NODE_ENV=production yarn test",
|
||||
"test:dist-standalone": "cross-env TEST_STANDALONE=1 yarn test:dist",
|
||||
"test:dist-lint": "eslint --no-eslintrc --no-ignore --no-inline-config --config=./scripts/bundle-eslint-config.cjs \"dist/**/*.{js,cjs,mjs}\"",
|
||||
"perf": "yarn && yarn build && cross-env NODE_ENV=production node ./dist/bin-prettier.js",
|
||||
"perf:inspect": "yarn && yarn build && cross-env NODE_ENV=production node --inspect-brk ./dist/bin-prettier.js",
|
||||
"perf": "yarn && yarn build && cross-env NODE_ENV=production node ./dist/bin/prettier.cjs",
|
||||
"perf:inspect": "yarn && yarn build && cross-env NODE_ENV=production node --inspect-brk ./dist/bin/prettier.cjs",
|
||||
"perf:benchmark": "yarn perf --debug-benchmark",
|
||||
"perf:compare": "./scripts/benchmark/compare.sh",
|
||||
"lint": "run-p \"lint:*\"",
|
||||
|
||||
+5
-6
@@ -204,11 +204,9 @@ async function format(context, input, opt) {
|
||||
JSON.stringify(result, null, 2)
|
||||
);
|
||||
} else if (performanceTestFlag?.debugRepeat) {
|
||||
const repeat = context.argv.debugRepeat;
|
||||
const repeat = performanceTestFlag.debugRepeat;
|
||||
context.logger.debug(
|
||||
"'--debug-repeat' option found, running formatWithCursor " +
|
||||
repeat +
|
||||
" times."
|
||||
`'${performanceTestFlag.name}' found, running formatWithCursor ${repeat} times.`
|
||||
);
|
||||
let totalMs = 0;
|
||||
for (let i = 0; i < repeat; ++i) {
|
||||
@@ -224,8 +222,9 @@ async function format(context, input, opt) {
|
||||
ms: averageMs,
|
||||
};
|
||||
context.logger.debug(
|
||||
"'--debug-repeat' measurements for formatWithCursor: " +
|
||||
JSON.stringify(results, null, 2)
|
||||
`'${
|
||||
performanceTestFlag.name
|
||||
}' measurements for formatWithCursor: ${JSON.stringify(results, null, 2)}`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ describe("should not write file or print code when `--debug-benchmark` or `--deb
|
||||
const assertStderr = (message) => {
|
||||
expect(
|
||||
message.includes(
|
||||
"'--debug-repeat' option found, running formatWithCursor 2 times"
|
||||
"'--debug-repeat' found, running formatWithCursor 2 times"
|
||||
)
|
||||
).toBe(true);
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user