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

WIP: feat: use c8 instead of nyc when node >= 10.12.0 #134

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ node_js:
- '6'
- '8'
- '10'
- '12'
env:
- EGG_VERSION=1
- EGG_VERSION=2
Expand Down
7 changes: 6 additions & 1 deletion lib/cmd/cov.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const debug = require('debug')('egg-bin');
const path = require('path');
const rimraf = require('mz-modules/rimraf');
const testExclude = require('test-exclude');
const semver = require('semver');

const Command = require('./test');
const EXCLUDES = Symbol('cov#excludes');
Expand Down Expand Up @@ -68,7 +69,11 @@ class CovCommand extends Command {
this.addExclude(exclude);
}

const nycCli = require.resolve('nyc/bin/nyc.js');
let nycCli = require.resolve('nyc/bin/nyc.js');
if (semver.gte(process.versions.node, '10.12.0')) {
nycCli = require.resolve('c8/bin/c8.js');
}

const coverageDir = path.join(cwd, 'coverage');
yield rimraf(coverageDir);
const outputDir = path.join(cwd, 'node_modules/.nyc_output');
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
},
"dependencies": {
"autod": "^3.1.0",
"c8": "^3.5.0",
Copy link
Member

Choose a reason for hiding this comment

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

这玩意居然有 10M

Copy link
Member

Choose a reason for hiding this comment

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

太大。。。还不清楚它的优势。。。

Copy link
Member Author

Choose a reason for hiding this comment

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

就是不用自己做 instrument,v8 来做,可能会快点,等 ci 能过测下

"chalk": "^2.4.2",
"co-mocha": "^1.2.2",
"common-bin": "^2.8.1",
Expand Down Expand Up @@ -80,6 +81,6 @@
"bin"
],
"ci": {
"version": "6, 8"
"version": "6, 8, 10, 12"
}
}