mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
25 lines
606 B
TypeScript
25 lines
606 B
TypeScript
import { TestBed } from '@angular/core/testing'
|
|
|
|
type CompilerOptions = Partial<{
|
|
providers: any[]
|
|
useJit: boolean
|
|
preserveWhitespaces: boolean
|
|
}>
|
|
export type ConfigureFn = (testBed: typeof TestBed) => void
|
|
|
|
export const configureTests = (
|
|
configure: ConfigureFn,
|
|
compilerOptions: CompilerOptions = {}
|
|
) => {
|
|
const compilerConfig: CompilerOptions = {
|
|
preserveWhitespaces: false,
|
|
...compilerOptions,
|
|
}
|
|
|
|
const configuredTestBed = TestBed.configureCompiler(compilerConfig)
|
|
|
|
configure(configuredTestBed)
|
|
|
|
return configuredTestBed.compileComponents().then(() => configuredTestBed)
|
|
}
|