Skip to content

Commit f22ed85

Browse files
committed
f
1 parent 1a1aa76 commit f22ed85

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/onerror.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import fs from 'node:fs';
22
import path from 'node:path';
3+
import { fileURLToPath } from 'node:url';
34
import { strict as assert } from 'node:assert';
45
import { mm, MockApplication } from '@eggjs/mock';
56
import { Context } from '@eggjs/core';
67

8+
const __filename = fileURLToPath(import.meta.url);
9+
const __dirname = path.dirname(__filename);
10+
711
describe('test/onerror.test.ts', () => {
812
let app: MockApplication;
913
before(() => {
@@ -292,7 +296,7 @@ describe('test/onerror.test.ts', () => {
292296
await app.httpRequest()
293297
.post('/body_parser')
294298
.set('Content-Type', 'application/x-www-form-urlencoded')
295-
.send({ foo: new Buffer(1024 * 1000).fill(1).toString() })
299+
.send({ foo: Buffer.alloc(1024 * 1000).fill(1).toString() })
296300
.expect(/request entity too large/)
297301
.expect(413);
298302
await app.close();

0 commit comments

Comments
 (0)