Skip to content

Commit

Permalink
升级测试库
Browse files Browse the repository at this point in the history
升级 mocha 和 lerna ,不影响本体功能
  • Loading branch information
bruce48x committed Mar 2, 2024
1 parent 64e9beb commit bc869fb
Show file tree
Hide file tree
Showing 28 changed files with 2,473 additions and 2,198 deletions.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"lerna": "3.19.0",
"lerna": "6.6.2",
"packages": [
"packages/pinus",
"packages/pinus-admin",
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
"name": "pinus-workspaces",
"version": "0.0.1",
"devDependencies": {
"lerna": "4.0.0",
"lerna-relinker": "1.5.0",
"lerna": "6.6.2",
"nyc": "15.1.0",
"pinus-site-tools": "1.0.6",
"ts-node": "9.1.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/pinus-admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
"devDependencies": {
"@types/node": "^12.20.41",
"mocha": "6.2.2",
"mocha": "10.3.0",
"should": "13.2.3",
"tslint": "6.1.3",
"typescript": "^4.3.5"
Expand Down
2 changes: 1 addition & 1 deletion packages/pinus-loader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"devDependencies": {
"@types/node": "^12.20.41",
"mocha": "6.2.2",
"mocha": "10.3.0",
"should": "13.2.3",
"tslint": "6.1.3",
"typescript": "^4.3.5"
Expand Down
2 changes: 1 addition & 1 deletion packages/pinus-logger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"devDependencies": {
"@types/node": "^12.20.41",
"mocha": "6.2.2",
"mocha": "10.3.0",
"should": "13.2.3",
"tslint": "6.1.3",
"typescript": "^4.3.5"
Expand Down
2 changes: 1 addition & 1 deletion packages/pinus-protobuf/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"devDependencies": {
"@types/node": "^12.20.41",
"mocha": "6.2.2",
"mocha": "10.3.0",
"should": "13.2.3",
"tslint": "6.1.3",
"typescript": "^4.3.5"
Expand Down
2 changes: 1 addition & 1 deletion packages/pinus-protocol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"devDependencies": {
"@types/node": "^12.20.41",
"jscoverage": "0.6.0",
"mocha": "6.2.2",
"mocha": "10.3.0",
"should": "13.2.3",
"tslint": "6.1.3",
"typescript": "^4.3.5"
Expand Down
2 changes: 1 addition & 1 deletion packages/pinus-rpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@types/node": "^12.20.41",
"@types/uuid": "^9.0.0",
"@types/ws": "^8.5.4",
"mocha": "6.2.2",
"mocha": "10.3.0",
"should": "13.2.3",
"tslint": "6.1.3",
"typescript": "^4.3.5"
Expand Down
3 changes: 1 addition & 2 deletions packages/pinus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@
"@types/mocha": "^5.0.0",
"@types/node": "^12.20.41",
"@types/ws": "8.5.4",
"mocha": "6.2.2",
"muk": "0.5.3",
"mocha": "10.3.0",
"nyc": "15.1.0",
"should": "13.2.3",
"tslint": "6.1.3",
Expand Down
10 changes: 5 additions & 5 deletions packages/pinus/test/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('application test', function () {
});

describe('#compoent', function () {
it('should load the component and fire their lifecircle callback by app.start, app.afterStart, app.stop', function (done: MochaDone) {
it('should load the component and fire their lifecircle callback by app.start, app.afterStart, app.stop', function (done: Mocha.Done) {
let startCount = 0, afterStartCount = 0, stopCount = 0;
if(require('os').platform() === 'linux') {
done();
Expand Down Expand Up @@ -425,7 +425,7 @@ describe('application test', function () {
});

describe('#add and remove servers', function () {
it('should add servers and emit event and fetch the new server info by get methods', function (done: MochaDone) {
it('should add servers and emit event and fetch the new server info by get methods', function (done: Mocha.Done) {
let newServers = [
{ id: 'connector-server-1', serverType: 'connecctor', host: '127.0.0.1', port: 1234, clientPort: 3000, frontend: true },
{ id: 'area-server-1', serverType: 'area', host: '127.0.0.1', port: 2234 }
Expand Down Expand Up @@ -480,7 +480,7 @@ describe('application test', function () {
app.event.removeAllListeners()
});

it('should remove server info and emit event', function (done: MochaDone) {
it('should remove server info and emit event', function (done: Mocha.Done) {
let newServers = [
{ id: 'connector-server-1', serverType: 'connecctor', host: '127.0.0.1', port: 1234, clientPort: 3000, frontend: true },
{ id: 'area-server-1', serverType: 'area', host: '127.0.0.1', port: 2234 },
Expand Down Expand Up @@ -553,7 +553,7 @@ describe('application test', function () {
});

describe('#beforeStopHook', function () {
it('should be called before application stopped.', function (done: MochaDone) {
it('should be called before application stopped.', function (done: Mocha.Done) {
if(require('os').platform() === 'linux') {
done();
return;
Expand Down Expand Up @@ -582,7 +582,7 @@ describe('application test', function () {
});
});
describe('#use', function () {
it('should exist plugin component and event', function (done: MochaDone) {
it('should exist plugin component and event', function (done: Mocha.Done) {
let plugin = {
name: 'mock-plugin',
components: [MockPlugin],
Expand Down
4 changes: 2 additions & 2 deletions packages/pinus/test/filters/handler/serial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ let mockSession: { key: string, __serialTask__?: any } = {

let WAIT_TIME = 100;
describe('#serialFilter', function () {
it('should do before filter ok', function (done: MochaDone) {
it('should do before filter ok', function (done: Mocha.Done) {
let service = new FilterService();
let filter = new serialFilter();
service.before(filter);
Expand All @@ -23,7 +23,7 @@ describe('#serialFilter', function () {
});
});

it('should do after filter by doing before filter ok', function (done: MochaDone) {
it('should do after filter by doing before filter ok', function (done: Mocha.Done) {
let service = new FilterService();
let filter = new serialFilter();
let _session: { key: string, __serialTask__?: any };
Expand Down
4 changes: 2 additions & 2 deletions packages/pinus/test/filters/handler/time.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let mockSession: { key: string, __startTime__?: any } = {

let WAIT_TIME = 100;
describe('#timeFilter', function () {
it('should do before filter ok', function (done: MochaDone) {
it('should do before filter ok', function (done: Mocha.Done) {
let service = new FilterService();
let filter = new serialFilter();
service.before(filter);
Expand All @@ -23,7 +23,7 @@ describe('#timeFilter', function () {
});
});

it('should do after filter by doing before filter ok', function (done: MochaDone) {
it('should do after filter by doing before filter ok', function (done: Mocha.Done) {
let service = new FilterService();
let filter = new serialFilter();
let _session: { key: string, __startTime__?: any };
Expand Down
4 changes: 2 additions & 2 deletions packages/pinus/test/filters/handler/timeout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let mockSession: { key: string, __timeout__?: any } = {

let WAIT_TIME = 100;
describe('#timeoutFilter', function () {
it('should do before filter ok', function (done: MochaDone) {
it('should do before filter ok', function (done: Mocha.Done) {
let service = new FilterService();
let filter = new timeoutFilter();
service.before(filter);
Expand All @@ -22,7 +22,7 @@ describe('#timeoutFilter', function () {
});
});

it('should do after filter by doing before filter ok', function (done: MochaDone) {
it('should do after filter by doing before filter ok', function (done: Mocha.Done) {
let service = new FilterService();
let filter = new timeoutFilter();
let _session: { key: string, __timeout__?: any };
Expand Down
4 changes: 2 additions & 2 deletions packages/pinus/test/filters/handler/toobusy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let mockSession = {
};

describe('#toobusyFilter', function () {
it('should do before filter ok', function (done: MochaDone) {
it('should do before filter ok', function (done: Mocha.Done) {
let service = new FilterService();
let filter = new toobusyFilter();
service.before(filter);
Expand All @@ -20,7 +20,7 @@ describe('#toobusyFilter', function () {
});
});

it('should do before filter error because of too busy', function (done: MochaDone) {
it('should do before filter error because of too busy', function (done: Mocha.Done) {
let service = new FilterService();
let filter = new toobusyFilter(3);
service.before(filter);
Expand Down
2 changes: 1 addition & 1 deletion packages/pinus/test/filters/rpc/rpcLog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let mockData = {
};

describe('#rpcLogFilter', function () {
it('should do after filter by before filter', function (done: MochaDone) {
it('should do after filter by before filter', function (done: Mocha.Done) {
rpcLogFilter.before(mockData.serverId, mockData.msg, mockData.opts, function () {
rpcLogFilter.after(mockData.serverId, mockData.msg, mockData.opts, function (serverId: number, msg: string, opts: any) {
should.exist((mockData.opts as any)['__start_time__']);
Expand Down
2 changes: 1 addition & 1 deletion packages/pinus/test/filters/rpc/toobusy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ let mockData = {


describe('#toobusyFilter', function () {
it('should no callback for toobusy', function (done: MochaDone) {
it('should no callback for toobusy', function (done: Mocha.Done) {
try {
require('toobusy');
} catch (e) {
Expand Down
6 changes: 3 additions & 3 deletions packages/pinus/test/manager/taskManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ taskManager.timeout = 100;
let WAIT_TIME = 200;

describe('#taskManager', function () {
it('should add task and execute it', function (done: MochaDone) {
it('should add task and execute it', function (done: Mocha.Done) {
let key = 'key-1';
let fn = function (task: any) {
taskCount++;
Expand All @@ -27,7 +27,7 @@ describe('#taskManager', function () {
}, WAIT_TIME);
});

it('should fire timeout callback if task timeout', function (done: MochaDone) {
it('should fire timeout callback if task timeout', function (done: Mocha.Done) {
let key = 'key-1';
let fn = function (task: any) {
taskCount++;
Expand All @@ -47,7 +47,7 @@ describe('#taskManager', function () {
}, WAIT_TIME);
});

it('should not fire timeout after close the task', function (done: MochaDone) {
it('should not fire timeout after close the task', function (done: Mocha.Done) {
let key = 'key-1';
let fn = function (task: any) {
taskCount++;
Expand Down
4 changes: 2 additions & 2 deletions packages/pinus/test/modules/console.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ describe('console module test', function () {
}
};
let module = new consoleModule(opts);
it('should execute kill command', function (done: MochaDone) {
it('should execute kill command', function (done: Mocha.Done) {
if (done) {
done()
return
Expand Down Expand Up @@ -170,7 +170,7 @@ describe('console module test', function () {
});
});

it('should execute stop command', function (done: MochaDone) {
it('should execute stop command', function (done: Mocha.Done) {
this.timeout(5555)
let msg1 = { signal: 'stop', ids: ['chat-server-1'] };
let msg2 = { signal: 'stop', ids: <any>[] };
Expand Down
2 changes: 1 addition & 1 deletion packages/pinus/test/pomelo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ let mockBase = process.cwd() + '/test';

describe('pinus', function () {
describe('#createApp', function () {
it('should create and get app, be the same instance', function (done: MochaDone) {
it('should create and get app, be the same instance', function (done: Mocha.Done) {
let app = pinus.createApp({ base: mockBase });
should.exist(app);

Expand Down
6 changes: 3 additions & 3 deletions packages/pinus/test/remote/channelRemote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let WAIT_TIME = 200;

describe('channel remote test', function () {
describe('#pushMessage', function () {
it('should push message the the specified clients', function (done: MochaDone) {
it('should push message the the specified clients', function (done: Mocha.Done) {
this.timeout(5555)
let sids = [1, 2, 3, 4, 5, 6];
let uids = [11, 12, 13];
Expand Down Expand Up @@ -79,7 +79,7 @@ describe('channel remote test', function () {
});

describe('#broadcast', function () {
it('should broadcast to all the client connected', function (done: MochaDone) {
it('should broadcast to all the client connected', function (done: Mocha.Done) {
let sids = [1, 2, 3, 4, 5];
let uids = [11, 12, 13, 14, 15];
let frontendId = 'frontend-server-id';
Expand Down Expand Up @@ -123,7 +123,7 @@ describe('channel remote test', function () {
});
});

it('should broadcast to all the binded client connected', function (done: MochaDone) {
it('should broadcast to all the binded client connected', function (done: Mocha.Done) {
let sids = [1, 2, 3, 4, 5, 6];
let uids = [11, 12, 13];
let frontendId = 'frontend-server-id';
Expand Down
2 changes: 1 addition & 1 deletion packages/pinus/test/service/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ describe('channel test', function () {
});

describe('#pushMessage', function () {
it('should push message to the right frontend server by sid', function (done: MochaDone) {
it('should push message to the right frontend server by sid', function (done: Mocha.Done) {
let sid1 = 'sid1', sid2 = 'sid2';
let uid1 = 'uid1', uid2 = 'uid2', uid3 = 'uid3';
let mockUids = [{ sid: sid1, uid: uid1 }, { sid: sid2, uid: uid2 }, { sid: sid2, uid: uid3 }];
Expand Down
10 changes: 5 additions & 5 deletions packages/pinus/test/service/channelService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('channel manager test', function () {
});

describe('#pushMessageByUids', function () {
it('should push message to the right frontend server', function (done: MochaDone) {
it('should push message to the right frontend server', function (done: Mocha.Done) {
let sid1 = 'sid1', sid2 = 'sid2';
let uid1 = 'uid1', uid2 = 'uid2', uid3 = 'uid3';
let orgRoute = 'test.route.string';
Expand Down Expand Up @@ -106,7 +106,7 @@ describe('channel manager test', function () {
});
});

it('should return an err if uids is empty', function (done: MochaDone) {
it('should return an err if uids is empty', function (done: Mocha.Done) {
let mockMsg = { key: 'some remote message' };
let app = pinus.createApp({ base: mockBase });
let channelService = new ChannelService(app);
Expand All @@ -118,7 +118,7 @@ describe('channel manager test', function () {
});
});

it('should return err if all message fail to push', function (done: MochaDone) {
it('should return err if all message fail to push', function (done: Mocha.Done) {
let sid1 = 'sid1', sid2 = 'sid2';
let uid1 = 'uid1', uid2 = 'uid2', uid3 = 'uid3';
let mockUids = [
Expand Down Expand Up @@ -151,7 +151,7 @@ describe('channel manager test', function () {
});
});

it('should return fail uid list if fail to push messge to some of the uids', function (done: MochaDone) {
it('should return fail uid list if fail to push messge to some of the uids', function (done: Mocha.Done) {
let sid1 = 'sid1', sid2 = 'sid2';
let uid1 = 'uid1', uid2 = 'uid2', uid3 = 'uid3';
let mockUids = [{ sid: sid1, uid: uid1 }, { sid: sid2, uid: uid2 }, { sid: sid2, uid: uid3 }];
Expand Down Expand Up @@ -191,7 +191,7 @@ describe('channel manager test', function () {
});

describe('#broadcast', function () {
it('should push message to all specified frontend servers', function (done: MochaDone) {
it('should push message to all specified frontend servers', function (done: Mocha.Done) {
let mockServers = [
{ id: 'connector-1', serverType: 'connector', other: 'xxx1' },
{ id: 'connector-2', serverType: 'connector', other: 'xxx2' },
Expand Down
2 changes: 1 addition & 1 deletion packages/pinus/test/service/connectionService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ describe('connection service test', function () {
});
});

it('should getStatisticsInfo', function (done: MochaDone) {
it('should getStatisticsInfo', function (done: Mocha.Done) {
let service = new ConnectionService(mockApp);
let uid1 = 'uid1', uid2 = 'uid2';
let info1 = { msg: 'msg1' }, info2 = { msg: 'msg2' };
Expand Down
Loading

0 comments on commit bc869fb

Please sign in to comment.