Skip to content

Commit f87825a

Browse files
authored
Drop mkdirp and replace it with fs.mkdirSync (#4200)
- Replace mkdirp with fs.mkdirSync using {recursive: true} - Drop the dependency mkdirp from Mocha - Fix version number of docs and package.json
1 parent c1a8adb commit f87825a

File tree

10 files changed

+24
-22
lines changed

10 files changed

+24
-22
lines changed

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Follow these steps to get going. If you are having trouble, don't be afraid to [
4242

4343
> PRO TIP: After `npm install`, run `npm start` to see a list of commands which can be run with `npm start <command>` (powered by [nps](https://npm.im/nps)).
4444
45-
1. [Install Node.js 10.x or newer](https://nodejs.org/en/download/).
45+
1. [Install Node.js 10.12.0 or newer](https://nodejs.org/en/download/).
4646
- If you're new to installing Node, a tool like [nvm](https://github.com/creationix/nvm#install-script) can help you manage multiple version installations.
4747
- You will need [Google Chrome](https://www.google.com/chrome/) to run browser-based tests locally.
4848
1. Follow [Github's documentation](https://help.github.com/articles/fork-a-repo/) on setting up Git, forking and cloning.

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ _So you wanna build the site?_
66

77
## Prerequisites
88

9-
- Node.js v10.x or greater
9+
- Node.js v10.12.0 or greater
1010

1111
## Development
1212

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ or as a development dependency for your project:
9797
$ npm install --save-dev mocha
9898
```
9999

100-
> As of v8.0.0, Mocha requires Node.js v10.0.0 or newer.
100+
> As of v8.0.0, Mocha requires Node.js v10.12.0 or newer.
101101
102102
## Getting Started
103103

karma.conf.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
const fs = require('fs');
44
const path = require('path');
5-
const mkdirp = require('mkdirp');
65
const os = require('os');
76
const baseBundleDirpath = path.join(__dirname, '.karma');
87

@@ -111,7 +110,7 @@ module.exports = config => {
111110
console.error('No SauceLabs credentials present');
112111
}
113112
}
114-
mkdirp.sync(bundleDirpath);
113+
fs.mkdirSync(bundleDirpath, {recursive: true});
115114
} else {
116115
console.error('CI mode disabled');
117116
}

lib/cli/init.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
const fs = require('fs');
1111
const path = require('path');
12-
const mkdirp = require('mkdirp');
1312

1413
exports.command = 'init <path>';
1514

@@ -24,7 +23,7 @@ exports.builder = yargs =>
2423
exports.handler = argv => {
2524
const destdir = argv.path;
2625
const srcdir = path.join(__dirname, '..', '..');
27-
mkdirp.sync(destdir);
26+
fs.mkdirSync(destdir, {recursive: true});
2827
const css = fs.readFileSync(path.join(srcdir, 'mocha.css'));
2928
const js = fs.readFileSync(path.join(srcdir, 'mocha.js'));
3029
const tmpl = fs.readFileSync(

lib/reporters/xunit.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
var Base = require('./base');
1010
var utils = require('../utils');
1111
var fs = require('fs');
12-
var mkdirp = require('mkdirp');
1312
var path = require('path');
1413
var errors = require('../errors');
1514
var createUnsupportedError = errors.createUnsupportedError;
@@ -62,7 +61,9 @@ function XUnit(runner, options) {
6261
throw createUnsupportedError('file output not supported in browser');
6362
}
6463

65-
mkdirp.sync(path.dirname(options.reporterOptions.output));
64+
fs.mkdirSync(path.dirname(options.reporterOptions.output), {
65+
recursive: true
66+
});
6667
self.fileStream = fs.createWriteStream(options.reporterOptions.output);
6768
}
6869

package-lock.json

Lines changed: 5 additions & 5 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 & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"test": "./test"
3535
},
3636
"engines": {
37-
"node": ">= 10.0.0"
37+
"node": ">= 10.12.0"
3838
},
3939
"scripts": {
4040
"prepublishOnly": "nps test clean build",
@@ -56,7 +56,6 @@
5656
"js-yaml": "3.13.1",
5757
"log-symbols": "3.0.0",
5858
"minimatch": "3.0.4",
59-
"mkdirp": "0.5.3",
6059
"ms": "2.1.1",
6160
"node-environment-flags": "1.0.6",
6261
"object.assign": "4.1.0",

test/integration/file-utils.spec.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ var utils = require('../../lib/utils');
44
var fs = require('fs');
55
var path = require('path');
66
var os = require('os');
7-
var mkdirp = require('mkdirp');
87
var rimraf = require('rimraf');
98

109
describe('file utils', function() {
@@ -119,7 +118,7 @@ describe('file utils', function() {
119118
afterEach(removeTempDir);
120119

121120
function makeTempDir() {
122-
mkdirp.sync(tmpDir);
121+
fs.mkdirSync(tmpDir, {recursive: true});
123122
}
124123

125124
function removeTempDir() {

test/reporters/xunit.spec.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ var EventEmitter = require('events').EventEmitter;
44
var fs = require('fs');
55
var os = require('os');
66
var path = require('path');
7-
var mkdirp = require('mkdirp');
87
var rimraf = require('rimraf');
98
var sinon = require('sinon');
109
var createStatsCollector = require('../../lib/stats-collector');
@@ -51,12 +50,12 @@ describe('XUnit reporter', function() {
5150
};
5251

5352
describe('when fileStream can be created', function() {
54-
var mkdirpSync;
53+
var fsMkdirSync;
5554
var fsCreateWriteStream;
5655

5756
beforeEach(function() {
5857
sandbox = sinon.createSandbox();
59-
mkdirpSync = sandbox.stub(mkdirp, 'sync');
58+
fsMkdirSync = sandbox.stub(fs, 'mkdirSync');
6059
fsCreateWriteStream = sandbox.stub(fs, 'createWriteStream');
6160
});
6261

@@ -67,7 +66,13 @@ describe('XUnit reporter', function() {
6766
XUnit.call(fakeThis, runner, options);
6867

6968
var expectedDirectory = path.dirname(expectedOutput);
70-
expect(mkdirpSync.calledWith(expectedDirectory), 'to be true');
69+
expect(
70+
fsMkdirSync.calledWith(expectedDirectory, {
71+
recursive: true
72+
}),
73+
'to be true'
74+
);
75+
7176
expect(fsCreateWriteStream.calledWith(expectedOutput), 'to be true');
7277
});
7378

0 commit comments

Comments
 (0)