mocha 3.4.2 → 3.5.3

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,84 @@
1
+ # 3.5.3 / 2017-09-11
2
+
3
+ ## :bug: Fixes
4
+
5
+ - [#3003]: Fix invalid entities in xUnit reporter first appearing in v3.5.1 ([@jkrems])
6
+
7
+ [#3003]: https://github.com/mochajs/mocha/pull/3003
8
+
9
+ # 3.5.2 / 2017-09-10
10
+
11
+ ## :bug: Fixes
12
+
13
+ - [#3001]: Fix AMD-related failures first appearing in v3.5.1 ([@boneskull])
14
+
15
+ [#3001]: https://github.com/mochajs/mocha/pull/3001
16
+
17
+ # 3.5.1 / 2017-09-09
18
+
19
+ ## :newspaper: News
20
+
21
+ - :mega: Mocha is now sponsoring [PDXNode](http://pdxnode.org)! If you're in the [Portland](https://wikipedia.org/wiki/Portland,_Oregon) area, come check out the monthly talks and hack nights!
22
+
23
+ ## :bug: Fixes
24
+
25
+ - [#2997]: Fix missing `xit` export for "require" interface ([@solodynamo])
26
+ - [#2957]: Fix unicode character handling in XUnit reporter failures ([@jkrems])
27
+
28
+ ## :nut_and_bolt: Other
29
+
30
+ - [#2986]: Add issue and PR templates ([@kungapal])
31
+ - [#2918]: Drop bash dependency for glob-related tests ([@ScottFreeCode])
32
+ - [#2922]: Improve `--compilers` coverage ([@ScottFreeCode])
33
+ - [#2981]: Fix tpyos and spelling errors ([@jsoref])
34
+
35
+ [#2997]: https://github.com/mochajs/mocha/pull/2997
36
+ [#2957]: https://github.com/mochajs/mocha/pull/2957
37
+ [#2918]: https://github.com/mochajs/mocha/pull/2918
38
+ [#2986]: https://github.com/mochajs/mocha/pull/2986
39
+ [#2922]: https://github.com/mochajs/mocha/pull/2922
40
+ [#2981]: https://github.com/mochajs/mocha/pull/2981
41
+ [@solodynamo]: https://github.com/solodynamo
42
+ [@jkrems]: https://github.com/jkrems
43
+ [@jsoref]: https://github.com/jsoref
44
+
45
+ # 3.5.0 / 2017-07-31
46
+
47
+ ## :newspaper: News
48
+
49
+ - Mocha now has a [code of conduct](https://github.com/mochajs/mocha/blob/master/.github/CODE_OF_CONDUCT.md) (thanks [@kungapal]!).
50
+ - 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.
51
+ - **WARNING**: Support for non-ES5-compliant environments will be dropped starting with version 4.0.0 of Mocha!
52
+
53
+ ## :lock: Security Fixes
54
+
55
+ - [#2860]: Address [CVE-2015-8315](https://nodesecurity.io/advisories/46) via upgrade of [debug](https://npm.im/debug) ([@boneskull])
56
+
57
+ ## :tada: Enhancements
58
+
59
+ - [#2696]: Add `--forbid-only` and `--forbid-pending` flags. Use these in CI or hooks to ensure tests aren't accidentally being skipped! ([@charlierudolph])
60
+ - [#2813]: Support Node.js 8's `--napi-modules` flag ([@jupp0r])
61
+
62
+ ## :nut_and_bolt: Other
63
+
64
+ - Various CI-and-test-related fixes and improvements ([@boneskull], [@dasilvacontin], [@PopradiArpad], [@Munter], [@ScottFreeCode])
65
+ - "Officially" support Node.js 8 ([@elergy])
66
+
67
+ [#2860]: https://github.com/mochajs/mocha/pulls/2860
68
+ [#2696]: https://github.com/mochajs/mocha/pulls/2696
69
+ [#2813]: https://github.com/mochajs/mocha/pulls/2813
70
+ [@charlierudolph]: https://github.com/charlierudolph
71
+ [@PopradiArpad]: https://github.com/PopradiArpad
72
+ [@kungapal]: https://github.com/kungapal
73
+ [@elergy]: https://github.com/elergy
74
+ [@jupp0r]: https://github.com/jupp0r
75
+
1
76
  # 3.4.2 / 2017-05-24
2
77
 
3
78
  ## :bug: Fixes
4
79
 
5
- - [#2802]: Remove call to deprecated os.tmpDir ([@makepanic])
6
- - [#2820]: Eagerly set process.exitCode ([@chrisleck])
80
+ - [#2802]: Remove call to deprecated `os.tmpDir` ([@makepanic])
81
+ - [#2820]: Eagerly set `process.exitCode` ([@chrisleck])
7
82
 
8
83
  ## :nut_and_bolt: Other
9
84
 
@@ -13,6 +88,7 @@
13
88
  [@makepanic]: https://github.com/makepanic
14
89
  [@Munter]: https://github.com/Munter
15
90
 
91
+ [#2778]: https://github.com/mochajs/mocha/pulls/2778
16
92
  [#2802]: https://github.com/mochajs/mocha/issues/2802
17
93
  [#2820]: https://github.com/mochajs/mocha/pull/2820
18
94
 
@@ -831,7 +907,7 @@ Thanks @entertainyou, @SimenB, @just-paja for the heads-up.
831
907
  * utils.stringify should handle objects without an Object prototype
832
908
  * in runnable test, comparing to undefined error's message rather than a literal
833
909
  * Fix test running output truncation on async STDIO
834
- * ammended for deprecated customFds option in child_process
910
+ * amended for deprecated customFds option in child_process
835
911
 
836
912
  2.1.0 / 2014-12-23
837
913
  ==================
@@ -1059,7 +1135,7 @@ Thanks @entertainyou, @SimenB, @just-paja for the heads-up.
1059
1135
  ==================
1060
1136
 
1061
1137
  * add: sort test files with --sort (#813)
1062
- * update: diff depedency to 1.0.7
1138
+ * update: diff dependency to 1.0.7
1063
1139
  * update: glob dependency to 3.2.3 (#927)
1064
1140
  * fix: diffs show whitespace differences (#976)
1065
1141
  * fix: improve global leaks (#783)
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
@@ -204,6 +204,7 @@ Mocha.prototype.ui = function (name) {
204
204
  exports.before = context.before || context.suiteSetup;
205
205
  exports.describe = context.describe || context.suite;
206
206
  exports.it = context.it || context.test;
207
+ exports.xit = context.xit || context.test.skip;
207
208
  exports.setup = context.setup || context.beforeEach;
208
209
  exports.suiteSetup = context.suiteSetup || context.before;
209
210
  exports.suiteTeardown = context.suiteTeardown || context.after;
@@ -483,6 +484,24 @@ Mocha.prototype.delay = function delay () {
483
484
  return this;
484
485
  };
485
486
 
487
+ /**
488
+ * Tests marked only fail the suite
489
+ * @returns {Mocha}
490
+ */
491
+ Mocha.prototype.forbidOnly = function () {
492
+ this.options.forbidOnly = true;
493
+ return this;
494
+ };
495
+
496
+ /**
497
+ * Pending tests and tests marked skip fail the suite
498
+ * @returns {Mocha}
499
+ */
500
+ Mocha.prototype.forbidPending = function () {
501
+ this.options.forbidPending = true;
502
+ return this;
503
+ };
504
+
486
505
  /**
487
506
  * Run tests and invoke `fn()` when complete.
488
507
  *
@@ -504,6 +523,8 @@ Mocha.prototype.run = function (fn) {
504
523
  runner.hasOnly = options.hasOnly;
505
524
  runner.asyncOnly = options.asyncOnly;
506
525
  runner.allowUncaught = options.allowUncaught;
526
+ runner.forbidOnly = options.forbidOnly;
527
+ runner.forbidPending = options.forbidPending;
507
528
  if (options.grep) {
508
529
  runner.grep(options.grep, options.invert);
509
530
  }
@@ -156,7 +156,7 @@ exports.cursor = {
156
156
  };
157
157
 
158
158
  /**
159
- * Outut the given `failures` as a list.
159
+ * Output the given `failures` as a list.
160
160
  *
161
161
  * @param {Array} failures
162
162
  * @api public
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);
package/lib/utils.js CHANGED
@@ -18,6 +18,7 @@ var statSync = require('fs').statSync;
18
18
  var watchFile = require('fs').watchFile;
19
19
  var lstatSync = require('fs').lstatSync;
20
20
  var toISOString = require('./to-iso-string');
21
+ var he = require('he');
21
22
 
22
23
  /**
23
24
  * Ignored directories.
@@ -35,11 +36,7 @@ exports.inherits = require('util').inherits;
35
36
  * @return {string}
36
37
  */
37
38
  exports.escape = function (html) {
38
- return String(html)
39
- .replace(/&/g, '&amp;')
40
- .replace(/"/g, '&quot;')
41
- .replace(/</g, '&lt;')
42
- .replace(/>/g, '&gt;');
39
+ return he.encode(String(html), { useNamedReferences: false });
43
40
  };
44
41
 
45
42
  /**