1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | var runWithCover = require('./common/run-with-cover'),
|
7 | util = require('util'),
|
8 | Command = require('./index');
|
9 |
|
10 | function TestCommand() {
|
11 | Command.call(this);
|
12 | }
|
13 |
|
14 | TestCommand.TYPE = 'test';
|
15 | util.inherits(TestCommand, Command);
|
16 |
|
17 | Command.mix(TestCommand, {
|
18 | synopsis: function () {
|
19 | return "cover a node command only when npm_config_coverage is set. Use in an `npm test` script for conditional coverage";
|
20 | },
|
21 |
|
22 | usage: function () {
|
23 | runWithCover.usage(this.toolName(), this.type());
|
24 | },
|
25 |
|
26 | run: function (args, callback) {
|
27 | runWithCover.run(args, this.type(), !!process.env.npm_config_coverage, callback);
|
28 | }
|
29 | });
|
30 |
|
31 | module.exports = TestCommand;
|