Skip to content

Commit

Permalink
Replace findup-sync with find-up for faster startup (#3830)
Browse files Browse the repository at this point in the history
* Replace findup-sync with find-up, hopefully to increase startup performance

* update package-lock.json
  • Loading branch information
cspotcode authored and boneskull committed Mar 13, 2019
1 parent d5ba121 commit 0098147
Show file tree
Hide file tree
Showing 6 changed files with 160 additions and 111 deletions.
4 changes: 2 additions & 2 deletions lib/cli/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/

const fs = require('fs');
const findUp = require('findup-sync');
const findUp = require('find-up');
const path = require('path');
const debug = require('debug')('mocha:cli:config');

Expand Down Expand Up @@ -72,7 +72,7 @@ exports.loadConfig = filepath => {
* @returns {string|null} Filepath to config, if found
*/
exports.findConfig = (cwd = process.cwd()) => {
const filepath = findUp(exports.CONFIG_FILES, {cwd});
const filepath = findUp.sync(exports.CONFIG_FILES, {cwd});
if (filepath) {
debug(`found config at ${filepath}`);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/cli/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const {ONE_AND_DONE_ARGS} = require('./one-and-dones');
const mocharc = require('../mocharc.json');
const {list} = require('./run-helpers');
const {loadConfig, findConfig} = require('./config');
const findup = require('findup-sync');
const findUp = require('find-up');
const {deprecate} = require('../utils');
const debug = require('debug')('mocha:cli:options');
const {createMissingArgumentError} = require('../errors');
Expand Down Expand Up @@ -255,7 +255,7 @@ const loadPkgRc = (args = {}) => {
return result;
}
result = {};
const filepath = args.package || findup(mocharc.package);
const filepath = args.package || findUp.sync(mocharc.package);
if (filepath) {
try {
const pkg = JSON.parse(fs.readFileSync(filepath, 'utf8'));
Expand Down
Loading

0 comments on commit 0098147

Please sign in to comment.