quackage 1.0.57 → 1.0.58

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quackage",
3
- "version": "1.0.57",
3
+ "version": "1.0.58",
4
4
  "description": "Building. Testing. Quacking. Reloading.",
5
5
  "main": "source/Quackage-CLIProgram.js",
6
6
  "scripts": {
@@ -24,6 +24,7 @@ let _Pict = new libCLIProgram(
24
24
 
25
25
  // Mocha test execution
26
26
  require('./commands/Quackage-Command-RunMochaTests.js'),
27
+ require('./commands/Quackage-Command-RunNycCoverage.js'),
27
28
 
28
29
  // Gulp build execution (for multiple build targets)
29
30
  require('./commands/Quackage-Command-Build.js'),
@@ -0,0 +1,72 @@
1
+ const libCommandLineCommand = require('pict-service-commandlineutility').ServiceCommandLineCommand;
2
+ const libFS = require('fs');
3
+
4
+ class QuackageCommandRunNycCoverage extends libCommandLineCommand
5
+ {
6
+ constructor(pFable, pManifest, pServiceHash)
7
+ {
8
+ super(pFable, pManifest, pServiceHash);
9
+
10
+ this.options.CommandKeyword = 'run-nyc-coverage';
11
+ this.options.Description = 'Run nyc code coverage with mocha tests.';
12
+ this.options.Aliases.push('coverage');
13
+
14
+ this.addCommand();
15
+ }
16
+
17
+ findExecutable(pName)
18
+ {
19
+ let tmpCWDLocation = `${this.fable.AppData.CWD}/node_modules/.bin/${pName}`;
20
+ let tmpRelativePackageLocation = `${__dirname}/../../../.bin/${pName}`;
21
+ let tmpGitRepositoryLocation = `${__dirname}/../../node_modules/.bin/${pName}`;
22
+
23
+ if (libFS.existsSync(tmpCWDLocation))
24
+ {
25
+ return tmpCWDLocation;
26
+ }
27
+ this.log.info(`CWD Location does not contain an installation of ${pName} at [${tmpCWDLocation}]; checking relative to the quackage package...`);
28
+
29
+ if (libFS.existsSync(tmpRelativePackageLocation))
30
+ {
31
+ return tmpRelativePackageLocation;
32
+ }
33
+ this.log.info(`Relative Quackage Package Location does not contain an installation of ${pName} at [${tmpRelativePackageLocation}]; checking if you're running from the direct git repository...`);
34
+
35
+ if (libFS.existsSync(tmpGitRepositoryLocation))
36
+ {
37
+ return tmpGitRepositoryLocation;
38
+ }
39
+
40
+ return false;
41
+ }
42
+
43
+ onRunAsync(fCallback)
44
+ {
45
+ let tmpNycLocation = this.findExecutable('nyc');
46
+ if (!tmpNycLocation)
47
+ {
48
+ let tmpErrorMessage = `Could not find nyc in CWD, relative quackage, or git repository locations. Maybe you need to run "npm install" somewhere?`;
49
+ this.log.error(tmpErrorMessage);
50
+ return fCallback(new Error(tmpErrorMessage));
51
+ }
52
+ this.log.info(`Quackage found nyc at [${tmpNycLocation}]`);
53
+
54
+ let tmpMochaLocation = this.findExecutable('mocha');
55
+ if (!tmpMochaLocation)
56
+ {
57
+ let tmpErrorMessage = `Could not find mocha in CWD, relative quackage, or git repository locations. Maybe you need to run "npm install" somewhere?`;
58
+ this.log.error(tmpErrorMessage);
59
+ return fCallback(new Error(tmpErrorMessage));
60
+ }
61
+ this.log.info(`Quackage found mocha at [${tmpMochaLocation}]`);
62
+
63
+ // nyc --reporter=lcov --reporter=text-lcov MOCHA_PATH -- -u tdd -R spec
64
+ this.fable.QuackageProcess.execute(
65
+ `${tmpNycLocation}`,
66
+ ['--reporter=lcov', '--reporter=text-lcov', tmpMochaLocation, '--', '-u', 'tdd', '-R', 'spec'],
67
+ { cwd: this.fable.AppData.CWD },
68
+ fCallback);
69
+ };
70
+ }
71
+
72
+ module.exports = QuackageCommandRunNycCoverage;
File without changes