File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
packages/angular_devkit/core/node Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -136,12 +136,13 @@ export class NodeJsAsyncHost implements virtualFs.Host<Stats> {
136136 }
137137
138138 exists ( path : Path ) : Observable < boolean > {
139- return observableFrom ( exists ( path ) ) ;
139+ return observableFrom ( exists ( getSystemPath ( path ) ) ) ;
140140 }
141141
142142 isDirectory ( path : Path ) : Observable < boolean > {
143143 return this . stat ( path ) . pipe ( map ( ( stat ) => stat . isDirectory ( ) ) ) ;
144144 }
145+
145146 isFile ( path : Path ) : Observable < boolean > {
146147 return this . stat ( path ) . pipe ( map ( ( stat ) => stat . isFile ( ) ) ) ;
147148 }
@@ -267,6 +268,7 @@ export class NodeJsSyncHost implements virtualFs.Host<Stats> {
267268 // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
268269 return this . stat ( path ) ! . pipe ( map ( ( stat ) => stat . isDirectory ( ) ) ) ;
269270 }
271+
270272 isFile ( path : Path ) : Observable < boolean > {
271273 // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
272274 return this . stat ( path ) ! . pipe ( map ( ( stat ) => stat . isFile ( ) ) ) ;
Original file line number Diff line number Diff line change @@ -30,8 +30,17 @@ describe('NodeJsAsyncHost', () => {
3030 root = temp . mkdirSync ( 'core-node-spec-' ) ;
3131 host = new virtualFs . ScopedHost ( new NodeJsAsyncHost ( ) , normalize ( root ) ) ;
3232 } ) ;
33+
3334 afterEach ( ( done ) => host . delete ( normalize ( '/' ) ) . toPromise ( ) . then ( done , done . fail ) ) ;
3435
36+ it ( 'should get correct result for exists' , async ( ) => {
37+ let isExists = await host . exists ( normalize ( 'not-found' ) ) . toPromise ( ) ;
38+ expect ( isExists ) . toBe ( false ) ;
39+ await host . write ( normalize ( 'not-found' ) , virtualFs . stringToFileBuffer ( 'content' ) ) . toPromise ( ) ;
40+ isExists = await host . exists ( normalize ( 'not-found' ) ) . toPromise ( ) ;
41+ expect ( isExists ) . toBe ( true ) ;
42+ } ) ;
43+
3544 linuxOnlyIt (
3645 'can watch' ,
3746 ( done ) => {
You can’t perform that action at this time.
0 commit comments