Skip to content

Commit

Permalink
fix: add startMode types
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Jan 1, 2025
1 parent 6dff064 commit 3475fe3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export interface MockClusterOptions extends MockOptions {
* opt pass to coffee, such as { execArgv: ['--debug'] }
*/
opt?: object;
startMode?: 'process' | 'worker_threads';
}

/**
Expand Down
26 changes: 26 additions & 0 deletions test/cluster.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,32 @@ describe('test/cluster.test.ts', () => {
});
});

describe('work on startMode=worker_threads', () => {
let app: MockApplication;
before(() => {
app = mm.cluster({
baseDir: getFixtures('demo'),
cache: false,
coverage: false,
startMode: 'worker_threads',
});
// app.debug();
return app.ready();
});
after(() => app.close());

it('should have members', async () => {
assert.equal(app.callback(), app);
assert.equal(app.listen(), app);
await app.ready();
assert(app.process);
});

it('should listen on port', () => {
app.expect('stdout', /egg started on http:\/\/127.0.0.1:17\d{3}/);
});
});

describe('cluster with fullpath baseDir', () => {
let app: MockApplication;
before(done => {
Expand Down

0 comments on commit 3475fe3

Please sign in to comment.