Skip to content

Commit

Permalink
feat: allow overriding global teardown options (#502)
Browse files Browse the repository at this point in the history
  • Loading branch information
arturovt authored Oct 26, 2021
1 parent 39dec2a commit e25b5eb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions projects/spectator/src/lib/base/initial-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@ export function initialModule(options: Required<BaseSpectatorOptions>): ModuleMe
return {
declarations: [...globals.declarations, ...options.declarations, ...options.entryComponents],
imports: [...(options.disableAnimations ? [NoopAnimationsModule] : []), ...globals.imports, ...options.imports],
providers: [...globals.providers, ...options.providers, ...options.mocks.map(type => options.mockProvider(type))],
providers: [...globals.providers, ...options.providers, ...options.mocks.map((type) => options.mockProvider(type))],
entryComponents: [...options.entryComponents],
teardown: {...options.teardown}
teardown:
// Caretaker note: we don't want to merge the `globals.teardown` and `options.teardown`, since `options.teardown`
// is always defined. If the user calls `defineGlobalsInjections({ teardown: { ... } })` and we merge it with
// `options.teardown`, then `options.teardown` will always override global options.
{ ...(globals.teardown || options.teardown) },
};
}

0 comments on commit e25b5eb

Please sign in to comment.