Skip to content

Commit

Permalink
Add tests/bugfixes for loadConfig (#1059)
Browse files Browse the repository at this point in the history
- Fixed bug where a user specifies loading of a config with a flag, but if that file isn't found, it loads an `apollo.config.js`. 
	- Ex: `apollo client:check --config=config/apollo.js` would also load `./apollo.config.js` if it couldn't find the specified config. I think if a user is _manually specifying_ a config, it should _only_ load what they specified and throw an error if not found. 
	- This was preventing testing errors, since leaving off a config would just load this repo's config (which wouldn't work)
- Removed the `getSearchPlaces` function. It was extraneous, and misleading. While `search places` is the term that dotenv uses, it is less descriptive than `defaultFileNames`, since that what the search places are–filenames.
- Added `try/catch` around the cosmiconfig's loader, since it can throw on malformed files with an unhelpful error.
- Handled case where `.env` is not a `File`, but a folder or something else. Resolves #1132 
- Split up project type and service name setting, since those being intertwined added unnecessary complexity
  • Loading branch information
JakeDawkins committed Apr 1, 2019
1 parent bae718d commit df158e0
Show file tree
Hide file tree
Showing 3 changed files with 493 additions and 53 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Upcoming

- apollo-language-server
- Stop loadConfig from looking up the tree when a --config location is defined [#1059](https://github.com/apollographql/apollo-tooling/pull/1059)
- Refactored/documented/tested loadConfig [#1059](https://github.com/apollographql/apollo-tooling/pull/1059)

## `apollo-codegen-flow@0.32.11`

- `apollo-codegen-flow@0.32.11`
Expand Down
Loading

0 comments on commit df158e0

Please sign in to comment.