mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-07 23:35:22 +01:00
22 lines
611 B
TypeScript
22 lines
611 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);
|
||
|
|
};
|