Skip to content

Commit 5bd9567

Browse files
committed
f
1 parent 8e3551c commit 5bd9567

10 files changed

Lines changed: 19 additions & 10 deletions

File tree

src/app/extend/context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
utils, Context as EggCoreContext, Router,
55
} from '@eggjs/core';
66
import type { Cookies as ContextCookies } from '@eggjs/cookies';
7-
import { EggLogger } from 'egg-logger';
7+
import type { EggLogger } from 'egg-logger';
88
import type { Application } from '../../lib/application.js';
99
import type {
1010
HttpClientRequestURL, HttpClientRequestOptions, HttpClient,

src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import Helper from './app/extend/helper.js';
99
// export extends
1010
export {
1111
Helper,
12+
};
13+
export type {
1214
// keep compatible with egg v3
1315
Helper as IHelper,
1416
};
@@ -24,6 +26,7 @@ export * from './lib/error/index.js';
2426
// export loggers
2527
export type {
2628
LoggerLevel,
29+
EggLogger,
2730
} from 'egg-logger';
2831

2932
// export httpClients

src/lib/agent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { EggLogger } from 'egg-logger';
1+
import type { EggLogger } from 'egg-logger';
22
import { EggApplicationCore, EggApplicationCoreOptions } from './egg.js';
33
import { AgentWorkerLoader } from './loader/index.js';
44

src/lib/core/httpclient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class HttpClient extends RawHttpClient {
4444
}
4545

4646
// keep compatible
47-
export {
47+
export type {
4848
HttpClient as EggHttpClient,
4949
HttpClient as EggContextHttpClient,
5050
};

src/lib/egg.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ export type MiddlewareFunc<T extends Context = Context> = EggCoreMiddlewareFunc<
8080
export {
8181
Context,
8282
Router,
83-
EggLogger,
8483
};
8584

8685
/**
@@ -664,8 +663,8 @@ export class EggApplicationCore extends EggCore {
664663
* @param {Res} res - node native Response object
665664
* @return {Context} context object
666665
*/
667-
createContext(req: IncomingMessage, res: ServerResponse): EggContext {
668-
const context = Object.create(this.context) as EggContext;
666+
createContext(req: IncomingMessage, res: ServerResponse): Context {
667+
const context = Object.create(this.context) as Context;
669668
const request = context.request = Object.create(this.request);
670669
const response = context.response = Object.create(this.response);
671670
context.app = request.app = response.app = this as any;

test/app/middleware/meta.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describe('test/app/middleware/meta.test.ts', () => {
1818
it('should get X-Readtime header', () => {
1919
return app.httpRequest()
2020
.get('/')
21-
.expect('X-Readtime', /\d+/)
21+
.expect('X-Readtime', /^\d+\.\d{1,3}$/)
2222
.expect(200);
2323
});
2424
});

test/index.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ describe('test/index.test.ts', () => {
1313
'ClusterAgentWorkerError',
1414
'ClusterWorkerExceptionError',
1515
'Context',
16+
'ContextHttpClient',
1617
'Controller',
1718
'CookieLimitExceedError',
1819
'EggApplicationCore',
19-
'EggLogger',
2020
'Helper',
21+
'HttpClient',
2122
'Master',
2223
'MessageUnhandledRejectionError',
2324
'Request',

test/lib/cluster/master.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('test/lib/cluster/master.test.ts', () => {
2525
}
2626

2727
// wait for app worker restart
28-
await scheduler.wait(5000);
28+
await scheduler.wait(10000);
2929

3030
// error pipe to console
3131
app.expect('stdout', /app_worker#1:\d+ disconnect/);
@@ -43,7 +43,7 @@ describe('test/lib/cluster/master.test.ts', () => {
4343
}
4444

4545
// wait for app worker restart
46-
await scheduler.wait(5000);
46+
await scheduler.wait(10000);
4747

4848
app.expect('stderr', /\[graceful:worker:\d+:uncaughtException] throw error 1 times/);
4949
app.expect('stdout', /app_worker#\d:\d+ started/);

test/lib/egg.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,8 @@ describe('test/lib/egg.test.ts', () => {
452452
});
453453

454454
describe('egg-ready', () => {
455+
if (process.platform === 'win32') return;
456+
455457
let app: MockApplication;
456458

457459
before(() => {
@@ -472,6 +474,8 @@ describe('test/lib/egg.test.ts', () => {
472474
});
473475

474476
describe('createAnonymousContext()', () => {
477+
if (process.platform === 'win32') return;
478+
475479
let app: MockApplication;
476480
before(() => {
477481
app = createApp('apps/demo');

test/lib/plugins/depd.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { mm } from '@eggjs/mock';
33
import { MockApplication, createApp } from '../../utils.js';
44

55
describe('test/lib/plugins/depd.test.ts', () => {
6+
if (process.platform === 'win32') return;
7+
68
afterEach(mm.restore);
79

810
let app: MockApplication;

0 commit comments

Comments
 (0)