-
Notifications
You must be signed in to change notification settings - Fork 795
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(config): make logger required on ValidatedConfig (#3457)
this commit adds the `Logger` instance to `ValidatedConfig`, requiring the latter to hold an instance of the former. the `validateConfig` function has been altered to accept an instance of `LoadConfigInit`, the minimal configuration object that is used to bootstrap a stencil task. this allows a central place for an unvalidated configuration to be validated. Tather than semi-validating a config and mutating it after the fact as a part of the load process (which is what was previously done), all required fields are set in one place* the `setupTestingConfig` function signature was altered to accept a `ValidatedConfig` rather than a `Config`, as it's only caller has access to a `ValidatedConfig`. this allows us to simplify some of the logic for generating a validated config for testing purposes. \* for cases where the config does not pass through `validateConfig`, such as `runTask`, we will attempt to pull a `Logger` off the unvalidated config, or create one if one does not exist this commit introduces a mock creation function, `mockLoadConfigInit` to init the configuration file that used to bootstrap a task. this mock creator is used throughout the test suite, in order to provide a `LoadConfigInit` entity for `validateConfig` this commit does surface the face that `validateConfig` is used throughout the testing suite, and that the suite(s) should be refactored to use more specific functions under test, rather than calling the larger `validateConfig` function. this is being considered 'out-of-scope' & saved for a future day this commit removes a flaky test that was discovered in refactoring the existing test suites. a top level configuration entity was not being properly reset between test runs, causing the test to fail. looking at the test, it no longer tests a valid path in the codebase - in running coverage before and after this change (with jest's cache disabled), we see no decrease in code coverage this commit removes `Logger` instances from telemetry-related calls. as a part of the larger effort to make `Logger` always available on the `ValidatedConfig` entity, we will always be able to use the instance that is stored on the configuration, allowing us to decrease the arity of the fn signature * review(ap): remove unneeded logger value * review(ap): inline config var
- Loading branch information
1 parent
9b6d0ea
commit 3c95a71
Showing
29 changed files
with
302 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.