(
sourceFiles: TestFile[],
options: {
optimize: boolean;
sidecar?: boolean;
templateParseOptions?: Record<string, any>;
errors?: string[];
format?: boolean;
complianceMode?: boolean;
},
)
| 350 | * Run the test pipeline with virtual files |
| 351 | */ |
| 352 | export async function runPipeline( |
| 353 | sourceFiles: TestFile[], |
| 354 | options: { |
| 355 | optimize: boolean; |
| 356 | sidecar?: boolean; |
| 357 | templateParseOptions?: Record<string, any>; |
| 358 | errors?: string[]; |
| 359 | format?: boolean; |
| 360 | complianceMode?: boolean; |
| 361 | }, |
| 362 | ): Promise<TestFile[]> { |
| 363 | const maybeFormat = (p: string, content: string): Promise<string> => |
| 364 | options.format === false ? Promise.resolve(content) : formatContent(p, content); |
| 365 | |
| 366 | const nodeModulesPath = resolveFixtureNodeModules(); |
| 367 | |
| 368 | const virtualFiles: Record<string, string> = {}; |
| 369 | for (const f of sourceFiles) { |
| 370 | virtualFiles[f.path] = f.content; |
| 371 | } |
| 372 | |
| 373 | const tsconfigFile = sourceFiles.find((f) => f.path.endsWith('tsconfig.json')); |
| 374 | if (!tsconfigFile) { |
| 375 | throw new Error('tsconfig.json must be provided in source files'); |
| 376 | } |
| 377 | |
| 378 | let tsconfigOptions: any = {}; |
| 379 | let compilerOptions: any = {}; |
| 380 | let bazelOptions: any = {}; |
| 381 | try { |
| 382 | const parsed = JSON.parse(tsconfigFile.content); |
| 383 | tsconfigOptions = parsed.angularCompilerOptions ?? {}; |
| 384 | compilerOptions = parsed.compilerOptions ?? {}; |
| 385 | bazelOptions = parsed.bazelOptions || parsed.bazelOpts || {}; |
| 386 | } catch (e) { |
| 387 | // Ignore |
| 388 | } |
| 389 | |
| 390 | const isClosureCompilerEnabled = |
| 391 | tsconfigOptions.annotateForClosureCompiler === true || |
| 392 | bazelOptions.annotateForClosureCompiler === true || |
| 393 | bazelOptions.tsickle === true; |
| 394 | |
| 395 | const emitDeclarationOnly = |
| 396 | compilerOptions.emitDeclarationOnly === true && |
| 397 | tsconfigOptions._experimentalAllowEmitDeclarationOnly === true; |
| 398 | |
| 399 | const onlyPublishPublicTypingsForNgModules = |
| 400 | tsconfigOptions.onlyPublishPublicTypingsForNgModules === true; |
| 401 | |
| 402 | const forbidOrphanComponents = tsconfigOptions.forbidOrphanComponents === true; |
| 403 | const supportJitMode = tsconfigOptions.supportJitMode !== false; |
| 404 | const ngtscOptions = { |
| 405 | preserveWhitespaces: tsconfigOptions.preserveWhitespaces, |
| 406 | supportTestBed: tsconfigOptions.supportTestBed, |
| 407 | enableI18nLegacyMessageIdFormat: tsconfigOptions.enableI18nLegacyMessageIdFormat ?? false, |
| 408 | i18nUseExternalIds: tsconfigOptions.i18nUseExternalIds, |
| 409 | i18nNormalizeLineEndingsInICUs: tsconfigOptions.i18nNormalizeLineEndingsInICUs, |
no test coverage detected