Skip to content

Commit

Permalink
Chore: convert StubModuleResolver in config tests to ES6 class (#8265)
Browse files Browse the repository at this point in the history
Unlike the modules described in #8231, StubModuleResolver is not exposed as part of the public API, so this is not a breaking change.
  • Loading branch information
not-an-aardvark committed Mar 17, 2017
1 parent 0c0fc31 commit 6f05546
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions tests/lib/config/config-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,17 +123,15 @@ function createStubModuleResolver(mapping) {
* @constructor
* @private
*/
function StubModuleResolver() {}
return class StubModuleResolver {
resolve(name) { // eslint-disable-line class-methods-use-this
if (mapping.hasOwnProperty(name)) {
return mapping[name];
}

StubModuleResolver.prototype.resolve = function(name) {
if (mapping.hasOwnProperty(name)) {
return mapping[name];
throw new Error(`Cannot find module '${name}'`);
}

throw new Error(`Cannot find module '${name}'`);
};

return StubModuleResolver;
}

//------------------------------------------------------------------------------
Expand Down

0 comments on commit 6f05546

Please sign in to comment.