Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b9cd789

Browse filesBrowse files
cjihrigRafaelGSS
authored andcommitted
test: update test-set-http-max-http-headers to use node:test
This commit updates test/parallel/test-set-http-max-http-headers.js to use node:test. This test already implemented a test runner, so it makes sense to use the existing public API. PR-URL: #56439 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 3143566 commit b9cd789
Copy full SHA for b9cd789

File tree

Expand file treeCollapse file tree

1 file changed

+8
-29
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-29
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-set-http-max-http-headers.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-set-http-max-http-headers.js
+8-29Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,10 @@ const common = require('../common');
44
const assert = require('assert');
55
const { spawn } = require('child_process');
66
const path = require('path');
7+
const { suite, test } = require('node:test');
78
const testName = path.join(__dirname, 'test-http-max-http-headers.js');
89

9-
const timeout = common.platformTimeout(100);
10-
11-
const tests = [];
12-
13-
function test(fn) {
14-
tests.push(fn);
15-
}
16-
17-
test(function(cb) {
10+
test(function(_, cb) {
1811
console.log('running subtest expecting failure');
1912

2013
// Validate that the test fails if the max header size is too small.
@@ -30,7 +23,7 @@ test(function(cb) {
3023
}));
3124
});
3225

33-
test(function(cb) {
26+
test(function(_, cb) {
3427
console.log('running subtest expecting success');
3528

3629
const env = Object.assign({}, process.env, {
@@ -54,13 +47,13 @@ test(function(cb) {
5447
}));
5548
});
5649

57-
// Next, repeat the same checks using NODE_OPTIONS if it is supported.
58-
if (!process.config.variables.node_without_node_options) {
50+
const skip = process.config.variables.node_without_node_options;
51+
suite('same checks using NODE_OPTIONS if it is supported', { skip }, () => {
5952
const env = Object.assign({}, process.env, {
6053
NODE_OPTIONS: '--max-http-header-size=1024'
6154
});
6255

63-
test(function(cb) {
56+
test(function(_, cb) {
6457
console.log('running subtest expecting failure');
6558

6659
// Validate that the test fails if the max header size is too small.
@@ -74,7 +67,7 @@ if (!process.config.variables.node_without_node_options) {
7467
}));
7568
});
7669

77-
test(function(cb) {
70+
test(function(_, cb) {
7871
// Validate that the test now passes if the same limit is large enough.
7972
const args = ['--expose-internals', testName, '1024'];
8073
const cp = spawn(process.execPath, args, { env, stdio: 'inherit' });
@@ -85,18 +78,4 @@ if (!process.config.variables.node_without_node_options) {
8578
cb();
8679
}));
8780
});
88-
}
89-
90-
function runTest() {
91-
const fn = tests.shift();
92-
93-
if (!fn) {
94-
return;
95-
}
96-
97-
fn(() => {
98-
setTimeout(runTest, timeout);
99-
});
100-
}
101-
102-
runTest();
81+
});

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.