Skip to content

Commit

Permalink
fix: should export Application (#6)
Browse files Browse the repository at this point in the history
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Refactor**
- Updated import and export declarations for the `Application` class to
improve code clarity and maintainability.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
fengmk2 committed Jun 11, 2024
1 parent ddf04bf commit b39a51a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export type { ContextDelegation as Context } from './context.js';
* Expose `Application` class.
* Inherits from `Emitter.prototype`.
*/
export default class Application extends Emitter {
export class Application extends Emitter {
/**
* Make HttpError available to consumers of the library so that consumers don't
* have a direct dependency upon `http-errors`
Expand Down Expand Up @@ -274,3 +274,5 @@ export default class Application extends Emitter {
res.end(body);
}
}

export default Application;
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Application from './application.js';
import { Application } from './application.js';

export default Application;

Expand Down
6 changes: 3 additions & 3 deletions test/application/context.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import assert from 'node:assert';
import request from 'supertest';
import Koa from '../../src/index.js';
import { Application } from '../../src/index.js';

describe('app.context', () => {
const app1 = new Koa();
const app1 = new Application();
app1.context.msg = 'hello app1';
const app2 = new Koa();
const app2 = new Application();
app2.request.foo = 'bar';

it('should the context between apps is isolated', () => {
Expand Down

0 comments on commit b39a51a

Please sign in to comment.