blob: 9ca9179c670557cf47b421549c15f10986ebe102 [file] [log] [blame]
ys969316a9fce2020-01-19 13:50:02 +02001import { TestBed } from '@angular/core/testing'
2
3type CompilerOptions = Partial<{
4 providers: any[]
5 useJit: boolean
6 preserveWhitespaces: boolean
7}>
8export type ConfigureFn = (testBed: typeof TestBed) => void
9
10export const configureTests = (configure: ConfigureFn, compilerOptions: CompilerOptions = {}) => {
11 const compilerConfig: CompilerOptions = {
12 preserveWhitespaces: false,
13 ...compilerOptions,
14 };
15
16 const configuredTestBed = TestBed.configureCompiler(compilerConfig);
17
18 configure(configuredTestBed);
19
20 return configuredTestBed.compileComponents().then(() => configuredTestBed)
21};