Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/commands/cov.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default class Cov<T extends typeof Cov> extends Test<T> {
static override examples = [
'<%= config.bin %> <%= command.id %>',
'<%= config.bin %> <%= command.id %> test/index.test.ts',
'<%= config.bin %> <%= command.id %> test/index.test.ts,test/user.test.ts,...',
];

static override flags = {
Expand Down
1 change: 1 addition & 0 deletions src/commands/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default class Test<T extends typeof Test> extends BaseCommand<T> {
static override examples = [
'<%= config.bin %> <%= command.id %>',
'<%= config.bin %> <%= command.id %> test/index.test.ts',
'<%= config.bin %> <%= command.id %> test/index.test.ts,test/user.test.ts,...',
'<%= config.bin %> <%= command.id %> --json',
'<%= config.bin %> <%= command.id %> --log-level debug',
];
Expand Down
23 changes: 20 additions & 3 deletions test/commands/test.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('test/commands/test.test.ts', () => {
describe('egg-bin test', () => {
it('should success js', () => {
return coffee.fork(eggBin, [ 'test' ], { cwd })
.debug()
// .debug()
.expect('stdout', /should success/)
.expect('stdout', /a\.test\.js/)
.expect('stdout', /b\/b\.test\.js/)
Expand All @@ -20,12 +20,29 @@ describe('test/commands/test.test.ts', () => {
.end();
});

it('should success with some files', async () => {
await coffee.fork(eggBin, [ 'test', 'test/a.test.js' ], { cwd })
// .debug()
.expect('stdout', /should success/)
.expect('stdout', /a\.test\.js/)
.expect('stdout', /2 passing \(/)
.expect('code', 0)
.end();
await coffee.fork(eggBin, [ 'test', 'test/a.test.js,test/ignore.test.js' ], { cwd })
// .debug()
.expect('stdout', /should success/)
.expect('stdout', /a\.test\.js/)
.expect('stdout', /ignore\.test\.js/)
.expect('code', 0)
.end();
});

it('should work on auto require @eggjs/mock/register on CommonJS', () => {
if (process.platform === 'win32') return;
return coffee.fork(eggBin, [ 'test' ], {
cwd: getFixtures('test-demo-app'),
})
.debug()
// .debug()
.expect('stdout', /should work/)
.expect('stdout', /a\.test\.js/)
.expect('code', 0)
Expand All @@ -37,7 +54,7 @@ describe('test/commands/test.test.ts', () => {
return coffee.fork(eggBin, [ 'test' ], {
cwd: getFixtures('test-demo-app-esm'),
})
.debug()
// .debug()
.expect('stdout', /should work/)
.expect('stdout', /a\.test\.js/)
.expect('code', 0)
Expand Down
Loading