Skip to content

Commit 537dfe5

Browse files
Reflexclaude
andcommitted
style(h2-transport): apply prettier formatting
Fixes lint CI: prettier wants multi-line argv arrays for the execFileSync openssl calls. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent f960de8 commit 537dfe5

11 files changed

Lines changed: 102 additions & 24 deletions

File tree

loadtest/h2-chaos.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,21 @@ function makeCerts() {
1919
const cert = path.join(tmp, 'cert.pem');
2020
execFileSync(
2121
'openssl',
22-
['req', '-x509', '-newkey', 'rsa:2048', '-keyout', key, '-out', cert,
23-
'-days', '1', '-nodes', '-subj', '/CN=localhost'],
22+
[
23+
'req',
24+
'-x509',
25+
'-newkey',
26+
'rsa:2048',
27+
'-keyout',
28+
key,
29+
'-out',
30+
cert,
31+
'-days',
32+
'1',
33+
'-nodes',
34+
'-subj',
35+
'/CN=localhost',
36+
],
2437
{ stdio: ['ignore', 'ignore', 'ignore'] },
2538
);
2639
return { key: fs.readFileSync(key), cert: fs.readFileSync(cert), tmp };

loadtest/h2-leak.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,21 @@ function makeCerts() {
1919
const cert = path.join(tmp, 'cert.pem');
2020
execFileSync(
2121
'openssl',
22-
['req', '-x509', '-newkey', 'rsa:2048', '-keyout', key, '-out', cert,
23-
'-days', '1', '-nodes', '-subj', '/CN=localhost'],
22+
[
23+
'req',
24+
'-x509',
25+
'-newkey',
26+
'rsa:2048',
27+
'-keyout',
28+
key,
29+
'-out',
30+
cert,
31+
'-days',
32+
'1',
33+
'-nodes',
34+
'-subj',
35+
'/CN=localhost',
36+
],
2437
{ stdio: ['ignore', 'ignore', 'ignore'] },
2538
);
2639
return { key: fs.readFileSync(key), cert: fs.readFileSync(cert), tmp };

loadtest/h2-multiplex-server.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,21 @@ const keyPath = path.join(tmp, 'key.pem');
1313
const certPath = path.join(tmp, 'cert.pem');
1414
execFileSync(
1515
'openssl',
16-
['req', '-x509', '-newkey', 'rsa:2048', '-keyout', keyPath, '-out', certPath,
17-
'-days', '1', '-nodes', '-subj', '/CN=localhost'],
16+
[
17+
'req',
18+
'-x509',
19+
'-newkey',
20+
'rsa:2048',
21+
'-keyout',
22+
keyPath,
23+
'-out',
24+
certPath,
25+
'-days',
26+
'1',
27+
'-nodes',
28+
'-subj',
29+
'/CN=localhost',
30+
],
1831
{ stdio: ['ignore', 'ignore', 'ignore'] },
1932
);
2033
const payload = Buffer.from(JSON.stringify({ ok: true, data: 'x'.repeat(1000) }));

loadtest/h2-multiplex.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,21 @@ function makeCerts() {
2222
const cert = path.join(tmp, 'cert.pem');
2323
execFileSync(
2424
'openssl',
25-
['req', '-x509', '-newkey', 'rsa:2048', '-keyout', key, '-out', cert,
26-
'-days', '1', '-nodes', '-subj', '/CN=localhost'],
25+
[
26+
'req',
27+
'-x509',
28+
'-newkey',
29+
'rsa:2048',
30+
'-keyout',
31+
key,
32+
'-out',
33+
cert,
34+
'-days',
35+
'1',
36+
'-nodes',
37+
'-subj',
38+
'/CN=localhost',
39+
],
2740
{ stdio: ['ignore', 'ignore', 'ignore'] },
2841
);
2942
return { key: fs.readFileSync(key), cert: fs.readFileSync(cert), tmp };

loadtest/h2-pool-growth.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,21 @@ function makeCerts() {
2626
const cert = path.join(tmp, 'cert.pem');
2727
execFileSync(
2828
'openssl',
29-
['req', '-x509', '-newkey', 'rsa:2048', '-keyout', key, '-out', cert,
30-
'-days', '1', '-nodes', '-subj', '/CN=localhost'],
29+
[
30+
'req',
31+
'-x509',
32+
'-newkey',
33+
'rsa:2048',
34+
'-keyout',
35+
key,
36+
'-out',
37+
cert,
38+
'-days',
39+
'1',
40+
'-nodes',
41+
'-subj',
42+
'/CN=localhost',
43+
],
3144
{ stdio: ['ignore', 'ignore', 'ignore'] },
3245
);
3346
return { key: fs.readFileSync(key), cert: fs.readFileSync(cert), tmp };

tests/lib/h2-transport/helpers/certs.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,19 @@ export function ensureCerts(): { key: Buffer; cert: Buffer } {
2121
execFileSync(
2222
'openssl',
2323
[
24-
'req', '-x509', '-newkey', 'rsa:2048',
25-
'-keyout', keyPath, '-out', certPath,
26-
'-days', '1', '-nodes',
27-
'-subj', '/CN=localhost',
24+
'req',
25+
'-x509',
26+
'-newkey',
27+
'rsa:2048',
28+
'-keyout',
29+
keyPath,
30+
'-out',
31+
certPath,
32+
'-days',
33+
'1',
34+
'-nodes',
35+
'-subj',
36+
'/CN=localhost',
2837
],
2938
{ stdio: ['ignore', 'ignore', 'ignore'] },
3039
);

tests/lib/h2-transport/helpers/testServer.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ import http2 from 'node:http2';
22
import net from 'node:net';
33
import { ensureCerts } from './certs';
44

5-
export type StreamHandler = (
6-
stream: http2.ServerHttp2Stream,
7-
headers: http2.IncomingHttpHeaders,
8-
) => void;
5+
export type StreamHandler = (stream: http2.ServerHttp2Stream, headers: http2.IncomingHttpHeaders) => void;
96

107
export interface TestServer {
118
port: number;

tests/lib/h2-transport/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe('createH2Fetch', () => {
3030
const fetch = createH2Fetch({ tlsOptions: testTls });
3131
const r = (await fetch(`${server.origin}/headers`, {
3232
method: 'GET',
33-
headers: { 'X-Mixed-Case': 'yes', 'Accept': 'application/json' },
33+
headers: { 'X-Mixed-Case': 'yes', Accept: 'application/json' },
3434
})) as any;
3535
const echoed = await r.json();
3636
expect(echoed['x-mixed-case']).toBe('yes');

tests/lib/h2-transport/pool.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,7 @@ describe('H2Pool', () => {
7171
tlsOptions: testTls,
7272
});
7373
await pool.request('/warm', 'GET', {}, null);
74-
await Promise.all(
75-
Array.from({ length: 9 }, (_, i) => pool.request(`/grow/${i}`, 'GET', {}, null)),
76-
);
74+
await Promise.all(Array.from({ length: 9 }, (_, i) => pool.request(`/grow/${i}`, 'GET', {}, null)));
7775
expect((pool as any)._sessions.length).toBeGreaterThan(1);
7876
expect((pool as any)._sessions.length).toBeLessThanOrEqual(3);
7977
await pool.close();

tests/lib/h2-transport/response.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ function makeResponse(data: string | Buffer, status = 200, contentType = 'applic
1010
controller.close();
1111
},
1212
});
13-
return new H2Response(status, new H2Headers({ 'content-type': contentType }), body, 'https://test/path?q=1');
13+
return new H2Response(
14+
status,
15+
new H2Headers({ 'content-type': contentType }),
16+
body,
17+
'https://test/path?q=1',
18+
);
1419
}
1520

1621
describe('H2Response', () => {

0 commit comments

Comments
 (0)