Skip to content

Commit bf3662e

Browse files
authored
Merge branch 'master' into munter/transpilation
2 parents 871f958 + e30ae28 commit bf3662e

30 files changed

+373
-431
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Deploy `mochajs.org` branch nightly by hitting a netlify build URL.
2+
# This updates the list of supporters
3+
4+
name: Nightly mochajs.org Deploy
5+
on:
6+
schedule:
7+
- cron: '0 0 * * *'
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Webhook Action
13+
uses: joelwmale/[email protected]
14+
env:
15+
data: ''
16+
WEBHOOK_URL: ${{ secrets.NETLIFY_NIGHTLY_DEPLOY_URL }}

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ jobs:
3939
- script: COVERAGE=1 npm start test.node
4040
after_success: npm start coveralls
4141
name: 'Latest Node.js (with coverage)'
42-
- script: MOCHA_PARALLEL=0 npm start test.node.unit
43-
name: 'Latest Node.js (unit tests in serial mode)'
4442

4543
- &node
4644
script: npm start test.node

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Let's welcome [**@giltayar**](https://github.com/giltayar) and [**@nicojs**](htt
1414

1515
## :boom: Breaking Changes
1616

17-
- [#4164](https://github.com/mochajs/mocha/issues/4164): **Mocha v8.0.0 now requires Node.js v10.0.0 or newer.** Mocha no longer supports the Node.js v8.x line ("Carbon"), which entered End-of-Life at the end of 2019 ([**@UlisesGascon**](https://github.com/UlisesGascon))
17+
- [#4164](https://github.com/mochajs/mocha/issues/4164): **Mocha v8.0.0 now requires Node.js v10.12.0 or newer.** Mocha no longer supports the Node.js v8.x line ("Carbon"), which entered End-of-Life at the end of 2019 ([**@UlisesGascon**](https://github.com/UlisesGascon))
1818

1919
- [#4175](https://github.com/mochajs/mocha/issues/4175): Having been deprecated with a warning since v7.0.0, **`mocha.opts` is no longer supported** ([**@juergba**](https://github.com/juergba))
2020

@@ -35,6 +35,7 @@ Let's welcome [**@giltayar**](https://github.com/giltayar) and [**@nicojs**](htt
3535
- [#4223](https://github.com/mochajs/mocha/issues/4223): The context object's `skip()` (`this.skip()`) in a "before all" (`before()`) hook will no longer execute subsequent sibling hooks, in addition to hooks in child suites ([**@juergba**](https://github.com/juergba))
3636

3737
- [#4178](https://github.com/mochajs/mocha/issues/4178): Remove previously soft-deprecated APIs ([**@wnghdcjfe**](https://github.com/wnghdcjfe)):
38+
3839
- `Mocha.prototype.ignoreLeaks()`
3940
- `Mocha.prototype.useColors()`
4041
- `Mocha.prototype.useInlineDiffs()`
@@ -54,6 +55,10 @@ Let's welcome [**@giltayar**](https://github.com/giltayar) and [**@nicojs**](htt
5455

5556
- [#4246](https://github.com/mochajs/mocha/issues/4246): Add documentation for parallel mode and Root Hook plugins ([**@boneskull**](https://github.com/boneskull))
5657

58+
## :nut_and_bolt: Other
59+
60+
- [#4200](https://github.com/mochajs/mocha/issues/4200): Drop mkdirp and replace it with fs.mkdirSync ([**@HyunSangHan**](https://github.com/HyunSangHan))
61+
5762
## :bug: Fixes
5863

5964
(All bug fixes in Mocha v8.0.0 are also breaking changes, and are listed above)

docs/_data/blacklist.json renamed to docs/_data/blocklist.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,7 @@
1717
"trust-my-paper",
1818
"seowebsitetraffic-net",
1919
"pfannen-test",
20+
"casinobosscanada-com",
21+
"suominettikasinot24",
2022
"mochajs"
2123
]

docs/index.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Mocha is a feature-rich JavaScript test framework running on [Node.js][] and in
3737
- [config file support](#-config-path)
3838
- [node debugger support](#-inspect-inspect-brk-inspect)
3939
- [node native ES modules support](#nodejs-native-esm-support)
40+
- [source-map support](#-enable-source-maps)
4041
- [detects multiple calls to `done()`](#detects-multiple-calls-to-done)
4142
- [use any assertion library you want](#assertions)
4243
- [extensible reporting, bundled with 9+ reporters](#reporters)
@@ -1142,6 +1143,19 @@ These flags vary depending on your version of Node.js.
11421143

11431144
`node` flags can be defined in Mocha's [configuration](#configuring-mocha-nodejs).
11441145

1146+
### `--enable-source-maps`
1147+
1148+
> _New in Node.js v12.12.0_
1149+
1150+
If the [`--enable-source-maps`](https://nodejs.org/dist/latest-v12.x/docs/api/cli.html#cli_enable_source_maps) flag
1151+
is passed to mocha, source maps will be collected and used to provide accurate stack traces for transpiled code:
1152+
1153+
```bash
1154+
Error: cool
1155+
at Object.<anonymous> (/Users/fake-user/bigco/nodejs-tasks/build/src/index.js:27:7)
1156+
-> /Users/fake-user/bigco/nodejs-tasks/src/index.ts:24:7
1157+
```
1158+
11451159
### About V8 Flags
11461160

11471161
Prepend `--v8-` to any flag listed in the output of `node --v8-options` (excluding `--v8-options` itself) to use it.

lib/reporters/base.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ exports.colors = {
7878
light: 90,
7979
'diff gutter': 90,
8080
'diff added': 32,
81-
'diff removed': 31
81+
'diff removed': 31,
82+
'diff added inline': '30;42',
83+
'diff removed inline': '30;41'
8284
};
8385

8486
/**
@@ -417,9 +419,9 @@ function inlineDiff(actual, expected) {
417419
// legend
418420
msg =
419421
'\n' +
420-
color('diff removed', 'actual') +
422+
color('diff removed inline', 'actual') +
421423
' ' +
422-
color('diff added', 'expected') +
424+
color('diff added inline', 'expected') +
423425
'\n\n' +
424426
msg +
425427
'\n';
@@ -485,10 +487,10 @@ function errorDiff(actual, expected) {
485487
.diffWordsWithSpace(actual, expected)
486488
.map(function(str) {
487489
if (str.added) {
488-
return colorLines('diff added', str.value);
490+
return colorLines('diff added inline', str.value);
489491
}
490492
if (str.removed) {
491-
return colorLines('diff removed', str.value);
493+
return colorLines('diff removed inline', str.value);
492494
}
493495
return str.value;
494496
})

package-lock.json

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"ms": "2.1.2",
6868
"object.assign": "4.1.0",
6969
"promise.allsettled": "1.0.2",
70-
"serialize-javascript": "3.0.0",
70+
"serialize-javascript": "3.1.0",
7171
"strip-json-comments": "3.0.1",
7272
"supports-color": "7.1.0",
7373
"which": "2.0.2",

test/node-unit/buffered-runner.spec.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@ const BUFFERED_RUNNER_PATH = require.resolve(
1313
);
1414
const Suite = require('../../lib/suite');
1515
const Runner = require('../../lib/runner');
16-
const {createSandbox} = require('sinon');
16+
const sinon = require('sinon');
1717

1818
describe('buffered-runner', function() {
1919
describe('BufferedRunner', function() {
20-
let sandbox;
2120
let run;
2221
let BufferedWorkerPool;
2322
let terminate;
@@ -27,27 +26,26 @@ describe('buffered-runner', function() {
2726
let cpuCount;
2827

2928
beforeEach(function() {
30-
sandbox = createSandbox();
3129
cpuCount = 1;
3230
suite = new Suite('a root suite', {}, true);
33-
warn = sandbox.stub();
31+
warn = sinon.stub();
3432

3533
// tests will want to further define the behavior of these.
36-
run = sandbox.stub();
37-
terminate = sandbox.stub();
34+
run = sinon.stub();
35+
terminate = sinon.stub();
3836
BufferedWorkerPool = {
39-
create: sandbox.stub().returns({
37+
create: sinon.stub().returns({
4038
run,
4139
terminate,
42-
stats: sandbox.stub().returns({})
40+
stats: sinon.stub().returns({})
4341
})
4442
};
4543
BufferedRunner = rewiremock.proxy(BUFFERED_RUNNER_PATH, r => ({
4644
'../../lib/nodejs/buffered-worker-pool': {
4745
BufferedWorkerPool
4846
},
4947
os: {
50-
cpus: sandbox.stub().callsFake(() => new Array(cpuCount))
48+
cpus: sinon.stub().callsFake(() => new Array(cpuCount))
5149
},
5250
'../../lib/utils': r.with({warn}).callThrough()
5351
}));
@@ -157,7 +155,7 @@ describe('buffered-runner', function() {
157155

158156
it('should delegate to Runner#uncaught', function(done) {
159157
const options = {};
160-
sandbox.spy(runner, 'uncaught');
158+
sinon.spy(runner, 'uncaught');
161159
const err = new Error('whoops');
162160
run.withArgs('some-file.js', options).rejects(new Error('whoops'));
163161
run.withArgs('some-other-file.js', options).resolves({

test/node-unit/buffered-worker-pool.spec.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,34 @@
11
'use strict';
22

33
const rewiremock = require('rewiremock/node');
4-
const {createSandbox} = require('sinon');
4+
const sinon = require('sinon');
55

66
describe('class BufferedWorkerPool', function() {
77
let BufferedWorkerPool;
8-
let sandbox;
98
let pool;
109
let stats;
1110
let serializeJavascript;
1211
let serializer;
1312
let result;
1413

1514
beforeEach(function() {
16-
sandbox = createSandbox();
1715
stats = {totalWorkers: 10, busyWorkers: 8, idleWorkers: 2, pendingTasks: 3};
1816
result = {failures: 0, events: []};
1917
pool = {
20-
terminate: sandbox.stub().resolves(),
21-
exec: sandbox.stub().resolves(result),
22-
stats: sandbox.stub().returns(stats)
18+
terminate: sinon.stub().resolves(),
19+
exec: sinon.stub().resolves(result),
20+
stats: sinon.stub().returns(stats)
2321
};
2422
serializer = {
25-
deserialize: sandbox.stub()
23+
deserialize: sinon.stub()
2624
};
2725

28-
serializeJavascript = sandbox.spy(require('serialize-javascript'));
26+
serializeJavascript = sinon.spy(require('serialize-javascript'));
2927
BufferedWorkerPool = rewiremock.proxy(
3028
require.resolve('../../lib/nodejs/buffered-worker-pool'),
3129
{
3230
workerpool: {
33-
pool: sandbox.stub().returns(pool),
31+
pool: sinon.stub().returns(pool),
3432
cpus: 8
3533
},
3634
'../../lib/nodejs/serializer': serializer,
@@ -43,7 +41,7 @@ describe('class BufferedWorkerPool', function() {
4341
});
4442

4543
afterEach(function() {
46-
sandbox.restore();
44+
sinon.restore();
4745
});
4846

4947
describe('static method', function() {

0 commit comments

Comments
 (0)