diff --git a/lib/cmd/cov.js b/lib/cmd/cov.js index 45410a02..b6c4404d 100644 --- a/lib/cmd/cov.js +++ b/lib/cmd/cov.js @@ -104,13 +104,11 @@ class CovCommand extends Command { '-r', 'json-summary', '-r', 'json', '-r', 'lcov', - '--extension', '.ts', ]; // typescript support - if (context.typescript) { - covArgs.push('--extension'); - covArgs.push('.ts'); + if (context.argv.typescript) { + covArgs.push('--extension', '.ts'); this.addExclude('typings/'); this.addExclude('**/*.d.ts'); } diff --git a/test/fixtures/example-ts/package.json b/test/fixtures/example-ts/package.json index 1ab2c3f9..24d8c3e5 100644 --- a/test/fixtures/example-ts/package.json +++ b/test/fixtures/example-ts/package.json @@ -1,3 +1,6 @@ { - "name": "example-ts" + "name": "example-ts", + "egg": { + "typescript": true + } } \ No newline at end of file diff --git a/test/ts.test.js b/test/ts.test.js index cf77db6e..05d0e741 100644 --- a/test/ts.test.js +++ b/test/ts.test.js @@ -63,7 +63,7 @@ describe('test/ts.test.js', () => { it('should cov app', () => { return coffee.fork(eggBin, [ 'cov', '--ts' ], { cwd }) - .debug() + // .debug() .expect('stdout', /hi, egg, 123456/) .expect('stdout', process.env.NYC_ROOT_ID ? /Coverage summary/ : /Statements.*100%/) .expect('code', 0)