From 3916c20a84967c0e70e1d5b7d7c9054b9676ecfe Mon Sep 17 00:00:00 2001 From: wanghx Date: Sat, 31 Mar 2018 15:17:15 +0800 Subject: [PATCH 1/3] fix: remove ts extensions by default --- lib/cmd/cov.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/cmd/cov.js b/lib/cmd/cov.js index 45410a02..0e600b90 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'); + covArgs.push('--extension', '.ts'); this.addExclude('typings/'); this.addExclude('**/*.d.ts'); } From db35b391f7b019a3f2dd3a4c374a009442aac52c Mon Sep 17 00:00:00 2001 From: wanghx Date: Sat, 31 Mar 2018 15:49:37 +0800 Subject: [PATCH 2/3] fix: should get typescript from argv --- lib/cmd/cov.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cmd/cov.js b/lib/cmd/cov.js index 0e600b90..b6c4404d 100644 --- a/lib/cmd/cov.js +++ b/lib/cmd/cov.js @@ -107,7 +107,7 @@ class CovCommand extends Command { ]; // typescript support - if (context.typescript) { + if (context.argv.typescript) { covArgs.push('--extension', '.ts'); this.addExclude('typings/'); this.addExclude('**/*.d.ts'); From 08a8335b0b93254433207d1d1ddf160601e34a06 Mon Sep 17 00:00:00 2001 From: wanghx Date: Sat, 31 Mar 2018 16:31:06 +0800 Subject: [PATCH 3/3] test: add typescript option to pkg --- test/fixtures/example-ts/package.json | 5 ++++- test/ts.test.js | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) 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)