fix(@angular-devkit/architect): always clear TestProjectHost on restore

This commit is contained in:
Filipe Silva 2018-07-04 16:13:03 +08:00 committed by clydin
parent e6be44ff7f
commit aa3901964d

View File

@ -18,7 +18,7 @@ import {
import { NodeJsSyncHost } from '@angular-devkit/core/node'; import { NodeJsSyncHost } from '@angular-devkit/core/node';
import { Stats } from 'fs'; import { Stats } from 'fs';
import { EMPTY, Observable, from, of } from 'rxjs'; import { EMPTY, Observable, from, of } from 'rxjs';
import { concatMap, delay, map, mergeMap, retry, tap } from 'rxjs/operators'; import { concatMap, delay, finalize, map, mergeMap, retry, tap } from 'rxjs/operators';
export class TestProjectHost extends NodeJsSyncHost { export class TestProjectHost extends NodeJsSyncHost {
@ -90,13 +90,12 @@ export class TestProjectHost extends NodeJsSyncHost {
// Wait 50ms and retry up to 10 times, to give time for file locks to clear. // Wait 50ms and retry up to 10 times, to give time for file locks to clear.
return this.exists(this.root()).pipe( return this.exists(this.root()).pipe(
delay(50), delay(50),
concatMap(exists => exists ? this.delete(this.root()) : of(null)), concatMap(exists => exists ? this.delete(this.root()) : EMPTY),
retry(10), retry(10),
tap(() => { finalize(() => {
this._currentRoot = null; this._currentRoot = null;
this._scopedSyncHost = null; this._scopedSyncHost = null;
}), }),
map(() => { }),
); );
} }