Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use test when run cov on Windows #18

Merged
merged 1 commit into from
Oct 28, 2016
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
6 changes: 0 additions & 6 deletions lib/cov_command.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
const path = require('path');
const mkdirp = require('mkdirp');
const rimraf = require('rimraf');
const sleep = require('ko-sleep');
const Command = require('./command');

class CovCommand extends Command {
Expand Down Expand Up @@ -44,11 +43,6 @@ class CovCommand extends Command {
yield this.helper.forkNode(covFile, covArgs, opt);
rimraf.sync(process.env.TMPDIR);

// wait 5 second for Windows
if (process.platform === 'win32') {
yield sleep(5000);
}

// create coverage report
const reportArgs = this.getReportArgs(coverageDir);
yield this.helper.forkNode(covFile, reportArgs, opt);
Expand Down
6 changes: 5 additions & 1 deletion lib/program.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ class Program extends BaseProgram {
this.addCommand('dev', path.join(__dirname, 'dev_command.js'));
this.addCommand('debug', path.join(__dirname, 'debug_command.js'));
this.addCommand('test', path.join(__dirname, 'test_command.js'));
this.addCommand('cov', path.join(__dirname, 'cov_command.js'));
if (process.platform === 'win32') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这样的话, win 本地开发也不能看 cov 了?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

恩,感觉没需求,因为最终要跑在 linux 上的。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

打印个 warning 好点。有些人还是会在自己机器上看看覆盖率的,不能每次都发 ci 看结果

Copy link
Member Author

@popomore popomore Oct 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以打个,不过感觉不会有这样的人。写 Windows 的用例本身就比较费劲。�

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不会吧, 我指的是, 做 egg 应用的人, 很多人自己电脑还是 window, 他需要在本地看看 egg 应用的代码覆盖率, 跟 win 没关系.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

而我们这个地方, 会导致他们执行了半天 npm run cov 但是没有生成任何文件, 然后就怀疑人生了.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

看有人问了再看好了,egg 本身跑都这么艰难,加了一堆业务再 windows 上跑覆盖率估计成功率很低。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好, 那个报错的原因是 window ? 我以为是 appveyor 的问题. 那就这样吧

this.addCommand('cov', path.join(__dirname, 'test_command.js'));
} else {
this.addCommand('cov', path.join(__dirname, 'cov_command.js'));
}
}
}

Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"egg-utils": "^1.0.0",
"glob": "^7.1.1",
"istanbul": "^0.4.0",
"ko-sleep": "^1.0.2",
"mkdirp": "^0.5.1",
"mocha": "^3.0.0",
"rimraf": "^2.5.4",
Expand Down