mocha 3.4.2 → 3.5.0

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/CHANGELOG.md CHANGED
@@ -1,9 +1,40 @@
1
+ # 3.5.0 / 2017-07-31
2
+
3
+ ## :newspaper: News
4
+
5
+ - Mocha now has a [code of conduct](https://github.com/mochajs/mocha/blob/master/.github/CODE_OF_CONDUCT.md) (thanks [@kungapal]!).
6
+ - Old issues and PRs are now being marked "stale" by [Probot's "Stale" plugin](https://github.com/probot/stale). If an issue is marked as such, and you would like to see it remain open, simply add a new comment to the ticket or PR.
7
+ - **WARNING**: Support for non-ES5-compliant environments will be dropped starting with version 4.0.0 of Mocha!
8
+
9
+ ## :lock: Security Fixes
10
+
11
+ - [#2860]: Address [CVE-2015-8315](https://nodesecurity.io/advisories/46) via upgrade of [debug](https://npm.im/debug) ([@boneskull])
12
+
13
+ ## :tada: Enhancements
14
+
15
+ - [#2696]: Add `--forbid-only` and `--forbid-pending` flags. Use these in CI or hooks to ensure tests aren't accidentally being skipped! ([@charlierudolph])
16
+ - [#2813]: Support Node.js 8's `--napi-modules` flag ([@jupp0r])
17
+
18
+ ## :nut_and_bolt: Other
19
+
20
+ - Various CI-and-test-related fixes and improvements ([@boneskull], [@dasilvacontin], [@PopradiArpad], [@Munter], [@ScottFreeCode])
21
+ - "Officially" support Node.js 8 ([@elergy])
22
+
23
+ [#2860]: https://github.com/mochajs/mocha/pulls/2860
24
+ [#2696]: https://github.com/mochajs/mocha/pulls/2696
25
+ [#2813]: https://github.com/mochajs/mocha/pulls/2813
26
+ [@charlierudolph]: https://github.com/charlierudolph
27
+ [@PopradiArpad]: https://github.com/PopradiArpad
28
+ [@kungapal]: https://github.com/kungapal
29
+ [@elergy]: https://github.com/elergy
30
+ [@jupp0r]: https://github.com/jupp0r
31
+
1
32
  # 3.4.2 / 2017-05-24
2
33
 
3
34
  ## :bug: Fixes
4
35
 
5
- - [#2802]: Remove call to deprecated os.tmpDir ([@makepanic])
6
- - [#2820]: Eagerly set process.exitCode ([@chrisleck])
36
+ - [#2802]: Remove call to deprecated `os.tmpDir` ([@makepanic])
37
+ - [#2820]: Eagerly set `process.exitCode` ([@chrisleck])
7
38
 
8
39
  ## :nut_and_bolt: Other
9
40
 
@@ -13,6 +44,7 @@
13
44
  [@makepanic]: https://github.com/makepanic
14
45
  [@Munter]: https://github.com/Munter
15
46
 
47
+ [#2778]: https://github.com/mochajs/mocha/pulls/2778
16
48
  [#2802]: https://github.com/mochajs/mocha/issues/2802
17
49
  [#2820]: https://github.com/mochajs/mocha/pull/2820
18
50
 
package/README.md CHANGED
@@ -11,8 +11,9 @@
11
11
  1. Increase test coverage on Node.js and browser
12
12
  - Increase integration coverage for all reporters
13
13
  - `html` reporter must be tested in browser
14
- - Basic console reporters (*not* `nyan`, `landing`, etc.) must be tested in **both** browser and Node.js contexts; PhantomJS can consume all console reporters
15
- - Filesystem-based reporters must be tested in Node.js context
14
+ - ~~Basic console reporters (*not* `nyan`, `landing`, etc.) must be tested in **both** browser and Node.js contexts; PhantomJS can consume all console reporters~~
15
+ - ~~Filesystem-based reporters must be tested in Node.js context~~
16
+ - **UPDATE - May 24 2017**: Thanks to [community contributions](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md#mag-coverage), the coverage on most reporters has increased dramatically! The `html` reporter is still in [dire need of coverage](https://coveralls.io/builds/11674428/source?filename=lib%2Freporters%2Fhtml.js).
16
17
  - Increase coverage against all interfaces (`exports` in particular). Ideally this becomes a "matrix" where we repeat sets of integration tests across all interfaces.
17
18
  - Refactor non-Node.js-specific tests to allow them to run in a browser context. Node.js-specific tests include those which *require* the CLI or filesystem. Most everything else is fair game.
18
19
  2. Review current open pull requests
@@ -20,7 +21,7 @@
20
21
  - Pull requests **must** have supporting tests. The only exceptions are pure cosmetic or non-functional changes.
21
22
  - Pull request contributors must sign the CLA.
22
23
  3. Close old, inactive issues and pull requests
23
- - A bot should do this. We need a bot. Got a bot?
24
+ - ~~A bot should do this. We need a bot. Got a bot?~~ We now use GitHub's own [probot-stale](https://www.npmjs.com/package/probot-stale).
24
25
  4. Triage issues
25
26
  - If we run into "critical" bugs, they need fixing.
26
27
  - "Critical" means Mocha is broken w/o workarounds for a *large percentage* of users
package/bin/_mocha CHANGED
@@ -99,6 +99,7 @@ program
99
99
  .option('--no-warnings', 'silence all node process warnings')
100
100
  .option('--opts <path>', 'specify opts path', 'test/mocha.opts')
101
101
  .option('--perf-basic-prof', 'enable perf linux profiler (basic support)')
102
+ .option('--napi-modules', 'enable experimental NAPI modules')
102
103
  .option('--prof', 'log statistical profiling information')
103
104
  .option('--log-timer-events', 'Time events including external callbacks')
104
105
  .option('--recursive', 'include sub directories')
@@ -111,7 +112,9 @@ program
111
112
  .option('--use_strict', 'enforce strict mode')
112
113
  .option('--watch-extensions <ext>,...', 'additional extensions to monitor with --watch', list, [])
113
114
  .option('--delay', 'wait for async suite definition')
114
- .option('--allow-uncaught', 'enable uncaught errors to propagate');
115
+ .option('--allow-uncaught', 'enable uncaught errors to propagate')
116
+ .option('--forbid-only', 'causes test marked with only to fail the suite')
117
+ .option('--forbid-pending', 'causes pending tests and test marked with skip to fail the suite');
115
118
 
116
119
  program._name = 'mocha';
117
120
 
@@ -333,6 +336,14 @@ if (program.retries) {
333
336
  mocha.suite.retries(program.retries);
334
337
  }
335
338
 
339
+ // --forbid-only
340
+
341
+ if (program.forbidOnly) mocha.forbidOnly();
342
+
343
+ // --forbid-pending
344
+
345
+ if (program.forbidPending) mocha.forbidPending();
346
+
336
347
  // custom compiler support
337
348
 
338
349
  var extensions = ['js'];
package/bin/mocha CHANGED
@@ -48,6 +48,7 @@ process.argv.slice(2).forEach(function (arg) {
48
48
  case '--use_strict':
49
49
  case '--allow-natives-syntax':
50
50
  case '--perf-basic-prof':
51
+ case '--napi-modules':
51
52
  args.unshift(arg);
52
53
  break;
53
54
  default:
package/lib/mocha.js CHANGED
@@ -483,6 +483,24 @@ Mocha.prototype.delay = function delay () {
483
483
  return this;
484
484
  };
485
485
 
486
+ /**
487
+ * Tests marked only fail the suite
488
+ * @returns {Mocha}
489
+ */
490
+ Mocha.prototype.forbidOnly = function () {
491
+ this.options.forbidOnly = true;
492
+ return this;
493
+ };
494
+
495
+ /**
496
+ * Pending tests and tests marked skip fail the suite
497
+ * @returns {Mocha}
498
+ */
499
+ Mocha.prototype.forbidPending = function () {
500
+ this.options.forbidPending = true;
501
+ return this;
502
+ };
503
+
486
504
  /**
487
505
  * Run tests and invoke `fn()` when complete.
488
506
  *
@@ -504,6 +522,8 @@ Mocha.prototype.run = function (fn) {
504
522
  runner.hasOnly = options.hasOnly;
505
523
  runner.asyncOnly = options.asyncOnly;
506
524
  runner.allowUncaught = options.allowUncaught;
525
+ runner.forbidOnly = options.forbidOnly;
526
+ runner.forbidPending = options.forbidPending;
507
527
  if (options.grep) {
508
528
  runner.grep(options.grep, options.invert);
509
529
  }
package/lib/runner.js CHANGED
@@ -820,6 +820,12 @@ Runner.prototype.run = function (fn) {
820
820
 
821
821
  // callback
822
822
  this.on('end', function () {
823
+ if (self.forbidOnly && self.hasOnly) {
824
+ self.failures += self.stats.tests;
825
+ }
826
+ if (self.forbidPending) {
827
+ self.failures += self.stats.pending;
828
+ }
823
829
  debug('end');
824
830
  process.removeListener('uncaughtException', uncaught);
825
831
  fn(self.failures);