koa-classic-server 3.0.0-alpha.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +101 -0
- package/README.md +550 -635
- package/__tests__/benchmark-results-v3.0.0.txt +372 -0
- package/__tests__/benchmark.js +1 -1
- package/__tests__/compression.test.js +17 -3
- package/__tests__/customTest/serversToLoad.util.js +4 -4
- package/__tests__/demo-regex-index.js +4 -4
- package/__tests__/directory-sorting-links.test.js +1 -1
- package/__tests__/dt-unknown.test.js +19 -19
- package/__tests__/ejs.test.js +1 -1
- package/__tests__/hidden-option.test.js +48 -63
- package/__tests__/hideExtension.test.js +70 -13
- package/__tests__/index.test.js +6 -6
- package/__tests__/listing.test.js +437 -0
- package/__tests__/logger.test.js +232 -0
- package/__tests__/range.test.js +2 -2
- package/__tests__/security-headers.test.js +20 -8
- package/__tests__/security.test.js +5 -5
- package/__tests__/server-cache.test.js +178 -7
- package/__tests__/symlink.test.js +10 -10
- package/__tests__/template-timeout.test.js +321 -0
- package/docs/CHANGELOG.md +209 -4
- package/docs/CODE_REVIEW.md +2 -0
- package/docs/DOCUMENTATION.md +259 -32
- package/docs/EXAMPLES_INDEX_OPTION.md +1 -1
- package/docs/FLOW_DIAGRAM.md +2 -0
- package/docs/INDEX_OPTION_PRIORITY.md +2 -2
- package/docs/OPTIMIZATION_HTTP_CACHING.md +2 -0
- package/docs/security_improvement_for_V3.md +421 -0
- package/docs/template-engine/TEMPLATE_ENGINE_GUIDE.md +5 -5
- package/docs/template-engine/esempi-incrementali.js +1 -1
- package/index.cjs +551 -178
- package/package.json +6 -1
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
|
|
2
|
+
> koa-classic-server@3.0.0-alpha.0 test:performance
|
|
3
|
+
> jest __tests__/performance.test.js --runInBand
|
|
4
|
+
|
|
5
|
+
console.warn
|
|
6
|
+
[33m[koa-classic-server] WARNING: hidden.dotFiles.default and/or hidden.dotDirs.default are not explicitly set.
|
|
7
|
+
Since v3.0.0 the defaults are: dotFiles → "hidden", dotDirs → "visible".
|
|
8
|
+
To suppress this warning, add to your configuration:
|
|
9
|
+
hidden: { dotFiles: { default: 'hidden' }, dotDirs: { default: 'visible' } }
|
|
10
|
+
(adjust values to match your desired behaviour)[0m
|
|
11
|
+
|
|
12
|
+
735 | if (dotFilesImplicit || dotDirsImplicit) {
|
|
13
|
+
736 | _hiddenDefaultWarnEmitted = true;
|
|
14
|
+
> 737 | _logger.warn(...warnPayload(_logger,
|
|
15
|
+
| ^
|
|
16
|
+
738 | '[koa-classic-server] WARNING: hidden.dotFiles.default and/or hidden.dotDirs.default are not explicitly set.\n' +
|
|
17
|
+
739 | ' Since v3.0.0 the defaults are: dotFiles → "hidden", dotDirs → "visible".\n' +
|
|
18
|
+
740 | ' To suppress this warning, add to your configuration:\n' +
|
|
19
|
+
|
|
20
|
+
at koaClassicServer (index.cjs:737:21)
|
|
21
|
+
at Object.koaClassicServer (__tests__/performance.test.js:139:17)
|
|
22
|
+
|
|
23
|
+
console.log
|
|
24
|
+
|
|
25
|
+
📊 Small File (1KB) Benchmark:
|
|
26
|
+
|
|
27
|
+
at Object.log (__tests__/performance.test.js:159:21)
|
|
28
|
+
|
|
29
|
+
console.log
|
|
30
|
+
Average: 2.09ms
|
|
31
|
+
|
|
32
|
+
at Object.log (__tests__/performance.test.js:160:21)
|
|
33
|
+
|
|
34
|
+
console.log
|
|
35
|
+
Median: 1.66ms
|
|
36
|
+
|
|
37
|
+
at Object.log (__tests__/performance.test.js:161:21)
|
|
38
|
+
|
|
39
|
+
console.log
|
|
40
|
+
Min: 1.40ms
|
|
41
|
+
|
|
42
|
+
at Object.log (__tests__/performance.test.js:162:21)
|
|
43
|
+
|
|
44
|
+
console.log
|
|
45
|
+
Max: 22.92ms
|
|
46
|
+
|
|
47
|
+
at Object.log (__tests__/performance.test.js:163:21)
|
|
48
|
+
|
|
49
|
+
console.log
|
|
50
|
+
|
|
51
|
+
📊 Medium File (100KB) Benchmark:
|
|
52
|
+
|
|
53
|
+
at Object.log (__tests__/performance.test.js:178:21)
|
|
54
|
+
|
|
55
|
+
console.log
|
|
56
|
+
Average: 2.06ms
|
|
57
|
+
|
|
58
|
+
at Object.log (__tests__/performance.test.js:179:21)
|
|
59
|
+
|
|
60
|
+
console.log
|
|
61
|
+
Median: 1.93ms
|
|
62
|
+
|
|
63
|
+
at Object.log (__tests__/performance.test.js:180:21)
|
|
64
|
+
|
|
65
|
+
console.log
|
|
66
|
+
Min: 1.65ms
|
|
67
|
+
|
|
68
|
+
at Object.log (__tests__/performance.test.js:181:21)
|
|
69
|
+
|
|
70
|
+
console.log
|
|
71
|
+
Max: 4.47ms
|
|
72
|
+
|
|
73
|
+
at Object.log (__tests__/performance.test.js:182:21)
|
|
74
|
+
|
|
75
|
+
console.log
|
|
76
|
+
|
|
77
|
+
📊 Large File (1MB) Benchmark:
|
|
78
|
+
|
|
79
|
+
at Object.log (__tests__/performance.test.js:197:21)
|
|
80
|
+
|
|
81
|
+
console.log
|
|
82
|
+
Average: 7.19ms
|
|
83
|
+
|
|
84
|
+
at Object.log (__tests__/performance.test.js:198:21)
|
|
85
|
+
|
|
86
|
+
console.log
|
|
87
|
+
Median: 5.82ms
|
|
88
|
+
|
|
89
|
+
at Object.log (__tests__/performance.test.js:199:21)
|
|
90
|
+
|
|
91
|
+
console.log
|
|
92
|
+
Min: 4.53ms
|
|
93
|
+
|
|
94
|
+
at Object.log (__tests__/performance.test.js:200:21)
|
|
95
|
+
|
|
96
|
+
console.log
|
|
97
|
+
Max: 21.60ms
|
|
98
|
+
|
|
99
|
+
at Object.log (__tests__/performance.test.js:201:21)
|
|
100
|
+
|
|
101
|
+
console.log
|
|
102
|
+
|
|
103
|
+
📊 Small Directory (100 files) Benchmark:
|
|
104
|
+
|
|
105
|
+
at Object.log (__tests__/performance.test.js:219:21)
|
|
106
|
+
|
|
107
|
+
console.log
|
|
108
|
+
Average: 5.22ms
|
|
109
|
+
|
|
110
|
+
at Object.log (__tests__/performance.test.js:220:21)
|
|
111
|
+
|
|
112
|
+
console.log
|
|
113
|
+
Median: 4.65ms
|
|
114
|
+
|
|
115
|
+
at Object.log (__tests__/performance.test.js:221:21)
|
|
116
|
+
|
|
117
|
+
console.log
|
|
118
|
+
Min: 4.03ms
|
|
119
|
+
|
|
120
|
+
at Object.log (__tests__/performance.test.js:222:21)
|
|
121
|
+
|
|
122
|
+
console.log
|
|
123
|
+
Max: 17.47ms
|
|
124
|
+
|
|
125
|
+
at Object.log (__tests__/performance.test.js:223:21)
|
|
126
|
+
|
|
127
|
+
console.log
|
|
128
|
+
|
|
129
|
+
📊 Large Directory (1,000 files) Benchmark:
|
|
130
|
+
|
|
131
|
+
at Object.log (__tests__/performance.test.js:237:21)
|
|
132
|
+
|
|
133
|
+
console.log
|
|
134
|
+
Average: 28.83ms
|
|
135
|
+
|
|
136
|
+
at Object.log (__tests__/performance.test.js:238:21)
|
|
137
|
+
|
|
138
|
+
console.log
|
|
139
|
+
Median: 28.80ms
|
|
140
|
+
|
|
141
|
+
at Object.log (__tests__/performance.test.js:239:21)
|
|
142
|
+
|
|
143
|
+
console.log
|
|
144
|
+
Min: 26.80ms
|
|
145
|
+
|
|
146
|
+
at Object.log (__tests__/performance.test.js:240:21)
|
|
147
|
+
|
|
148
|
+
console.log
|
|
149
|
+
Max: 31.02ms
|
|
150
|
+
|
|
151
|
+
at Object.log (__tests__/performance.test.js:241:21)
|
|
152
|
+
|
|
153
|
+
console.log
|
|
154
|
+
⚠️ WARNING: This will be MUCH faster after async optimization
|
|
155
|
+
|
|
156
|
+
at Object.log (__tests__/performance.test.js:244:21)
|
|
157
|
+
|
|
158
|
+
console.log
|
|
159
|
+
|
|
160
|
+
📊 Very Large Directory (10,000 files) Benchmark:
|
|
161
|
+
|
|
162
|
+
at Object.log (__tests__/performance.test.js:258:21)
|
|
163
|
+
|
|
164
|
+
console.log
|
|
165
|
+
Average: 265.99ms
|
|
166
|
+
|
|
167
|
+
at Object.log (__tests__/performance.test.js:259:21)
|
|
168
|
+
|
|
169
|
+
console.log
|
|
170
|
+
Median: 266.27ms
|
|
171
|
+
|
|
172
|
+
at Object.log (__tests__/performance.test.js:260:21)
|
|
173
|
+
|
|
174
|
+
console.log
|
|
175
|
+
Min: 261.83ms
|
|
176
|
+
|
|
177
|
+
at Object.log (__tests__/performance.test.js:261:21)
|
|
178
|
+
|
|
179
|
+
console.log
|
|
180
|
+
Max: 271.55ms
|
|
181
|
+
|
|
182
|
+
at Object.log (__tests__/performance.test.js:262:21)
|
|
183
|
+
|
|
184
|
+
console.log
|
|
185
|
+
⚠️ WARNING: Event loop BLOCKED during this operation!
|
|
186
|
+
|
|
187
|
+
at Object.log (__tests__/performance.test.js:263:21)
|
|
188
|
+
|
|
189
|
+
console.log
|
|
190
|
+
⚠️ Expected to drop to ~79.80ms after optimization
|
|
191
|
+
|
|
192
|
+
at Object.log (__tests__/performance.test.js:264:21)
|
|
193
|
+
|
|
194
|
+
console.log
|
|
195
|
+
|
|
196
|
+
📊 10 Concurrent Small Files:
|
|
197
|
+
|
|
198
|
+
at Object.log (__tests__/performance.test.js:281:21)
|
|
199
|
+
|
|
200
|
+
console.log
|
|
201
|
+
Total time: 13.28ms
|
|
202
|
+
|
|
203
|
+
at Object.log (__tests__/performance.test.js:282:21)
|
|
204
|
+
|
|
205
|
+
console.log
|
|
206
|
+
Avg per request: 1.33ms
|
|
207
|
+
|
|
208
|
+
at Object.log (__tests__/performance.test.js:283:21)
|
|
209
|
+
|
|
210
|
+
console.log
|
|
211
|
+
|
|
212
|
+
📊 5 Concurrent Directory Listings (100 files):
|
|
213
|
+
|
|
214
|
+
at Object.log (__tests__/performance.test.js:300:21)
|
|
215
|
+
|
|
216
|
+
console.log
|
|
217
|
+
Total time: 18.73ms
|
|
218
|
+
|
|
219
|
+
at Object.log (__tests__/performance.test.js:301:21)
|
|
220
|
+
|
|
221
|
+
console.log
|
|
222
|
+
Avg per request: 3.75ms
|
|
223
|
+
|
|
224
|
+
at Object.log (__tests__/performance.test.js:302:21)
|
|
225
|
+
|
|
226
|
+
console.log
|
|
227
|
+
⚠️ With current sync code, these run SEQUENTIALLY
|
|
228
|
+
|
|
229
|
+
at Object.log (__tests__/performance.test.js:303:21)
|
|
230
|
+
|
|
231
|
+
console.log
|
|
232
|
+
⚠️ After async optimization, will run in PARALLEL
|
|
233
|
+
|
|
234
|
+
at Object.log (__tests__/performance.test.js:304:21)
|
|
235
|
+
|
|
236
|
+
console.log
|
|
237
|
+
|
|
238
|
+
📊 404 Not Found Benchmark:
|
|
239
|
+
|
|
240
|
+
at Object.log (__tests__/performance.test.js:321:21)
|
|
241
|
+
|
|
242
|
+
console.log
|
|
243
|
+
Average: 1.26ms
|
|
244
|
+
|
|
245
|
+
at Object.log (__tests__/performance.test.js:322:21)
|
|
246
|
+
|
|
247
|
+
console.log
|
|
248
|
+
Median: 1.11ms
|
|
249
|
+
|
|
250
|
+
at Object.log (__tests__/performance.test.js:323:21)
|
|
251
|
+
|
|
252
|
+
console.log
|
|
253
|
+
Min: 0.92ms
|
|
254
|
+
|
|
255
|
+
at Object.log (__tests__/performance.test.js:324:21)
|
|
256
|
+
|
|
257
|
+
console.log
|
|
258
|
+
Max: 3.88ms
|
|
259
|
+
|
|
260
|
+
at Object.log (__tests__/performance.test.js:325:21)
|
|
261
|
+
|
|
262
|
+
console.log
|
|
263
|
+
|
|
264
|
+
📊 Memory Usage (10,000 files directory):
|
|
265
|
+
|
|
266
|
+
at Object.log (__tests__/performance.test.js:347:21)
|
|
267
|
+
|
|
268
|
+
console.log
|
|
269
|
+
Heap used increase: 6.97 MB
|
|
270
|
+
|
|
271
|
+
at Object.log (__tests__/performance.test.js:348:21)
|
|
272
|
+
|
|
273
|
+
console.log
|
|
274
|
+
External increase: 0.25 MB
|
|
275
|
+
|
|
276
|
+
at Object.log (__tests__/performance.test.js:349:21)
|
|
277
|
+
|
|
278
|
+
console.log
|
|
279
|
+
Response size: 0.02 MB
|
|
280
|
+
|
|
281
|
+
at Object.log (__tests__/performance.test.js:350:21)
|
|
282
|
+
|
|
283
|
+
console.log
|
|
284
|
+
⚠️ Expected to reduce by ~30-40% after optimization
|
|
285
|
+
|
|
286
|
+
at Object.log (__tests__/performance.test.js:351:21)
|
|
287
|
+
|
|
288
|
+
console.log
|
|
289
|
+
|
|
290
|
+
======================================================================
|
|
291
|
+
|
|
292
|
+
at Object.log (__tests__/performance.test.js:358:13)
|
|
293
|
+
|
|
294
|
+
console.log
|
|
295
|
+
📋 BASELINE BENCHMARK SUMMARY
|
|
296
|
+
|
|
297
|
+
at Object.log (__tests__/performance.test.js:359:13)
|
|
298
|
+
|
|
299
|
+
console.log
|
|
300
|
+
======================================================================
|
|
301
|
+
|
|
302
|
+
at Object.log (__tests__/performance.test.js:360:13)
|
|
303
|
+
|
|
304
|
+
console.log
|
|
305
|
+
|
|
306
|
+
These results represent the CURRENT performance (v1.2.0)
|
|
307
|
+
|
|
308
|
+
at Object.log (__tests__/performance.test.js:361:13)
|
|
309
|
+
|
|
310
|
+
console.log
|
|
311
|
+
After implementing optimizations, run this test again to see improvements.
|
|
312
|
+
|
|
313
|
+
at Object.log (__tests__/performance.test.js:362:13)
|
|
314
|
+
|
|
315
|
+
console.log
|
|
316
|
+
Expected improvements after optimization:
|
|
317
|
+
|
|
318
|
+
at Object.log (__tests__/performance.test.js:363:13)
|
|
319
|
+
|
|
320
|
+
console.log
|
|
321
|
+
✓ Small files: 10-20% faster (async operations)
|
|
322
|
+
|
|
323
|
+
at Object.log (__tests__/performance.test.js:364:13)
|
|
324
|
+
|
|
325
|
+
console.log
|
|
326
|
+
✓ Large directories: 50-70% faster (async + array join)
|
|
327
|
+
|
|
328
|
+
at Object.log (__tests__/performance.test.js:365:13)
|
|
329
|
+
|
|
330
|
+
console.log
|
|
331
|
+
✓ Concurrent requests: 5-10x faster (non-blocking event loop)
|
|
332
|
+
|
|
333
|
+
at Object.log (__tests__/performance.test.js:366:13)
|
|
334
|
+
|
|
335
|
+
console.log
|
|
336
|
+
✓ Memory usage: 30-40% reduction (array join vs concatenation)
|
|
337
|
+
|
|
338
|
+
at Object.log (__tests__/performance.test.js:367:13)
|
|
339
|
+
|
|
340
|
+
console.log
|
|
341
|
+
✓ With HTTP caching: 80-95% faster (304 responses)
|
|
342
|
+
|
|
343
|
+
at Object.log (__tests__/performance.test.js:368:13)
|
|
344
|
+
|
|
345
|
+
console.log
|
|
346
|
+
======================================================================
|
|
347
|
+
|
|
348
|
+
at Object.log (__tests__/performance.test.js:369:13)
|
|
349
|
+
|
|
350
|
+
PASS __tests__/performance.test.js
|
|
351
|
+
Performance Benchmarks - BASELINE (v1.2.0)
|
|
352
|
+
File Serving Performance
|
|
353
|
+
✓ Benchmark: Small file (1KB) - 100 iterations (215 ms)
|
|
354
|
+
✓ Benchmark: Medium file (100KB) - 50 iterations (107 ms)
|
|
355
|
+
✓ Benchmark: Large file (1MB) - 20 iterations (146 ms)
|
|
356
|
+
Directory Listing Performance
|
|
357
|
+
✓ Benchmark: Small directory (100 files) - 50 iterations (264 ms)
|
|
358
|
+
✓ Benchmark: Large directory (1,000 files) - 20 iterations (579 ms)
|
|
359
|
+
✓ Benchmark: Very large directory (10,000 files) - 5 iterations (1333 ms)
|
|
360
|
+
Concurrent Request Performance
|
|
361
|
+
✓ Benchmark: 10 concurrent small file requests (15 ms)
|
|
362
|
+
✓ Benchmark: 5 concurrent directory listings (100 files each) (21 ms)
|
|
363
|
+
404 Not Found Performance
|
|
364
|
+
✓ Benchmark: Non-existent file - 50 iterations (65 ms)
|
|
365
|
+
Memory Usage (Informational)
|
|
366
|
+
✓ Memory usage during large directory listing (269 ms)
|
|
367
|
+
|
|
368
|
+
Test Suites: 1 passed, 1 total
|
|
369
|
+
Tests: 10 passed, 10 total
|
|
370
|
+
Snapshots: 0 total
|
|
371
|
+
Time: 3.365 s, estimated 5 s
|
|
372
|
+
Ran all test suites matching __tests__/performance.test.js.
|
package/__tests__/benchmark.js
CHANGED
|
@@ -12,7 +12,7 @@ const root = path.join(__dirname, 'compression-fixtures');
|
|
|
12
12
|
|
|
13
13
|
function createApp(opts = {}) {
|
|
14
14
|
const app = new Koa();
|
|
15
|
-
app.use(koaClassicServer(root, {
|
|
15
|
+
app.use(koaClassicServer(root, { dirListing: { enabled: false }, ...opts }));
|
|
16
16
|
return app.listen();
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -100,8 +100,8 @@ describe('Compression — threshold (default 1024 bytes)', () => {
|
|
|
100
100
|
expect(res.headers['content-encoding']).toBe('gzip');
|
|
101
101
|
});
|
|
102
102
|
|
|
103
|
-
test('
|
|
104
|
-
const s = createApp({ compression: {
|
|
103
|
+
test('minFileSize: false → compress regardless of size', async () => {
|
|
104
|
+
const s = createApp({ compression: { minFileSize: false } });
|
|
105
105
|
const res = await supertest(s)
|
|
106
106
|
.get('/small.txt')
|
|
107
107
|
.set('Accept-Encoding', 'gzip');
|
|
@@ -268,3 +268,17 @@ describe('Compression — no compression on Range requests (HTTP 206)', () => {
|
|
|
268
268
|
expect(res.text).toBe('A'.repeat(10));
|
|
269
269
|
});
|
|
270
270
|
});
|
|
271
|
+
|
|
272
|
+
// ─── V3 migration guard ───────────────────────────────────────────────────────
|
|
273
|
+
|
|
274
|
+
describe('Compression — V3 migration guard (old name throws helpful error)', () => {
|
|
275
|
+
test('compression.minSize throws with hint pointing to minFileSize', () => {
|
|
276
|
+
expect(() => koaClassicServer(root, { compression: { minSize: 2048 } }))
|
|
277
|
+
.toThrow(/options\.compression\.minSize was renamed[\s\S]*compression: \{ minFileSize: 2048 \}/);
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
test('compression.minSize === false also throws (legacy "no minimum" sentinel)', () => {
|
|
281
|
+
expect(() => koaClassicServer(root, { compression: { minSize: false } }))
|
|
282
|
+
.toThrow(/options\.compression\.minSize was renamed/);
|
|
283
|
+
});
|
|
284
|
+
});
|
|
@@ -20,7 +20,7 @@ const configurations = [
|
|
|
20
20
|
options: {
|
|
21
21
|
//urlPrefix: '/',
|
|
22
22
|
method: ['GET'],
|
|
23
|
-
|
|
23
|
+
dirListing: { enabled: true },
|
|
24
24
|
},
|
|
25
25
|
},
|
|
26
26
|
{
|
|
@@ -31,7 +31,7 @@ const configurations = [
|
|
|
31
31
|
options: {
|
|
32
32
|
urlPrefix: '/public',
|
|
33
33
|
method: ['GET'],
|
|
34
|
-
|
|
34
|
+
dirListing: { enabled: true },
|
|
35
35
|
index: ['index.html'],
|
|
36
36
|
},
|
|
37
37
|
},
|
|
@@ -43,7 +43,7 @@ const configurations = [
|
|
|
43
43
|
options: {
|
|
44
44
|
urlPrefix: '/public',
|
|
45
45
|
method: ['GET'],
|
|
46
|
-
|
|
46
|
+
dirListing: { enabled: true },
|
|
47
47
|
},
|
|
48
48
|
},
|
|
49
49
|
{
|
|
@@ -54,7 +54,7 @@ const configurations = [
|
|
|
54
54
|
options: {
|
|
55
55
|
urlPrefix: '',
|
|
56
56
|
method: ['GET'],
|
|
57
|
-
|
|
57
|
+
dirListing: { enabled: true },
|
|
58
58
|
urlsReserved : Array('/percorso_riservato', '/percorso riservato con spazi')
|
|
59
59
|
},
|
|
60
60
|
},
|
|
@@ -48,7 +48,7 @@ console.log(' Aspettativa: Matcha INDEX.HTML o Index.Html');
|
|
|
48
48
|
const app1 = new Koa();
|
|
49
49
|
app1.use(koaClassicServer(testDir, {
|
|
50
50
|
index: [/index\.html/i],
|
|
51
|
-
|
|
51
|
+
dirListing: { enabled: true }
|
|
52
52
|
}));
|
|
53
53
|
const server1 = app1.listen(3001);
|
|
54
54
|
console.log(' ✓ Server avviato su http://localhost:3001\n');
|
|
@@ -63,7 +63,7 @@ console.log(' Aspettativa: Matcha INDEX.HTML, Index.Html, index.htm');
|
|
|
63
63
|
const app2 = new Koa();
|
|
64
64
|
app2.use(koaClassicServer(testDir, {
|
|
65
65
|
index: [/index\.(html|htm)/i],
|
|
66
|
-
|
|
66
|
+
dirListing: { enabled: true }
|
|
67
67
|
}));
|
|
68
68
|
const server2 = app2.listen(3002);
|
|
69
69
|
console.log(' ✓ Server avviato su http://localhost:3002\n');
|
|
@@ -81,7 +81,7 @@ app3.use(koaClassicServer(testDir, {
|
|
|
81
81
|
/index\.(html|htm)/i,
|
|
82
82
|
/default\.html/i
|
|
83
83
|
],
|
|
84
|
-
|
|
84
|
+
dirListing: { enabled: true }
|
|
85
85
|
}));
|
|
86
86
|
const server3 = app3.listen(3003);
|
|
87
87
|
console.log(' ✓ Server avviato su http://localhost:3003\n');
|
|
@@ -100,7 +100,7 @@ app4.use(koaClassicServer(testDir, {
|
|
|
100
100
|
/INDEX\.HTML/i, // Case-insensitive fallback
|
|
101
101
|
/default\.html/i // Default fallback
|
|
102
102
|
],
|
|
103
|
-
|
|
103
|
+
dirListing: { enabled: true }
|
|
104
104
|
}));
|
|
105
105
|
const server4 = app4.listen(3004);
|
|
106
106
|
console.log(' ✓ Server avviato su http://localhost:3004\n');
|
|
@@ -97,7 +97,7 @@ describe('DT_UNKNOWN filesystem support (NixOS buildFHSEnv, overlayfs, FUSE)', (
|
|
|
97
97
|
const app = new Koa();
|
|
98
98
|
app.use(koaClassicServer(tmpDir, {
|
|
99
99
|
index: ['index.html'],
|
|
100
|
-
|
|
100
|
+
dirListing: { enabled: true }
|
|
101
101
|
}));
|
|
102
102
|
const server = app.listen();
|
|
103
103
|
const request = supertest(server);
|
|
@@ -120,7 +120,7 @@ describe('DT_UNKNOWN filesystem support (NixOS buildFHSEnv, overlayfs, FUSE)', (
|
|
|
120
120
|
const app = new Koa();
|
|
121
121
|
app.use(koaClassicServer(tmpDir, {
|
|
122
122
|
index: ['subdir'],
|
|
123
|
-
|
|
123
|
+
dirListing: { enabled: true }
|
|
124
124
|
}));
|
|
125
125
|
const server = app.listen();
|
|
126
126
|
const request = supertest(server);
|
|
@@ -143,7 +143,7 @@ describe('DT_UNKNOWN filesystem support (NixOS buildFHSEnv, overlayfs, FUSE)', (
|
|
|
143
143
|
const app = new Koa();
|
|
144
144
|
app.use(koaClassicServer(tmpDir, {
|
|
145
145
|
index: ['nonexistent.html'],
|
|
146
|
-
|
|
146
|
+
dirListing: { enabled: true }
|
|
147
147
|
}));
|
|
148
148
|
const server = app.listen();
|
|
149
149
|
const request = supertest(server);
|
|
@@ -172,7 +172,7 @@ describe('DT_UNKNOWN filesystem support (NixOS buildFHSEnv, overlayfs, FUSE)', (
|
|
|
172
172
|
const app = new Koa();
|
|
173
173
|
app.use(koaClassicServer(tmpDir, {
|
|
174
174
|
index: ['index.html'],
|
|
175
|
-
|
|
175
|
+
dirListing: { enabled: true }
|
|
176
176
|
}));
|
|
177
177
|
const server = app.listen();
|
|
178
178
|
const request = supertest(server);
|
|
@@ -201,7 +201,7 @@ describe('DT_UNKNOWN filesystem support (NixOS buildFHSEnv, overlayfs, FUSE)', (
|
|
|
201
201
|
const app = new Koa();
|
|
202
202
|
app.use(koaClassicServer(tmpDir, {
|
|
203
203
|
index: [/NOMATCH_SENTINEL/],
|
|
204
|
-
|
|
204
|
+
dirListing: { enabled: true }
|
|
205
205
|
}));
|
|
206
206
|
const server = app.listen();
|
|
207
207
|
const request = supertest(server);
|
|
@@ -228,7 +228,7 @@ describe('DT_UNKNOWN filesystem support (NixOS buildFHSEnv, overlayfs, FUSE)', (
|
|
|
228
228
|
const app = new Koa();
|
|
229
229
|
app.use(koaClassicServer(tmpDir, {
|
|
230
230
|
index: ['index.html'],
|
|
231
|
-
|
|
231
|
+
dirListing: { enabled: true }
|
|
232
232
|
}));
|
|
233
233
|
const server = app.listen();
|
|
234
234
|
const request = supertest(server);
|
|
@@ -250,7 +250,7 @@ describe('DT_UNKNOWN filesystem support (NixOS buildFHSEnv, overlayfs, FUSE)', (
|
|
|
250
250
|
const app = new Koa();
|
|
251
251
|
app.use(koaClassicServer(tmpDir, {
|
|
252
252
|
index: ['index.ejs'],
|
|
253
|
-
|
|
253
|
+
dirListing: { enabled: true }
|
|
254
254
|
}));
|
|
255
255
|
const server = app.listen();
|
|
256
256
|
const request = supertest(server);
|
|
@@ -273,7 +273,7 @@ describe('DT_UNKNOWN filesystem support (NixOS buildFHSEnv, overlayfs, FUSE)', (
|
|
|
273
273
|
const app = new Koa();
|
|
274
274
|
app.use(koaClassicServer(tmpDir, {
|
|
275
275
|
index: [/index\.[eE][jJ][sS]/],
|
|
276
|
-
|
|
276
|
+
dirListing: { enabled: true }
|
|
277
277
|
}));
|
|
278
278
|
const server = app.listen();
|
|
279
279
|
const request = supertest(server);
|
|
@@ -301,7 +301,7 @@ describe('DT_UNKNOWN filesystem support (NixOS buildFHSEnv, overlayfs, FUSE)', (
|
|
|
301
301
|
const app = new Koa();
|
|
302
302
|
app.use(koaClassicServer(tmpDir, {
|
|
303
303
|
index: [/NOMATCH_SENTINEL/],
|
|
304
|
-
|
|
304
|
+
dirListing: { enabled: true }
|
|
305
305
|
}));
|
|
306
306
|
const server = app.listen();
|
|
307
307
|
const request = supertest(server);
|
|
@@ -328,7 +328,7 @@ describe('DT_UNKNOWN filesystem support (NixOS buildFHSEnv, overlayfs, FUSE)', (
|
|
|
328
328
|
const app = new Koa();
|
|
329
329
|
app.use(koaClassicServer(tmpDir, {
|
|
330
330
|
index: [],
|
|
331
|
-
|
|
331
|
+
dirListing: { enabled: true }
|
|
332
332
|
}));
|
|
333
333
|
const server = app.listen();
|
|
334
334
|
const request = supertest(server);
|
|
@@ -356,7 +356,7 @@ describe('DT_UNKNOWN filesystem support (NixOS buildFHSEnv, overlayfs, FUSE)', (
|
|
|
356
356
|
const app = new Koa();
|
|
357
357
|
app.use(koaClassicServer(tmpDir, {
|
|
358
358
|
index: [],
|
|
359
|
-
|
|
359
|
+
dirListing: { enabled: true }
|
|
360
360
|
}));
|
|
361
361
|
const server = app.listen();
|
|
362
362
|
const request = supertest(server);
|
|
@@ -386,7 +386,7 @@ describe('DT_UNKNOWN filesystem support (NixOS buildFHSEnv, overlayfs, FUSE)', (
|
|
|
386
386
|
const app = new Koa();
|
|
387
387
|
app.use(koaClassicServer(tmpDir, {
|
|
388
388
|
index: [],
|
|
389
|
-
|
|
389
|
+
dirListing: { enabled: true }
|
|
390
390
|
}));
|
|
391
391
|
const server = app.listen();
|
|
392
392
|
const request = supertest(server);
|
|
@@ -410,7 +410,7 @@ describe('DT_UNKNOWN filesystem support (NixOS buildFHSEnv, overlayfs, FUSE)', (
|
|
|
410
410
|
const app = new Koa();
|
|
411
411
|
app.use(koaClassicServer(tmpDir, {
|
|
412
412
|
index: [],
|
|
413
|
-
|
|
413
|
+
dirListing: { enabled: true }
|
|
414
414
|
}));
|
|
415
415
|
const server = app.listen();
|
|
416
416
|
const request = supertest(server);
|
|
@@ -440,7 +440,7 @@ describe('DT_UNKNOWN filesystem support (NixOS buildFHSEnv, overlayfs, FUSE)', (
|
|
|
440
440
|
const app = new Koa();
|
|
441
441
|
app.use(koaClassicServer(tmpDir, {
|
|
442
442
|
index: ['index.html'],
|
|
443
|
-
|
|
443
|
+
dirListing: { enabled: true }
|
|
444
444
|
}));
|
|
445
445
|
const server = app.listen();
|
|
446
446
|
const request = supertest(server);
|
|
@@ -465,7 +465,7 @@ describe('DT_UNKNOWN filesystem support (NixOS buildFHSEnv, overlayfs, FUSE)', (
|
|
|
465
465
|
const app = new Koa();
|
|
466
466
|
app.use(koaClassicServer(tmpDir, {
|
|
467
467
|
index: [],
|
|
468
|
-
|
|
468
|
+
dirListing: { enabled: true }
|
|
469
469
|
}));
|
|
470
470
|
const server = app.listen();
|
|
471
471
|
const request = supertest(server);
|
|
@@ -486,7 +486,7 @@ describe('DT_UNKNOWN filesystem support (NixOS buildFHSEnv, overlayfs, FUSE)', (
|
|
|
486
486
|
const app = new Koa();
|
|
487
487
|
app.use(koaClassicServer(tmpDir, {
|
|
488
488
|
index: [],
|
|
489
|
-
|
|
489
|
+
dirListing: { enabled: true }
|
|
490
490
|
}));
|
|
491
491
|
const server = app.listen();
|
|
492
492
|
const request = supertest(server);
|
|
@@ -522,7 +522,7 @@ describe('DT_UNKNOWN filesystem support (NixOS buildFHSEnv, overlayfs, FUSE)', (
|
|
|
522
522
|
const app = new Koa();
|
|
523
523
|
app.use(koaClassicServer(tmpDir, {
|
|
524
524
|
index: ['index.ejs'],
|
|
525
|
-
|
|
525
|
+
dirListing: { enabled: true },
|
|
526
526
|
template: {
|
|
527
527
|
ext: ['ejs'],
|
|
528
528
|
render: async (ctx, next, filePath) => {
|
|
@@ -573,7 +573,7 @@ describe('DT_UNKNOWN filesystem support (NixOS buildFHSEnv, overlayfs, FUSE)', (
|
|
|
573
573
|
const app = new Koa();
|
|
574
574
|
app.use(koaClassicServer(tmpDir, {
|
|
575
575
|
index: [],
|
|
576
|
-
|
|
576
|
+
dirListing: { enabled: true }
|
|
577
577
|
}));
|
|
578
578
|
const server = app.listen();
|
|
579
579
|
const request = supertest(server);
|
|
@@ -615,7 +615,7 @@ describe('DT_UNKNOWN filesystem support (NixOS buildFHSEnv, overlayfs, FUSE)', (
|
|
|
615
615
|
const app = new Koa();
|
|
616
616
|
app.use(koaClassicServer(tmpDir, {
|
|
617
617
|
index: ['index.html', 'index.ejs'],
|
|
618
|
-
|
|
618
|
+
dirListing: { enabled: true }
|
|
619
619
|
}));
|
|
620
620
|
const server = app.listen();
|
|
621
621
|
const request = supertest(server);
|
package/__tests__/ejs.test.js
CHANGED