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

fix: only hotfix spawn-wrap on windows #69

Merged
merged 2 commits into from
Jul 5, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 7 additions & 3 deletions lib/cmd/cov.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class CovCommand extends Command {
env: Object.assign({ NODE_ENV: 'test' }, env),
};

// FIXME: remove hotfix after https://github.com/tapjs/spawn-wrap/pull/57 merged
yield hotfixSpawnWrap();

// save coverage-xxxx.json to $PWD/coverage
Expand Down Expand Up @@ -127,14 +128,17 @@ const src = 'var command = path.basename(options.file, \'.exe\')';
const target = 'var command = path.basename(options.file).replace(/\.exe$/i, \'\')';

function* hotfixSpawnWrap() {
yield replaceSpawnWrap(src, target);
if (process.platform === 'win32') {
yield replaceSpawnWrap(src, target);
Copy link
Member

Choose a reason for hiding this comment

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

加个 ignore?

Copy link
Member Author

Choose a reason for hiding this comment

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

我加个测试用例

}
}

function* rollbackSpawnWrap() {
yield replaceSpawnWrap(target, src);
if (process.platform === 'win32') {
yield replaceSpawnWrap(target, src);
}
}


function* replaceSpawnWrap(src, target) {
let spawnWrapPath;
try {
Expand Down
5 changes: 4 additions & 1 deletion test/lib/cmd/cov.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ describe('test/lib/cmd/cov.test.js', () => {
child.expect('stdout', /Statements {3}: 80% \( 4[\/|\\]5 \)/);
}

if (process.platform === 'win32') {
child.expect('stderr', /\[egg-bin] hotfix spawn-wrap/);
}

child.expect('code', 0)
.expect('stderr', /\[egg-bin] hotfix spawn-wrap/)
.end(err => {
assert.ifError(err);
assert.ok(fs.existsSync(path.join(cwd, 'coverage/coverage-final.json')));
Expand Down