Skip to content

Commit

Permalink
fff
Browse files Browse the repository at this point in the history
  • Loading branch information
atian25 committed Mar 29, 2018
1 parent e0b6164 commit dec7216
Showing 1 changed file with 29 additions and 16 deletions.
45 changes: 29 additions & 16 deletions test/ts.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,16 @@ describe('test/ts.test.js', () => {
});

describe('real application', () => {
if (process.env.EGG_VERSION && process.env.EGG_VERSION === '1') {
console.log('skip egg@1');
return;
}

before(() => {
cwd = path.join(__dirname, './fixtures/example-ts');
});

it('should start app', () => {
if (process.env.EGG_VERSION && process.env.EGG_VERSION === '1') {
console.log('skip egg@1');
return;
}
return coffee.fork(eggBin, [ 'dev', '--ts' ], { cwd })
// .debug()
.expect('stdout', /hi, egg, 12345/)
Expand All @@ -51,29 +53,35 @@ describe('test/ts.test.js', () => {
});

it('should test app', () => {
if (process.env.EGG_VERSION && process.env.EGG_VERSION === '1') {
console.log('skip egg@1');
return;
}
return coffee.fork(eggBin, [ 'test', '--ts' ], { cwd })
// .debug()
.expect('stdout', /hi, egg, 123456/)
.expect('stdout', /should work/)
.expect('code', 0)
.end();
});

it('should cov app', () => {
return coffee.fork(eggBin, [ 'cov', '--ts' ], { cwd })
.debug()
.expect('stdout', /hi, egg, 123456/)
.expect('stdout', process.env.NYC_ROOT_ID ? /Coverage summary/ : /Statements.*100%/)
.expect('code', 0)
.end();
});
});

describe('egg.typescript = true', () => {
if (process.env.EGG_VERSION && process.env.EGG_VERSION === '1') {
console.log('skip egg@1');
return;
}

before(() => {
cwd = path.join(__dirname, './fixtures/example-ts-pkg');
});

it('should start app', () => {
if (process.env.EGG_VERSION && process.env.EGG_VERSION === '1') {
console.log('skip egg@1');
return;
}
return coffee.fork(eggBin, [ 'dev' ], { cwd })
// .debug()
.expect('stdout', /hi, egg, 12345/)
Expand All @@ -83,15 +91,20 @@ describe('test/ts.test.js', () => {
});

it('should test app', () => {
if (process.env.EGG_VERSION && process.env.EGG_VERSION === '1') {
console.log('skip egg@1');
return;
}
return coffee.fork(eggBin, [ 'test' ], { cwd })
// .debug()
.expect('stdout', /hi, egg, 123456/)
.expect('code', 0)
.end();
});

it('should cov app', () => {
return coffee.fork(eggBin, [ 'cov' ], { cwd })
.debug()
.expect('stdout', /hi, egg, 123456/)
.expect('stdout', process.env.NYC_ROOT_ID ? /Coverage summary/ : /Statements.*100%/)
.expect('code', 0)
.end();
});
});
});

0 comments on commit dec7216

Please sign in to comment.