/
githubmirror
/
angular-cli
Обзор
Документация
Войти
/
githubmirror
/
angular-cli
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/angular/build/src/builders/dev-server/tests/jasmine-helpers.ts
42 строки
1 KB
Alan Agius
test(@angular/build): remove isViteRun from dev-server test harness
27 фев 2026, 17:22
27 фев 2026, 17:22
7f101f1
Код
Авторство
О чём код?
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import { BuilderHandlerFn } from '@angular-devkit/architect'; import { json } from '@angular-devkit/core'; import { readFileSync } from 'node:fs'; import { JasmineBuilderHarness, host, setupApplicationTarget } from './setup'; const optionSchemaCache = new Map<string, json.schema.JsonSchema>(); let counter = 0; export function describeServeBuilder<T>( builderHandler: BuilderHandlerFn<T & json.JsonObject>, options: { name?: string; schemaPath: string }, specDefinitions: ( harness: JasmineBuilderHarness<T>, setupTarget: typeof setupApplicationTarget, ) => void, ): void { let optionSchema = optionSchemaCache.get(options.schemaPath); if (optionSchema === undefined) { optionSchema = JSON.parse(readFileSync(options.schemaPath, 'utf8')) as json.schema.JsonSchema; optionSchemaCache.set(options.schemaPath, optionSchema); } const harness = new JasmineBuilderHarness<T>(builderHandler, host, { builderName: options.name, optionSchema, }); // The counter is needed to avoid duplicate describe names as they are not allowed. describe((options.name || builderHandler.name) + ` (${counter++})`, () => { beforeEach(() => host.initialize().toPromise()); afterEach(() => host.restore().toPromise()); specDefinitions(harness, setupApplicationTarget); }); }