Skip to content

Commit 9870b3f

Browse files
style: stop hiding test/benchmark from Prettier
The unanchored `benchmark/` entry matches any directory of that name, so test/benchmark and test/harness/benchmark were exempt from fmt:check and could not be re-included. Anchor it to the root and format what surfaced.
1 parent c6cc5fd commit 9870b3f

12 files changed

Lines changed: 49 additions & 37 deletions

File tree

‎.prettierignore‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,15 @@ test/**/*.*
1818
!test/helpers/*.*
1919
!test/harness/**/*.*
2020
!test/benchmarkCases/**/*.mjs
21+
!test/benchmark/**/*.mjs
22+
!test/benchmark/**/*.md
2123
test/js/**/*.*
2224
test/test262-cases/**/*.*
2325
test/wpt/**
2426

2527
# Ignore some folders
26-
benchmark/
28+
# anchored: an unanchored `benchmark/` also swallows test/benchmark/
29+
/benchmark/
2730
coverage/
2831

2932
# Ignore generated files

‎test/benchmark/e2e/filesystem-cache/index.bench.mjs‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ const cacheConfigs = (outputPath, benchName, mode, compression) => {
3030
idleTimeoutForInitialStore: 0
3131
}
3232
});
33-
const fileCache =
34-
/** @type {import("../../../..").FileCacheOptions} */ (write.cache);
33+
const fileCache = /** @type {import("../../../..").FileCacheOptions} */ (
34+
write.cache
35+
);
3536
return {
3637
write,
3738
read: {

‎test/benchmark/helpers/sources.mjs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export function generateCssSource(rules, asModule = false) {
111111
}
112112
declarations.push(
113113
`\tcolor: ${CSS_COLORS[i % CSS_COLORS.length]};`,
114-
"\tbackground: url(\"data:image/gif;base64,R0lGODlhAQABAAAAACw=\") no-repeat;",
114+
'\tbackground: url("data:image/gif;base64,R0lGODlhAQABAAAAACw=") no-repeat;',
115115
"\tmax-width: calc(100% - var(--spacing) * 2);"
116116
);
117117
parts.push(`${selector} {\n${declarations.join("\n")}\n}`);
@@ -131,11 +131,11 @@ export function generateCssSource(rules, asModule = false) {
131131
export function generateHtmlSource(sections) {
132132
const parts = [
133133
"<!DOCTYPE html>",
134-
"<html lang=\"en\">",
134+
'<html lang="en">',
135135
"<head>",
136-
"<meta charset=\"utf-8\">",
136+
'<meta charset="utf-8">',
137137
"<title>Benchmark fixture</title>",
138-
"<link rel=\"stylesheet\" href=\"./styles.css\">",
138+
'<link rel="stylesheet" href="./styles.css">',
139139
"</head>",
140140
"<body>"
141141
];
@@ -156,6 +156,6 @@ export function generateHtmlSource(sections) {
156156
"</section>"
157157
);
158158
}
159-
parts.push("<script>console.log(\"end\");</script>", "</body>", "</html>");
159+
parts.push('<script>console.log("end");</script>', "</body>", "</html>");
160160
return parts.join("\n");
161161
}

‎test/benchmark/lib/cli.mjs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ const [shardIndex, shardCount] = toShard(
4343
);
4444

4545
// Warn about noisy wall-time results.
46-
const maxRme = Number.parseFloat(values["max-rme"] ?? process.env.MAX_RME ?? "15");
46+
const maxRme = Number.parseFloat(
47+
values["max-rme"] ?? process.env.MAX_RME ?? "15"
48+
);
4749

4850
/** @type {string[]} */
4951
const found = [];

‎test/benchmark/lib/runner.mjs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ export async function runSuites(files, options) {
150150

151151
for (const file of files) {
152152
/** @type {Suite} */
153-
const suite = await import(pathToFileURL(file).toString()).then(x => x.default ?? x);
153+
const suite = await import(pathToFileURL(file).toString()).then(
154+
(x) => x.default ?? x
155+
);
154156
const benches = suite.benches.filter((bench) => {
155157
const id = `${suite.name}/${bench.name}`;
156158
if (options.filter && !options.filter.test(id)) return false;
@@ -187,9 +189,7 @@ export async function runSuites(files, options) {
187189
});
188190
} catch (err) {
189191
failures.push({ id, error: /** @type {Error} */ (err) });
190-
console.error(
191-
` ✖ ${id}: ${/** @type {Error} */ (err).stack}`
192-
);
192+
console.error(` ✖ ${id}: ${/** @type {Error} */ (err).stack}`);
193193
}
194194
await drainHeap();
195195
}

‎test/benchmark/lib/webpack.mjs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,16 +317,16 @@ export function createBuildScenarios(options) {
317317
return [
318318
createBuildBench({
319319
case: caseName,
320-
config: () => ({ ...resolveConfig(config), mode: "development" }),
320+
config: () => ({ ...resolveConfig(config), mode: "development" })
321321
}),
322322
createBuildBench({
323323
case: caseName,
324-
config: () => ({ ...resolveConfig(config), mode: "production" }),
324+
config: () => ({ ...resolveConfig(config), mode: "production" })
325325
}),
326326
createWatchRebuildBench({
327327
case: caseName,
328328
entryFile,
329-
config: () => ({ ...resolveConfig(config), mode: "development" }),
329+
config: () => ({ ...resolveConfig(config), mode: "development" })
330330
})
331331
];
332332
}

‎test/benchmark/unit/loaders/LoaderRunner.bench.mjs‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ export default {
7575
{
7676
name: "run 1000 three-loader pipelines",
7777
fn() {
78-
return runPipelines([identityLoader, simpleLoader, identityLoader], 1000);
78+
return runPipelines(
79+
[identityLoader, simpleLoader, identityLoader],
80+
1000
81+
);
7982
}
8083
},
8184
{

‎test/benchmark/unit/serialization/BinaryMiddleware.bench.mjs‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,8 @@ export default {
9090
{
9191
name: "serialize 60000 numeric values",
9292
fn() {
93-
sink =
94-
/** @type {Buffer[]} */ (middleware.serialize(numericData, {}))
95-
.length;
93+
sink = /** @type {Buffer[]} */ (middleware.serialize(numericData, {}))
94+
.length;
9695
}
9796
},
9897
{
@@ -116,8 +115,8 @@ export default {
116115
{
117116
name: "serialize 10000 mixed values",
118117
fn() {
119-
sink =
120-
/** @type {Buffer[]} */ (middleware.serialize(mixedData, {})).length;
118+
sink = /** @type {Buffer[]} */ (middleware.serialize(mixedData, {}))
119+
.length;
121120
}
122121
},
123122
{

‎test/benchmark/unit/util/comparators.bench.mjs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ export default {
3434
setup() {
3535
strings = Array.from(
3636
{ length: 10_000 },
37-
(_, i) =>
38-
`node_modules/package-${i % 200}/chunk-${i % 80}/module-${i}.js`
37+
(_, i) => `node_modules/package-${i % 200}/chunk-${i % 80}/module-${i}.js`
3938
);
4039
ids = Array.from({ length: 10_000 }, (_, i) =>
4140
i % 5 === 0 ? `chunk-${i}` : i

‎test/benchmark/unit/util/createMappings.bench.mjs‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ export default {
3636
]
3737
: first;
3838
});
39-
values = Array.from(
40-
{ length: 10_000 },
41-
(_, i) => (i % 2 === 0 ? i * 7919 : i * -3571)
39+
values = Array.from({ length: 10_000 }, (_, i) =>
40+
i % 2 === 0 ? i * 7919 : i * -3571
4241
);
4342
},
4443
teardown() {

0 commit comments

Comments
 (0)