SchematicTestRunner: ability to run scheduled tasks
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- typescript
Línea de trabajo
Comienza con la implementación de SchematicTestRunner y el recorrido de planificación de tareas alrededor de context.addTask y runner.engine.executePostTasks(); inspecciona cómo RunSchematicTask utiliza el flujo de trabajo del engine. Se considera terminado cuando las pruebas pueden ejecutar únicamente tareas planificadas con un nombre seleccionado, o cuando RunSchematicTask funciona en SchematicTestRunner, con cobertura para el comportamiento compatible.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
If someone uses the SchematicTestRunner and runs a schematic that schedules specific tasks using the context.addTask method, those tasks cannot be run in the tests.
I figured that there is a method (runner.engine.executePostTasks() that runs all scheduled tasks. This is not really helpful though, since there are situations where we only want to run specific tasks and not all scheduled tasks.
This is because some tasks like RunSchematicTask depend on a engine.workflow that is not set up in the SchematicTestRunner. It would be either nice if the RunSchematicTask could work properly in the tests, or there is a method that runs tasks with a specific name.
Current workaround:
/**
* Due to the fact that the Angular devkit does not support running scheduled tasks from a
* schematic that has been launched through the TestRunner, we need to manually find the task
* executor for the given task name and run all scheduled instances.
*
* Note that this means that there can be multiple tasks with the same name. The observable emits
* only when all tasks finished executing.
*/
export function runPostScheduledTasks(runner: SchematicTestRunner, taskName: string) {
const host = runner.engine['_host'] as EngineHost<{}, {}>;
const tasks = runner.engine['_taskSchedulers'] as TaskScheduler[];
return observableFrom(tasks).pipe(
concatMap(scheduler => scheduler.finalize()),
filter(task => task.configuration.name === taskName),
concatMap(task => {
return host.createTaskExecutor(task.configuration.name)
.pipe(concatMap(executor => executor(task.configuration.options, task.context)));
}),
// Only emit the last emitted value because there can be multiple tasks with the same name.
// The observable should only emit a value if all tasks completed.
last()
);
}
cc. @jelbourn @hansl
- Lenguaje dominante
- TypeScript
- Estrellas
- 27k
- Forks
- 11.8k
- Merge medio
- 17 h 25 min
- PR fusionados (30 d)
- 183
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de angular/angular-cli
-
Can't use an array of hostnames in --allowedHosts cli parameter in @angular/build:dev-server Abiertoarea: @angular/build gemini-triaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
angular/angular-cli#33955 ·
-
area: @angular/cli gemini-triaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
angular/angular-cli#33055 · 1 comentario · 3 reacciones ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34131 · 1 asignado ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34130 · 1 asignado ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34128 · 1 asignado ·
Todos los issues de angular/angular-cli
Issues similares
-
[Bug]: Discord Activity titles with emoji are rejected as over 80 characters when they are not Abiertoclawsweeper:linked-pr-open clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:message-loss issue-rating: 🦞 diamond lobster maturity:stable P2
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Eynzof/Hermes-CN-Desktop#616 ·
-
ZCode 3.14.3 に対応する Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
supermomonga/zcode-acp#24 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
growthbook/growthbook#7100 ·
-
triage
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100