Skip to content
This repository has been archived by the owner on Jun 18, 2019. It is now read-only.

Commit

Permalink
fix(ConfigPathResolver): Fixes case when require.resolve returns `E…
Browse files Browse the repository at this point in the history
…rror`
  • Loading branch information
mdreizin committed Jul 8, 2016
1 parent 241e432 commit 5e59bf3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/ConfigPathResolver.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
isString,
isError
} from 'lodash';
import {
Expand Down Expand Up @@ -104,9 +105,10 @@ class ConfigPathResolver {
filename = this.nameResolver.resolveName(filename);

for (const resolver of this.resolvers) {
const value = resolver(filename);
const value = resolver(filename),
throwsError = isError(value) || value instanceof Error;

if (!isError(value)) {
if (isString(value) && !throwsError) {
filename = value;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion test/ConfigPathResolver.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import ConfigPatternCache from '../src/ConfigPatternCache';
import ConfigNameResolver from '../src/ConfigNameResolver';
import ConfigPathResolver from '../src/ConfigPathResolver';

describe('ConfigNameResolver', () => {
describe('ConfigPathResolver', () => {
let environment,
patternCache,
nameResolver,
Expand Down

0 comments on commit 5e59bf3

Please sign in to comment.