@@ -4,17 +4,10 @@ const common = require('../common'); |
4 | 4 | const assert = require('assert'); |
5 | 5 | const { spawn } = require('child_process'); |
6 | 6 | const path = require('path'); |
| 7 | +const { suite, test } = require('node:test'); |
7 | 8 | const testName = path.join(__dirname, 'test-http-max-http-headers.js'); |
8 | 9 |
|
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) { |
18 | 11 | console.log('running subtest expecting failure'); |
19 | 12 |
|
20 | 13 | // Validate that the test fails if the max header size is too small. |
@@ -30,7 +23,7 @@ test(function(cb) { |
30 | 23 | })); |
31 | 24 | }); |
32 | 25 |
|
33 | | -test(function(cb) { |
| 26 | +test(function(_, cb) { |
34 | 27 | console.log('running subtest expecting success'); |
35 | 28 |
|
36 | 29 | const env = Object.assign({}, process.env, { |
@@ -54,13 +47,13 @@ test(function(cb) { |
54 | 47 | })); |
55 | 48 | }); |
56 | 49 |
|
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 }, () => { |
59 | 52 | const env = Object.assign({}, process.env, { |
60 | 53 | NODE_OPTIONS: '--max-http-header-size=1024' |
61 | 54 | }); |
62 | 55 |
|
63 | | - test(function(cb) { |
| 56 | + test(function(_, cb) { |
64 | 57 | console.log('running subtest expecting failure'); |
65 | 58 |
|
66 | 59 | // 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) { |
74 | 67 | })); |
75 | 68 | }); |
76 | 69 |
|
77 | | - test(function(cb) { |
| 70 | + test(function(_, cb) { |
78 | 71 | // Validate that the test now passes if the same limit is large enough. |
79 | 72 | const args = ['--expose-internals', testName, '1024']; |
80 | 73 | const cp = spawn(process.execPath, args, { env, stdio: 'inherit' }); |
@@ -85,18 +78,4 @@ if (!process.config.variables.node_without_node_options) { |
85 | 78 | cb(); |
86 | 79 | })); |
87 | 80 | }); |
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 | +}); |