Skip to content

Commit

Permalink
remove lodash.create; closes #1868
Browse files Browse the repository at this point in the history
  • Loading branch information
boneskull committed Sep 7, 2015
1 parent 2515277 commit c7a8fed
Show file tree
Hide file tree
Showing 16 changed files with 94 additions and 1,145 deletions.
7 changes: 2 additions & 5 deletions lib/hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

var Runnable = require('./runnable');
var create = require('lodash.create');
var inherits = require('./utils').inherits;

/**
* Expose `Hook`.
Expand All @@ -26,10 +26,7 @@ function Hook(title, fn) {
/**
* Inherit from `Runnable.prototype`.
*/

Hook.prototype = create(Runnable.prototype, {
constructor: Hook
});
inherits(Hook, Runnable);

/**
* Get or set the test `err`.
Expand Down
7 changes: 2 additions & 5 deletions lib/reporters/dot.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

var Base = require('./base');
var create = require('lodash.create');
var inherits = require('../utils').inherits;
var color = Base.color;

/**
Expand Down Expand Up @@ -63,7 +63,4 @@ function Dot(runner) {
/**
* Inherit from `Base.prototype`.
*/

Dot.prototype = create(Base.prototype, {
constructor: Dot
});
inherits(Dot, Base);
7 changes: 2 additions & 5 deletions lib/reporters/landing.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

var Base = require('./base');
var create = require('lodash.create');
var inherits = require('../utils').inherits;
var cursor = Base.cursor;
var color = Base.color;

Expand Down Expand Up @@ -89,7 +89,4 @@ function Landing(runner) {
/**
* Inherit from `Base.prototype`.
*/

Landing.prototype = create(Base.prototype, {
constructor: Landing
});
inherits(Landing, Base);
7 changes: 2 additions & 5 deletions lib/reporters/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

var Base = require('./base');
var create = require('lodash.create');
var inherits = require('../utils').inherits;
var color = Base.color;
var cursor = Base.cursor;

Expand Down Expand Up @@ -58,7 +58,4 @@ function List(runner) {
/**
* Inherit from `Base.prototype`.
*/

List.prototype = create(Base.prototype, {
constructor: List
});
inherits(List, Base);
7 changes: 2 additions & 5 deletions lib/reporters/min.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

var Base = require('./base');
var create = require('lodash.create');
var inherits = require('../utils').inherits;

/**
* Expose `Min`.
Expand Down Expand Up @@ -33,7 +33,4 @@ function Min(runner) {
/**
* Inherit from `Base.prototype`.
*/

Min.prototype = create(Base.prototype, {
constructor: Min
});
inherits(Min, Base);
7 changes: 2 additions & 5 deletions lib/reporters/nyan.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

var Base = require('./base');
var create = require('lodash.create');
var inherits = require('../utils').inherits;

/**
* Expose `Dot`.
Expand Down Expand Up @@ -62,10 +62,7 @@ function NyanCat(runner) {
/**
* Inherit from `Base.prototype`.
*/

NyanCat.prototype = create(Base.prototype, {
constructor: NyanCat
});
inherits(NyanCat, Base);

/**
* Draw the nyan cat
Expand Down
7 changes: 2 additions & 5 deletions lib/reporters/progress.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

var Base = require('./base');
var create = require('lodash.create');
var inherits = require('../utils').inherits;
var color = Base.color;
var cursor = Base.cursor;

Expand Down Expand Up @@ -86,7 +86,4 @@ function Progress(runner, options) {
/**
* Inherit from `Base.prototype`.
*/

Progress.prototype = create(Base.prototype, {
constructor: Progress
});
inherits(Progress, Base);
7 changes: 2 additions & 5 deletions lib/reporters/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

var Base = require('./base');
var create = require('lodash.create');
var inherits = require('../utils').inherits;
var color = Base.color;
var cursor = Base.cursor;

Expand Down Expand Up @@ -80,7 +80,4 @@ function Spec(runner) {
/**
* Inherit from `Base.prototype`.
*/

Spec.prototype = create(Base.prototype, {
constructor: Spec
});
inherits(Spec, Base);
10 changes: 4 additions & 6 deletions lib/reporters/xunit.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
*/

var Base = require('./base');
var create = require('lodash.create');
var utils = require('../utils');
var inherits = utils.inherits;
var fs = require('fs');
var escape = require('../utils').escape;
var escape = utils.escape;

/**
* Save timer references to avoid Sinon interfering (see GH-237).
Expand Down Expand Up @@ -95,10 +96,7 @@ XUnit.prototype.done = function(failures, fn) {
/**
* Inherit from `Base.prototype`.
*/

XUnit.prototype = create(Base.prototype, {
constructor: XUnit
});
inherits(XUnit, Base);

/**
* Write out the given line.
Expand Down
7 changes: 2 additions & 5 deletions lib/runnable.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

var EventEmitter = require('events').EventEmitter;
var Pending = require('./pending');
var create = require('lodash.create');
var debug = require('debug')('mocha:runnable');
var milliseconds = require('./ms');
var utils = require('./utils');
var inherits = utils.inherits;

/**
* Save timer references to avoid Sinon interfering (see GH-237).
Expand Down Expand Up @@ -57,10 +57,7 @@ function Runnable(title, fn) {
/**
* Inherit from `EventEmitter.prototype`.
*/

Runnable.prototype = create(EventEmitter.prototype, {
constructor: Runnable
});
inherits(Runnable, EventEmitter);

/**
* Set & get timeout `ms`.
Expand Down
22 changes: 10 additions & 12 deletions lib/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@

var EventEmitter = require('events').EventEmitter;
var Pending = require('./pending');
var create = require('lodash.create');
var utils = require('./utils');
var inherits = utils.inherits;
var debug = require('debug')('mocha:runner');
var filter = require('./utils').filter;
var indexOf = require('./utils').indexOf;
var keys = require('./utils').keys;
var stackFilter = require('./utils').stackTraceFilter();
var stringify = require('./utils').stringify;
var type = require('./utils').type;
var undefinedError = require('./utils').undefinedError;
var filter = utils.filter;
var indexOf = utils.indexOf;
var keys = utils.keys;
var stackFilter = utils.stackTraceFilter();
var stringify = utils.stringify;
var type = utils.type;
var undefinedError = utils.undefinedError;

/**
* Non-enumerable globals.
Expand Down Expand Up @@ -87,10 +88,7 @@ Runner.immediately = global.setImmediate || process.nextTick;
/**
* Inherit from `EventEmitter.prototype`.
*/

Runner.prototype = create(EventEmitter.prototype, {
constructor: Runner
});
inherits(Runner, EventEmitter);

/**
* Run tests with full titles matching `re`. Updates runner.total
Expand Down
9 changes: 3 additions & 6 deletions lib/suite.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

var EventEmitter = require('events').EventEmitter;
var Hook = require('./hook');
var create = require('lodash.create');
var utils = require('./utils');
var inherits = utils.inherits;
var debug = require('debug')('mocha:suite');
var milliseconds = require('./ms');
var utils = require('./utils');

/**
* Expose `Suite`.
Expand Down Expand Up @@ -66,10 +66,7 @@ function Suite(title, parentContext) {
/**
* Inherit from `EventEmitter.prototype`.
*/

Suite.prototype = create(EventEmitter.prototype, {
constructor: Suite
});
inherits(Suite, EventEmitter);

/**
* Return a clone of this `Suite`.
Expand Down
7 changes: 2 additions & 5 deletions lib/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

var Runnable = require('./runnable');
var create = require('lodash.create');
var inherits = require('./utils').inherits;

/**
* Expose `Test`.
Expand All @@ -27,7 +27,4 @@ function Test(title, fn) {
/**
* Inherit from `Runnable.prototype`.
*/

Test.prototype = create(Runnable.prototype, {
constructor: Test
});
inherits(Test, Runnable);
2 changes: 2 additions & 0 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ var watchFile = require('fs').watchFile;

var ignore = ['node_modules', '.git'];

exports.inherits = require('util').inherits;

/**
* Escape special characters in the given string of html.
*
Expand Down

0 comments on commit c7a8fed

Please sign in to comment.